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

Improving data storage in TileMap #720

Merged
merged 5 commits into from
Jan 14, 2025
Merged

Conversation

b-guild
Copy link
Contributor

@b-guild b-guild commented Jan 13, 2025

I have replaced the hash map of tile map with a resource that stores tiles in 16x16 chunks. This allows the renderer to iterate only the cells of the visible chunks instead of iterating through every tile.

The chunks are stored in a hash map with keys based on the position of the chunk's origin, and the tiles within the chunk are stored in a 16x16 array. Chunk has a custom Visit implementation that stores the handles in a BinaryBlob for space efficiency. The TileMapData resource has a custom Visit implementation that removes empty chunks before writing the data to the visitor.

A TileDefinitionHandle has been designated to represent an empty cell. This should have other uses beyond tile map storage.

@b-guild b-guild marked this pull request as ready for review January 14, 2025 02:13
@mrDIMAS mrDIMAS merged commit 05178ed into FyroxEngine:master Jan 14, 2025
11 checks passed
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.

2 participants