Author Topic: Moving Platform  (Read 1845 times)

I made a moving platform you can ride.
« Last Edit: June 18, 2019, 05:36:17 PM by Tendon »

you posted this in modification help, not addons

(ignoring malleo) how does this work?

its a static shape that updates it and your transforms probably every 33ms. on a multiplayer server you'd see considerable stuttering of both the static shape and players that are on it

It moves a Collision Staticshape, a Detail Staticshape, and a Trigger Zone every 34 ms.  It then loops through all objects inside of the trigger zone.  If the object is above the platform, it teleports and rotates that object with the static shapes.  Because the object's movement is actually independent of the platform, it has to do some math to figure out how the player's movement is affected by the rotation of the platform.

Even in single player there's a noticeable stutter.

i wonder if using zones and applied force would be smoother than updating transforms manually

Stream found a dependancy error.  Ill fix that tomorrow.

Im not really intending to expand on this until ive got something i want to make using the tech.  But the next step would be to attach a platform like this to a vehicle.

Physics zones are not supposed to move.  You may get jitter from client prediction if you use applied force.

We had moving platforms like this implemented with vehicles, selective ghost updates, and replicating the player movement surface walking function to detect whoever was on the vehicle. Through selective ghost updates we could make players warp while you observed the vehicle and force a teleleport when riding. This was needed because when riding, the vehicle object needed to appear rigidly updated as your player object does not get the nice interpolation other players get. I'm intrigued by using physical zones as a way around this but that sounds like a headache for nonlinear motion and could fall victim to whatever prediction would like to do instead, lest a gap in server updates occurs or similar.

To make vehicles float and interpolate smoothly, only a few flags need to be set to trick the client into doing so. The rest is collision testing, math, and ghosting the right data to the right people. With this we had some cool boat mechanics for a TDM although it was laggy as all hell as expected.

Found missing dependency for function "eulerToAxis" in Weapon_Package_Complex/bullets.cs
OP is updated.

Is this was is/was being used on Heed's pirate TDM?
yea and it was smoothish with some hiccups here and there

Is this was is/was being used on Heed's pirate TDM?

Yes. Walking on vehicles is a very complicated hack if you want acceptable combat while standing on them while also not compromising interpolation for other cases.

For anyone who needs prediction disabled on vehicles, there's two solutions:

The first (and easier) trick is to change the integration for a vehicle's datablock to 0, call ::transmitDatablocks(1) for any client you want seeing it (preferably before a client can interact with it, like when they're done loading datablocks or about to join the game), and set it back. The client won't do integration on it's side then, and if you get control of the vehicle force update functions in the engine on the server, you can disable gravity and do whatever you want with them, i.e. create floating platforms or simple rigid bodies.

The second trick is specific to vehicles that 1. don't have tires and 2. won't use buoyant forces. You need to tell the engine the vehicle is at rest and zero out its linear and angular momentum, and the client won't do integration because it is tricked into thinking it has no forces applied to it. This works great for floating things and also doesn't need to mess with datablocks like the previous solution. But of course the setup is a little more difficult.