Projects BirchGames island_farm Issues #12
#12  Implement dynamic chunk load and unloading.
Closed
Kim André Bjørkede opened 2 years ago

Currently the tilemap uses a shit-ton of memory, having a big island can use a few gigabytes of memory!

The proposed solution is to unload chunks that are far away from the player and then reload them when they are close.

The solution for unloaded chunks would be like the way it works in the savedata.

Should the game just use the save data? The problem with this is that the game would have to save the savedata every time a chunk is loaded. This would mess with players who would want to manually save the game.

Another solution would be to have the serialized chunk array in memory. It should use a lot less memory than the tileset does.

Kim André Bjørkede commented 2 years ago

I'm leaning towards the second.

Having the dictionary with the arrays of chunks that serialize_world() currently produces in memory seems like the way to go.

The chunk generation function could save the serialized tiledata to the dictionary upon generation.

Saving the world would then be as easy as just returning the serialized array to the save function.

Kim André Bjørkede changed state to 'Closed' 2 years ago
Previous Value Current Value
Open
Closed
Kim André Bjørkede commented 2 years ago

Implemented pr #8

issue 1 of 1
Type
Improvement
Priority
Normal
Assignees
Issue Votes (0)
Watchers (1)
Reference
BirchGames/island_farm#12
Please wait...
Page is in error, reload to recover