#Voxel Array Too Big

1 messages · Page 1 of 1 (latest)

fast cradle
#

I'm trying to make a voxel terrain generator in DOTS. I divided my world into a grid of 16x16x16 chunks. Each chunk is represented by an entity with the "Chunk" component.
For each chunk, I want an array that stores the data of the 4096 voxels in the chunk (depth value, what kind of block is stored there, etc...). I thought it'd be a good idea to use buffers so I made the following:

    [InternalBufferCapacity(16 * 16 * 16)]
    public struct Voxel : IBufferElementData
    {
        public float depth;
    }

But looks like I can't store this much data on one entity: ArgumentException: System.InvalidOperationException: Entity archetype component data is too large

Does anyone know a better solution?

somber reef
#

set capacity to 0

#

and it'll be stored outside of chunk

#

chunks are limited to 16kb and a bunch of it used for some meta data

fast cradle
#

thanks!

maiden hull
#

Is it really relevant to have chunks represented by entities?
I feel like an array of chunks where you can easily access a chunk at a certain position and effeciently get neihboring chunks might be more adequate?

fast cradle
#

Good point. I mainly want them to be entities so I can put tags on them (like "ChunkPendingGeneration"). I'll do some expirements later and see what works best

#

Oh and I will also need a mesh component for every chunk (kind of relates to another thread I just opened about the topic)