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

Handle Tiled world loading #55

Open
adrien-bon opened this issue Dec 4, 2024 · 1 comment · Fixed by #63
Open

Handle Tiled world loading #55

adrien-bon opened this issue Dec 4, 2024 · 1 comment · Fixed by #63
Labels
enhancement New feature or request

Comments

@adrien-bon
Copy link
Owner

adrien-bon commented Dec 4, 2024

When loading large maps (let's say 256x256 tiles), the number of entities to handle becomes huge, which cause poor performances.

A solution to this would be to chunk the loading of such a large map and only spawn tiles entities for the subset that we actually use. Fortunatelly, Tiled have a feature called "worlds" which is basically that: a huge map that have been split in smaller ones.

From an implementation point of view, the .world file would be loaded by a dedicated AssetLoader. The Asset would store the path to the maps (.tmx file) as well as their positionning information (which is available in the .world file).

Upon spawning a world, we would then load the maps it contains but only spawn maps that are currently "in use". By moving the camera, we would change which maps are used or not, and spawn / despawn maps accordingly.

Dev branch for this feature = https://github.com/adrien-bon/bevy_ecs_tiled/tree/feat/world

(original idea from @JtotheThree)

@adrien-bon adrien-bon added the enhancement New feature or request label Dec 4, 2024
@adrien-bon
Copy link
Owner Author

Discussion for adding .world file parsing directly in rs-tiled crate started here: mapeditor/rs-tiled#319

@adrien-bon adrien-bon linked a pull request Dec 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant