Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chunk loading unloading #71

Merged
merged 255 commits into from
Mar 5, 2024

Conversation

snipercup
Copy link
Collaborator

This requires #70 to work. I will publish this PR as a draft to make sure #70 gets merged first.

Instead of loading the entire map at once, each 32x32 chunk is loaded only when it is in range and unloaded when it is outside range. This is needed if we ever want to drive a car around. Without chunking, we would be limited in map size.

The implementation is relatively simple, I use the threading API to load and unload chunks. In threads we cannot manipulate the scene tree, so a lot of code had to be reworked.

The game does not run smooth in a 6x6 map. Since this is the initial chunking implementation, I did not expect to reach perfection in this regard. Further tweaking will be needed.

We do not need the default nod scenes anymore, like mob.tscn, defaultblock.tscn, defaultslope.tscn, mob_corpse.tscn, furniturephysics.tscn and furniturestatic.tscn since they are now classes that are created as new() instead of scenes being instantiate()'d. I left them in the project for now since they contain settings that were used previously, so we can check if it matches what is being created in code.

If the threading api does not take us where we want to be, we can go up two steps of complexity. First by using lower-level threading api functions, and secondly by implementing something like Arch-ECS.

When the materials are generated, set the proper uv scaling so they are correctly visualized in-game.
This fixes the situation where if two map editors are opened, only the last one receives input from the scroll wheel
Improved saving loading, added duplicate and delete buttons, icons
Add name and description labels to show info on a tile
Overmap chunks will stay consistent even after changing scenes.
@snipercup snipercup marked this pull request as ready for review March 5, 2024 15:57
@snipercup snipercup merged commit 6af295f into Khaligufzel:main Mar 5, 2024
@snipercup snipercup deleted the chunk-loading-unloading branch March 5, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant