1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

What data structure are tilemaps stored as?

Discussion in 'Programming' started by RipRoarinBoogerBenis, Nov 7, 2019.

  1. RipRoarinBoogerBenis

    RipRoarinBoogerBenis Member

    Joined:
    Feb 11, 2018
    Posts:
    41
    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.
     
  2. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,977
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice