Hey there, I've been looking into adding in some sort of terrain mod to Blockland.
Goal:I want to be able to create
large areas of terrain, with good collision, and no lag. I want it to work on somewhat slower machines.
BricksUsing bricks would be ideal. It did not occur to me to try them at first, bust when I did... They don't lag while just on the screen. But while flying over a piece of unloaded terrain, the client will receive a huge lag spike for each new section of terrain they encounter. This is unacceptable.
This is an example piece of terrain, 4096x4096 studs of ModTer 64x bricks.
This terrain should not lag to load. But It does. I believe it is has something to do with the bricks being next to each other. I have experienced this sort of lag before while trying to load a 3D maze I generated via script. When the maze units are loaded while next to each other, there is a large lag spike. But when I modify the script to place the maze units just one unit away from each other, they load almost instantly with no lag.
For bricks... I believe it would be possible to still use them. If I create a selection of modTer bricks that are 62x62x62, with a 62x62x62 collision box, but still retain the visual aspect of a 64x64x64 modTer cube. The bricks should ghost without lag. However, there would be... some work to make the 62x bricks act like 64x bricks.
It would require the use of a floating bricks mod to plant the bricks the proper distance apart. It would require a StaticShape collision object to handle the gaps between bricks. And then it would require a custom ghosting mod to prevent clients with lower end PCs from trying to track the large number of staticShapes in the scene.
Even after all of that, there would be some trouble using a separate staticShape as a collision object. Events such as getting hit with a wrench or a PrintGun would have to be passed on to the brick. This can be done for default items, but for custom Add-Ons, I have no guarantees.
Summary: lots of work, lots of dependency, requires DLL(for ghosting), possibly glitchy, and possible conflicts with other add-ons. However, perfect collision, low lag, scale-able, and modifiable on the fly by anyone ingame.
Static-ShapesStaticShapes lag when displayed in large numbers. However, a single, large, and really complicated visual static-shape, and a thousand or so TSStatic shapes for collision, does not seem to lag the client at all.
16k collision shapes, and 4 visual shapes.... this DOES lag the client.
With the SelectiveGhosting DLL and some sort of custom ghosting mod, it is possible to load and unload sections of terrain at a time, on the fly, without adversely affecting the client.
It's
possible to use static-Shapes, but. This sort of terrain would not be easy to modify on the fly. If the visual aspects of the terrain were modifiable in chunks, like bricks... sure. But for the performance I'm looking for I believe it is prudent to abandon the concept of modifying
StaticShape terrain in an impulsive and arbitrary way in the middle of a game.
Summary: lots of work, Requires DLL(for ghosting). However, perfect collision, low lag, scaleable.
I am still... dubious over the use of bricks. I have not done extended testing with that "seperate by one" thing. It was a behaviour noticed in passing. However, if possible, bricks would be the way to go, simply because they could be modified midgame. If a host wants to add a cave to a hill- he can. Whereas with pure StaticShapes, this would be impossible.
The only thing I'm bummed about is that both of these systems would require a custom DLL to run. These custom DLLs require a special EXE that does not update with the base game. I'm still on r1986, but Blockland itself has updated to r1988.
If clearScopetoClient() worked, I would not need a DLL at all.