• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

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