How would I cope up with ping issues with my custom water and boats?

Hey there,

Recently im splashing around with custom water (might have seen me around the forums :eyes:)

Everything works great, but the problem comes when its multiplayer.

Ok, so I’ll explain my process below.

Each player has a localscript named “Ocean” in their backpack. This script makes the ocean wave according to the servers time (using workspace:GetServerTimeNow()) to make sure that the waves are same for all the players. I could have done it on the server but it takes time to replicate and appears jittery. Now, the waves work perfectly fine for all players even with high ping (I tested with 2 accounts both having 200ish ping, and the waves were 99% synchronized)

Now - boats.

First I thought about giving the load of the boats to the server, but then the player wouldn’t see his boat float correctly because the bodyposition will take time to replicate from the server.

So instead, I make each player simulate his own boat. 1 boat has 5 points where the wave height is sampled, which is very low and the impact is not even noticeable.

Now, the boat is floating correctly for the player.

But only the players boat. The problem is that each player only sees his or her boat floating correctly, boats of the other players are completely desynced once again because it takes time to replicate from player2 → server → me

As you can see in the below video, my boat is floating nicely on the waves.

But when I get my alt, his boat isnt correctly on the waves.

The impact isnt very much here, but when I tested with my friend (he was in Netherlands) the impact was terrible.

You can see in the video that my alts boat goes up when its not supposed to and goes down late, which makes it look sinking.

And on the other hand, my alts boat is floating correctly for him while my main’s boat isnt.

How would I overcome this impact? I have seen games such as Fishing Simulator use custom water + waves and boats too, and they were perfectly in sync.

Thanks for help.

1 Like

The only ways I could see fixing this would to either position every boat in the Ocean script in their backpack (which you should probably move to PlayerScripts) which would make everybody see their own boat, which might still create disconnect.

Or you could get every player to render the exact same waves, I’m not sure how your system works but you could possibly use a remoteevent with FireAllClients() and some sort of seed gets given to every client to render the waves in, but its up to your system.

The problem is bodypositions replicate from client to server, so if i do that every player will be setting every players boats every frame which will confuse the engine and it has a possibility to break. I havent tried this though, but ill try this today evening if i have time.

It already renders the exact same waves as i mentioned in my post. the problem is that the boats take time to replicate. Waves are done locally and dont replicate, whereas boats are done locally but replicate. if there is a way to stop replication (other then networking it to the server, doing that breaks everything), this will work. Lag shouldnt be any issues cuz its 50 more points considering i have 10 boats, whereas the ocean itself is 1k points.

Then maybe you could try using something else? I dont think theres a way to prevent it from replicating, and I’m not sure what any alternatives to bodypositions are, but its my only other idea.

I might look into AlignPositions as they are an alternative to body positions. For bodygyros we have AlignOrientation. Ive tried both of these before but they get very messy and tedious to work with, which is why i wanted to keep them as the last resort.

I think the client setting it wouldn’t do that, as it will just overwrite the servers replication.

Ok I just tried that, but there is no change (its the same as having each player simulate his own boat)

1 Like

The problem cna be water isnt server-side or the boat script effect with the sea is in the client!, if its the problem, rewrite it in a server-side script, or do a client script getting all boats, no only ur boat, u understand?

You clearly have no idea about what I said in the past replies. Read them before replying.

Doing the boats on the server will be even worse as it takes time to replicate from server to client.

And when I did all the boats on the client, there is no effect, as I said in the reply above you.