Chunk-based generation DOTS question
Hello, i want to create procedurally generated world. I have ran into little problem so i am here to ask.
I want to make generation, where chunks will be generated around each player up to certain distance. These chunks are actually just code and not actuall data holders or objects. When i will activate chunk, it will check if it was already generated and saved, if yes, load the saved entities, if not, generate new ones. Currently i want to save the entities using native multi hash map.
Do you think this way of generation is plausible? If no, why? I am open to new ideas.
How can i make that i can generate the chunks around the players, i have thought of using arrays? i dont know right now so id like some ideas. I want to acivate chunks only around players, but not ones that are already active. How can i do these and how can i store which ones are already active?
How to unload chunks (save the entities and then destroy them)? I have thought of having every entity do this indepedently, but i can see many problems in that so please tell me any better way.
After generating a new world (chunk) use SerializeUtilityHybrid for it's runtime loading/unloading.
Thanks for the tip, just a little question, it does work with entities right? I am probably just stupid and blind, but ill rather ask.
Yes, this class is part of com.unity.entities
package. It allows you to serialize entities into byte[]
object which can be saved to disk. It can serialize managed asset references too (references to mesh asset, material), but won't serialize procgen meshes (these need to be serialized separately or not at all).
Your answer
Follow this Question
Related Questions
What is the best way for loading ,editing and saving Levels in unity ? 1 Answer
Saving and loading an int variable on Android 1 Answer
Spawning loot only the first time a level is loaded 1 Answer
How do I make a level code system? 3 Answers
Do we have to open SavedGame every time we do a CommitUpdate when using cloud PlayGames services? 1 Answer