Ayo, so I am making a mingame-style game and one of the minigames has a massive speeding wall that the players have to avoid by going into little nooks in the wall (like the classic game)
I use tweenservice service side to move the wall, which works fine on studio, but – in retrospect-- obviously doesn’t look so good when you actually play the game. It’s super choppy
What are the alternatives? I was thinking of just having each client manage their own wall so it can tween smoothly. I’m just concerned that clients will get out of synch and some other weird quirks.
Thoughts? Is there a better way to do this?
Thanks!
If you want it to look smooth you should definitely make it run local. To make sure movement is in sync across other players, you should poll each player’s ping. You can do this by regularly sending signals from the server to each player and waiting for a response. Make sure you time how long it takes for each player with tick().
Let’s say it took 0.3 seconds for player A to return a response, that means it would take around half that time for the server to reach the client, so 0.15 seconds. So if you want to make the wall move at the same time on all clients, send a signal ahead of time (like 1 second) to each client and include their ping - e.g. 0.15 seconds for player A. Player A will then know that in 1 second, minus 0.15 seconds (so 0.85 seconds) (s)he should locally start tweening the wall.
I actually may have found a cleaner method (imo, we’ll see how it goes). I can just send over a random number seed to all of the clients, have them all generate the same “crush” time table, and whenever the ‘global’ intvalue object value changes and it’s value cooresponds to the table, the wall will SMASH!