-
Notifications
You must be signed in to change notification settings - Fork 11
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
snipercup
merged 255 commits into
Khaligufzel:main
from
snipercup:chunk-loading-unloading
Mar 5, 2024
Merged
Chunk loading unloading #71
snipercup
merged 255 commits into
Khaligufzel:main
from
snipercup:chunk-loading-unloading
Mar 5, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.