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:
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
jsonfile, and load everything that it needs.
Depending on what language / platform / tools you are using, this might look different in actual code.