I’m making a map editor that uses 3D tiles, each is 1x1x1 units, they are placed on a grid but my issue is how to save them? My initial idea was to use a image file using the bytes inside as the tile(0-255) and pixel location as the real world location, so say a image of 16,16 would make a level thats 16,16 units. This method works ok, but the use is limited in the amount of stacked tiles as their can only be four layers(one for each channel, in this case RGBA) which I thought would have been enough but now I realise that its very easy to want to make large mountains and things and a easy way of doing it is just making tonnes of layers.
I think I’m going to go with a 3D byte array that holds the values, then try and save this to a file. The issue with this is lots of the elements would be empty because if the user is making a map on the ground level then they make a giant tower it pushes the height of the level for possibly only a few tiles.
Any other ideas? I need to easily be able to compare the byte to another set that stores collision data.
I like the image idea, it feels nice and compact. Maybe you could abstract the bits in some way. On the high end, how many options do you imagine a tile could have (terrain type or whatever)?
I’m not really sure, RPG maker seems to have 256 tiles which sounds pretty nice to me, but I’d support multiple tile maps probably so that could go down (But if the identifier is just a single byte then I can’t see how it could go up)
EDIT: Actually, maybe I misunderstood you, did you mean how many tiles will I have? Or something else?
Perhaps you are using “wrong” these rbga values? Why not use the alpha value for layers? And if you dont need to see difference in stored data with human eye (as a different color), you could use only R value for tiletypes, if you need more tiles, you could use G value for subtype, you know… hmm, for example RGBA = (42,21,33,112) where (R) 42 is rock, and (G) 21 is slimyRock… (B) 33 could be for example hitpoints… and (A) 112 is the layer.
You can store even more different kind of data to these values if you make some rules like R(0,100) = tiletypes, R(200,240) = PlayerSkills etc