Chunk specific data to networked clients

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
I have been working on extracting the world/chunk generation code out to module space and there is a need to be able to replicate biome data over to networked clients (as this data can affect temperature and humidity when rendering).

With my limited understanding of the core code (I have only been at this for a week) I can think of two ways of doing this:
- create a chunk level data layer that lives side by side to the block level data layer (not a great option)
- create an entity on each chunk to represent this information so that it can be transmit to remote clients (a better option, but would need some quirky set up with being a LocationComponent at a specific block position)

Am I on the right track? Is there a better way to do this that I have not seen yet?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
In theory, you shouldn't need to replicate biome data. It should be possible to generate it from the world seed client-side. All world generation should ultimately be deterministic based on the world seed.

If the biomes are subject to change, then we probably should do an entity per chunk - I've been thinking we'ld need one anyway. You might not need to do a location component on the chunk entity - we could have a chunk component with a chunk position instead, and set that up to be stored/restored (this would have to be done in the engine).
 

synopia

Member
Contributor
Architecture
GUI
I think a chunk entity would be nice for other things, too. For example the pathfinder could use it, to store current state of the navigation graph, since the navgraph is build on chunks. Maybe all jobs located in a chunk may be collected and stored in the chunk entity, for faster access. I can even think about and additional entityManager.getEntitiesWithComponents(...) method, which only returns stuff from a specific chunk.
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
I agree, just using the seed would be better for randomly generated worlds. I suppose if you used predetermined generation (like the heightmap feature) it would fall a part though. Also, something to consider is the cost of creating the world generator at the client side. There are a couple threads on the forum about some crazy stuff like tectonic plate simulation and polygonal map generation that could make it less awesome to have spin up on the client upon entering the world (I dont actually know how much processing it takes for these algorithms).

It does not look like the seed is being sent over to remote clients. Could you confirm or deny this claim?
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
I suppose if you used predetermined generation (like the heightmap feature) it would fall a part though. Also, something to consider is the cost of creating the world generator at the client side. There are a couple threads on the forum about some crazy stuff like tectonic plate simulation and polygonal map generation that could make it less awesome to have spin up on the client upon entering the world (I dont actually know how much processing it takes for these algorithms).
True.

It does not look like the seed is being sent over to remote clients. Could you confirm or deny this claim?
That is correct. Oversight on my part.

And I agree, there is almost certainly a lot of use for chunk entities in general.
 

Josharias

Conjurer of Grimoires
Contributor
World
SpecOps
Thank you for the confirmation Immortius. I will see if I can figure out how to send the seed out along with the other world info.
 

Immortius

Lead Software Architect
Contributor
Architecture
GUI
Perhaps we should move world info like this into the world entity.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
On a related note those other world threads probably also point out the need for a greater framework for world gen in general :)

Heightmap / climate simulation etc might have their own "maps" that can be manipulated over time, then applied on top of the base value randomized from the seed. Would probably go well with per-chunk stuff. Still deterministic just with some fanciness on top baked into the general world data.

And that's a lot of work :D

Just getting started with chunks would probably be good progress ... :)

I recall chunk data having come up in the past also for keeping track of bodies of water.
 
Top