BLaZeKiLL / VloxyEngine

Performance oriented voxel engine for unity.
MIT License
99 stars 9 forks source link

Allow user to edit chunk draw distance at runtime #106

Open AldeRoberge opened 1 year ago

AldeRoberge commented 1 year ago

image

Seems like the scheduler never reclaims (unloads) faraway chunks, resulting in a loss of performance.

AldeRoberge commented 1 year ago

This happens when changing the Chunk Draw Distance at runtime (i.e. going from 4 then to 1)

BLaZeKiLL commented 1 year ago
_ChunkPoolSize = (settings.Chunk.DrawDistance + 2).CubedSize();

I changed the pool size to draw_distance + 2, So there will be more chunks active even a few far ones. This initialization happens in the constructor of the ChunkPool, even for other settings right now they can't be changed at runtime.

We can have a single source of settings and achieve runtime changes

AldeRoberge commented 1 year ago

We can have a single source of settings and achieve runtime changes

That's interesting. I think we should allow players to change their chunk render distance at runtime!