my game's idea is to use a open world map consisting of say 4096x4096 size, and multiple grids of 64x64 size. When I click on any grid, the map zooms in to show that grid(either creating in from scratch or loading off a JSON) because saving all the grids could not be memory efficient. Is there any algorithm to do like this?
You don't really need any specific algorithm to accomplish this. One way you can achieve that is this:
- Make an array that holds your tiles, most likely a 2D array will do.
- For each tile, make a
jsonfile, that describes what that tile looks like. Name the
jsonfiles in a sequence, so the first tile would be
tile_0.jsonthe next one
- When the user clicks on a tile, depending on which tile it was, open the right
jsonfile, and load everything that it needs.
Depending on what language / platform / tools you are using, this might look different in actual code.