Save everything, but larger

The Gdevelop’s official “save everything” video saved my game from a scuffed saving and loading features, but i am now in another pickle. Devices obviously start to lag alot beyond 10k+ objects, and i could deal with alot less objects, if i got an idea on how could i Load my world in little slices, instead of all at once. i have saving and loading set up, and in my previous project, the chunks were split into separate .json files, where a in-game variable selected which file to load up, and the variable changes between Black fadeouts when walking off the screen, but i would be happier with Something like minecraft and terraria, where the scene change is unnecessary, and the game would know to load out the areas near player, and save the chunk out of range, before deleting those blocks. I havent come to a solution of creating/deleting objects in a way that doesnt get messy, or slow down the game do a crawl. any advice is welcome.

Player position on map as simple as that
IF each chunk have set place on your map then it would be as simple as checking X and Y position of player
If it is above and or below some X and Y position of player
So for example you have 100x100 pixels map
You now check if player position is above X 0 but below X 20
This way you are checking if player is at least 1 pixel from left map edge but not further than 20 pixels from left map edge
And you do same exact crap for Y

Now i would load as much chunks as for player camera can reach
For example imagine you camera can grab 50 pixels at a time horizontally so on X axis
So i would load as much as two chunks which takes 20 pixels to the left and right from your player
And follow same logic for up and down
This way it would be seamless transition
And follow reverse logic for deleting crap

So now all you need to do just find your numbers you need simple thing to achieve it
Would be to just place block which change color if player is in range of it
Center player with camera with condition that if W A S D (or arrows both for walking) is pressed
This way camera moves with player position
And now you could for example make separate event to change camera position with some other keys or with numpad keys
And since your blocks which change color depending on if player is in some distance from them you could see by moving camera as free camera from player
Simply check if blocks change colors properly on distance player is from them
And that is how you test does it work and you are pretty much set

It is a bit of configuration but you will do it only once and once it is done you just use it and never will need to come back to it again
So i say it is worth it
Just go for it

1 Like

On my way to conceptualize this on paper. Thank you for contributing with your help, it’s very much appreciated.