I’ve come up with a prototype to make a platform that, while resizing, will apply physical effects to objects around it. Before the platform is resized, a player is set as its network owner. Parts that are touching it also become owned by the player. Next, a prismatic constraint with its ActuatorType
set to servo moves the platform while a local script adjusts its size to give the illusion of the platform growing or shrinking on 1 axis. While the platform is resizing, an unreliable remote event is fired repetitively to update the size and position on the server. Once the platform has reached its target size, network ownership reverts back to automatic assignment. The result is that the player and objects can get transported smoothly while the server stays fairly well updated.
I’ve come across this setup because when I tried to make the server do all the work, the effects of the prismatic constraint aren’t replicated properly to any player. I tried to get around this by using a remote event to directly adjust the platform’s position and size on the client side, but that resulted in everything on top lagging behind. The constraint would also not generate enough force to push players aside, even when I set the constraint’s ServoMaxForce
to inf. On top of all that, when the server assigns ownership to the player, the prismatic constraint would cease to push the platform.
With all of that said, I have 1 main problem to deal with: performance. The platform runs much slower while calling that unreliable remote event. However, I used an unreliable remote event specifically because the documentation totes it as “best used for ephemeral events”. Is there an even faster option to send data between server and client? Is there a different way to design this system so that I don’t run into this issue at all?
Another minor issue I have is the effects on other players. Currently, this system also sets other players to become part of a single player’s network ownership. This led to inputs being extremely delayed. It also means physics doesn’t apply if a player hops onto the platform while it is scaling. While less than ideal, I also don’t know how I would get the platforms to move other players as well without doing so. I’d like to learn how this kind of stuff is handled in multiplayer games, so any suggestions to mitigate this are appreciated.
And of course, there’s the design of the entire system itself. I have doubts that this is the most efficient way to work around the limitations of replication and I would like to figure out if there are other factors I should’ve taken into consideration while designing this.
In conclusion, I have 3 questions.
- Is there an option faster than unreliable remote events for sending data across the server-client border?
- How do I make physics under one player’s network ownership replicate well to another player?
- Are there better classes to design this system around? Heck, is it sound at all?