Open Slippery-Chickenz opened 11 months ago
This is currently not possible. A viewer (actually equivalent of an "invoker" in Unreal terminology, which might be renamed in the future) can only either load voxels (which implies generating), or load voxels AND meshes (which depend on voxels). The case you refer to is not implemented and would come with additional complexity. The engine has no concept of "chunk that isn't edited but also must not generate and must be considered empty for now but will generate eventually depending on specific viewers". Even if there was, it wouldn't work as you expect, you'd end up seeing ground without borders (seeing through the sides due to void) as the module always expects to find loaded chunks around every mesh it renders. Maybe it sounds simple for a dedicated RTS terrain engine, but that's not how this module works at the moment. I have no plans to add this at the moment.
Not sure why it is so important to not generate things here... generators act like a "data compressor" by not having to have everything stored somewhere up-front because voxel worlds are heavy. They are not meant to act like fog of war. You could simply limit where the player can see in the first place, rather than coercing chunks into not existing?
I ended up just covering the ground with Fog to not allow the player to see the generated terrain.
I wanted to eliminate the need for the user's camera to generate terrain because when testing I found that the user moving the camera around a lot caused the terrain to load dreadfully slow for even just 4 extra VoxelViewers attached to units that needed the collision meshes. I am not sure if this is just a limitation of your VoxelTerrain or if my generator/other code is slowing it down somewhere.
If you have lots of viewers moving fast with large view distances and (in particular) all have mesh collisions required (which is a big bottleneck at the moment since there doesnt seem to be a guarantee for them to be creatable safely in threads), then it will indeed be quite taxing in CPU. It may also depend on the depth of the terrain and the generator you're using. If you're using this module for an RTS with many different viewpoints far away from each other but simultaneously loaded, you might be hitting a limit in what this module was built for. Putting this in a bad case scenario, each viewer you add is like having an extra Minecraft client open on your computer, and each "peek" moving fast into a specific location is like teleporting your point of view with a nether portal, so it's going to be quite resource intensive, unless maybe world depth, view distances and other settings are reduced. Maybe you could also consider decoupling camera and viewer position, so you can look around freely without causing loading?
I am trying to make a world where the player sends units out to explore. I was hoping to cover the world in fog to start and then have it generate as units move. I have given each unit a VoxelViewer to allow the terrain to generate around them and I gave one to the player camera to allow the user to see the world.
However, I want the player to be able to see the generated world around them but not generate more terrain. Is it possible to make it so a VoxelViewer can only see the already generated terrain but not generate more around it?