How to change tile effect with HTTP API v1?

Hello, I tested the HTTP API with a room in my space and I get a data packet where most is understandable, but I don’t know how to modify the tile effect for a specific tile. I see two possible parameters to do that in the data : “collisions” and “floors” but I do not see how is is “coded”
If anyone know how to do !!?
Thanks

Assuming you are trying to make impassable tiles, collisions is what you want.

Portals and spawn tiles should be easy to understand. Announcer is spotlight tiles. Spaces are private spaces.

Hopefully that clears up most of the naming.

Collisions are coded as an array of bytes (in v1) which is as long as the area of your map, and basically start at (0,0) and typewriters through the map until (x,y), where x and y are your map dimensions.

Hopefully that covers the coding portion of the question!

1 Like

Thanks a lot !
Whit your information, I started doing some test to understand the coding :

Collisions is a list of 4-letters blocks (all blocks are glued together!).
Each block start with an A and described the situation of three consecutive tiles : with an A if there is no impassible effect, and with another letter if there is an impassible effect => Q for the first letter, E, for the second and B for the third.
The last block may have one or two = symbol to complete to have a 4-letter block.

For instance, to find the tile x,y (x and y >0)in a map with dimensions 15*10, just calculate the position of the tile in the string collisions like that :
param=(y)15+x+1
then compute alpha=floor(param/3) and beta=param modulo 3
Position = alpha
4+beta. Then depending on beta, if you want to code an impassible tile, with beta=0, letter is B, if beta=1, letter is Q, and id beta=2, letter is E

This should make your life a lot easier on this project:

Array.from(Uint8Array.from(Buffer.from(COLLISION_DATA, “base64”)))

That will convert your COLLISION_DATA from As Es and Qs to 0 = no tile, and 1 = impassable tile. You can then edit this much the same, and then convert back.

I have how to convert back written up somewhere, but I shifted over to the Websocket and a lot of the restAPI has gotten rusty. If you have trouble reconverting it into the correct format, Ill dredge it up.

Cheers!

Ah, yes, much more simple, I’m not used to that sort of conversion.
Thanks !
I will translate that in to PHP :slightly_smiling_face: