Recently I started getting reports that the car-elevators in Car Crushers 2 are no longer working properly. These are large physics-controlled platforms that carry vehicles between floors in the building. They move using a prismatic constraint and are forced to 100% network ownership on the server (SetNetworkOwner(nil))
Currently these elevators will hitch and struggle a lot more than they used to when there’s a vehicle on the platform, taking nearly 5-10x as long to reach the destination while visually “jumping” as constantly accelerates and stops.
You can try this in the repro file I attached. If you enter the elevator with your character it will quickly and smoothly take you to the top floor. But if you click the green button to teleport the car onto it, you’ll see what I mean.
Expected behavior
The travel-time should be nearly identical no matter if there’s a vehicle on the platform or not. That’s how the elevator used to behave in this scenario. (And we haven’t made any updates that should cause this change)
I looked into your repro. The slow platform movement is a result of networking. If you turn on network ownership visibility (Studio Settings → Are Owners Shown), you’ll see that the platform is owned by the server (white) and the car is owned by the player (green).
When the physics engine (on the server) resolves the collision of the platform with the car, it only “sees” a car moving at some velocity (i.e. whatever velocity the car is moving at when it was last updated on the server). Since our physics solver is iterative, it needs to update both the velocity of the car and the platform to get the correct behavior. But, as the car is owned by the player, the server only updates the platform’s velocity, and as a result, the motion is jittery.
To resolve this, you should set the network ownership of the platform and the car to be the same (both server or both client). This will produce smooth motion as the physics solver will simulate both objects together.
What a great demo, thanks for sharing! This perfectly illustrates the issues that can arise when an object on a platform has a different owner than the platform’s owner.
Hi, I’m aware of the network differences but this is entirely on purpose right now. It has always been this way in my use case, and it used to work very smoothly up until roughly a week ago.
If I only put my character on the platform of that repro, the elevator will move quickly and smoothly just as I would expect it to (despite the network owners being different). It’s only when I place the car here that I start seeing this issue.
There would be massive implications on all my physics mechanisms if I had to allow the clients to control their network ownership. Because currently I rely on the fact that server-owned physics objects can’t be stopped by other player-controlled items (Like vehicles). This allows me to have a large wrecking ball that never stops, even if vehicles get pushed into walls and similar (Just an example)
This elevator is also expected to carry multiple vehicles from different owners at once. I don’t see how I’d be able to make that work any more if the elevator is owned by one of the clients
Do you have any videos of the correct behavior? The only video I could find of the elevator is this, which only shows the elevator going down, which will give smooth behavior because the collisions provide a force in the direction of platform motion.
As 0Tenth pointed out below, we have special logic for Humanoids that ensure this behavior. However, there is no similar logic for general mechanisms.
One solution: when someone presses the button to make the elevator go up, set the network ownership of all vehicles inside of the elevator to the server. When the elevator reaches the second floor, set the network ownership of the vehicles back to the client.
This is with the same same speed settings as the repro, with the elevator being server-controlled and the car being physics controlled.
Unfortunately I can’t change the network ownership of vehicles in Car Crushers 2. A lot of the vehicle properties vary between the client/server with my setup, and it would also break the ability for players to keep driving while the elevator is moving.
In that clip, the player left his vehicle to press the button, so there’s a good chance that the vehicle’s ownership changed to the server while the elevator was going up. Do you have a clip of someone riding the elevator up while still in their car?
I know for sure that the network ownership has always been the same as that repro. I tested this studio when implementing the elevator only a couple weeks ago (was using “Are Owners Shown” to ensure the elevator remained server-sided). It looked just like the repro file with the elevator platform using a white outline, and the car using a colored one.
Thanks, I do see quite a difference in behavior between the youtube video and the latest studio, assuming all other variables are identical. I’m working with my team to determine if anything changed recently.
Unfortunately not, and we don’t have any changes that coincide with that timeframe. I built a version of studio from October, and I saw the same slowness, so it doesn’t seem that this was working correctly even before January. Did you publish any changes to your experience around then?