• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

What data structure are tilemaps stored as?

Basically I want to save the tilemap to a txt file (or json) and then load it back into the game so player created / destroyed blocks have persistence.

Currently I use a pair of nested for loops to go through the tilemap and store each tile value into a grid, then store that grid as a string.

However, if I could just copy the tilemap grid or read it directly and cut out the middleman I feel like that would cut down on save times a good bit.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Tilemaps are not stored as any kind of data structure (or at least, if they are, it's not exposed to the user), so I would say that the way you are doing it currently is the only way you are going to get the data you require.
 
Top