Author Topic: Better Brick Collision Project [KotaiCol]  (Read 1950 times)

This project is dedicated to creating better collision for all default bricks.

I want to make the collision better so that I can make racing maps out of normal bricks and I don't have to worry as much about players getting stuck or driving through walls.

To do this, I am putting a static shape "core" inside of each brick just after it is planted.
The static shapes are scaled down to half of their original size, in my experience this gives the shape better collision.

The cores must be smaller than their bricks so that a player can hit the brick with a wrench or other tool without hitting the core.

I chose to inset the core by 0.1 units.
Insetting the core by 0.005 units will lead to most vehicles violently bouncing off of the brick.

There are some costs to using static shapes for bricks collision.  Most of these are related to lag.
   At ~5000 shapes my computer drops just below 60 fps.
   At ~11000 my computer sits at around 17 fps.

I have a method of reducing this lag.
If a client does not know that a static shape is in the scene, the client does not have to perform any calculations for it.
These cores are meant to halt high speed collisions.  During normal play, they do not need to be sent to the client.

I have two ways to stop the server from sending these cores to the client.
Option 1 is a glitch.  If I set the engine to always send the core to the client, then remove the core from the "list" of things to send to new clients, new clients will not receive the core.
It's a glitch, it's hacky, and it requires that clients rejoin the server every time a new map is loaded, or over 5000 new bricks are planted.
Option 2 is a DLL.  A hacked server must load a DLL which allows me to set the core to not be sent to any clients.  Specifically, the SelectiveGhosting DLL by Zeblote.

I am currently taking advantage of option 1 for my testing.
As for option 2, I do not believe the BlocklandLoader hack by port has been updated to the latest version of Blockland yet.
Ideally, the elements of SelectiveGhosting would be present in Blockland by default.  I made a post to this effect in Suggestions and Requests, but it hasn't received much attention and I have no way of knowing if Badspot even reads that board anymore. :x

Currently I have finished the collision for Bricks, Plates, and Rounds:

I intend to finish the rest of the default bricks(Special, Ramps, and Baseplates) before tackling the default brick Add-Ons:

As far as testing goes:
   The Jeep
      Seems to have an easier time rolling over these bricks.
      Turning towards a brick while driving at speed does not allow the jeep to go through the brick anymore.
      High speed collisions will now cause the jeep to bounce off or stop.
      It is still possible to get stuck in a brick.
      It is still possible to trigger a violent blowback.
   The Magic Carpet
      You can still get stuck.
      You can still get bounced back.
      But you can't get through.

speedkart 2: one less thing to worry about colliding into

instead of using staticshapes, try using vehicleblocker objects. they should have collision defined similarly to dts statichshapes. i dont know much more other than they exist and nobody uses them, but torque supports them and they have their own typemask so hopefully its more reliable than staticshape spam
« Last Edit: August 13, 2019, 10:40:25 PM by Conan »

I just tried vehicleblockers.  They are no better than brick collision.  Scaling them down doesn't have the same effect of improving the collision performance.

I have used vehicle blockers before, to keep a truck from rolling while it was in park.  Rotation does work on them, so they are useful to keep a vehicle still when it is on a hill.

They do not cause lag like static shapes.  Very similar to brick collision.
If you want to crash the game, put 22000 of them in one place and drop a vehicle on it. xP

so currently it makes a static shape for every brick?
potentially spray the bricks you want with undulo or something and only put static shapes there?

Realistically it wouldn't be too hard for me to modify Brick Tessellation to also create 2 collision boxes for each brick.

Realistically it wouldn't be too hard for me to modify Brick Tessellation to also create 2 collision boxes for each brick.
Don't do it unless your second collision box is better than the original.  It's not two collision shapes that make this method work, it's that the second collision shape is literally impenetrable.

I did the collision for these green bricks:

The pine tree was a pain in the ass because of a glitch with blender.  Origin to Geometry was showing itself as setting the center to Bounds Center, when in reality it was stuck on Median Center for some reason.  Kept ending up with the cone part of the tree misaligned. >:(

Multiple shapes in one DTS doesn't give good collision with vehicles, so I need to write in multi-core support for that castle wall brick on the left.

or just dumb it down to a 1x3x4 brick..... almost literally no vehicle will rely on that tiny of a window unless you're doing stuff with 0.1 scale vehicles, and in that scenario theres a lot of forgety things going on regardless of how good your collision is (tires for example)

Added multi-shape support & finished collision for the castle wall.
« Last Edit: August 15, 2019, 03:47:22 PM by Tendon »

if done could we get a version with 0.005 unit inset just for the Blockland Vehicle Physics™

I won't make a version like that, but I will post the .blend when I'm done.

x3 Ramps & Low Crests are done.

I figured out a way to use the static shapes for collision without ghosting them at all.  This means lag from rendered objects wont be an issue.

It may also mean that I dont need clients to download the extra files that they will never render. So no extra download time or extra datablocks. idk i havent tested that part yet.

I'm halfway through the ramps.

Phase 1 of KotaiCol is complete.  I have uploaded it to Blockland Glass.  I will make a topic on the Add-Ons board when it is approved.

If you would like to download a version with the .blend and production notes, you can find it here.

I will be busy irl for the next few weeks.

You had to make a new dts for every single brick, even if it's square? You couldn't just scale the static shape to the size of the brick?