4.26 new water system and replication?

Been fiddling with new water stuff recently but didn’t really found anything hinting that this system intends to support replication. Does it? Will it in future? If not then at least the wave generation should be synced and we could rep the simulated actor location ‘manually’ I guess?

ps. why there’s still no sub forum for multiplayer related stuff?

You can’t really expect to sync physics over the network with 100% accuracy (probably true for any movement).
That said, the system is based on a pre-built function.
As long as you sync game time the two clients will solve the math the same way. It should also already be frame independent.

As far as water interaction, splashes etc. That’s done at a local level with vector fields and particles in fortnite. You should aim to do it the same way.

For what I’ve been playing with (two clumsy ships) should be good enough to simulate buoyancy on server and rep it to clients, problem is that ship will hang in air if ocean waves go out of sync

1 Like

The only way that the waves would go out of sync is it you don’t sync whatever time variable is in use to run the waves along with the buoyancy… to do one, means you automatically can do the other.

Time is relative and all, but you do have just 1 ocean that uses 1 time to and x/y loc to return buoyancy right?

@laggyluk did you find a solution for this?

Do you know how I can adjust the game time?

How do you mean?
You can slow down time with time dilation, or do you mean how you sync on the network?

nope, after some experiments I decided to move on and hope that things will improve with time :stuck_out_tongue:

Maybe read this

And make sure that you are using Get Server World Time Seconds | Unreal Engine Documentation
Instead of the client local time.

Modify the material and pipe in the correct time variable instead of using the time node.

Change the CPP to use the same time to calculate and pluck wave height.

Then you have very little chance for things to go completely out of sync.

Let me also add, that Lag or time difference between clients won’t matter here.

So long as the wave material and the wave physics use the same unit of measure - then objects affected by buoyancy and the wave will always look to be in sync for everyone.
They can happen later than they do on server because of lag, but they will still be in sync.

So if the boat is a network replicating pawn, you need to account for that… set it’s client Z based on the reading of the physics, not on the network data.

I tried that, but gametime doesn’t affect the waves

For the system you add with the plugin that is what this topic is talking about, you would have to create your own class in cpp and override the default behavior.

Extend gastner wave wave generator simple.

And then change the class in the water body settings.

Possibly, the engine lest you right click and create a child of that via BP too.

You have to play around with it.

Changing the wave generating algorithm or the wave source might be all that’s needed.
At least check to see if there is any existing multi-player options for it.

If not, override the class and set the time yourself. Also make sure the material uses the same value.
You may need to modify it to get it to.

Thank you! I’ll give that a go tomorrow. In the mean time I have also found the cvar r.Water.OverrideWavesTime I can adjust. This manually sets the time of the wave - it however only accepts integers and not floats.

Other workaround is to pause the waves with r.Water.FreezeWaves 1 and unfreeze once all clients are in.

Yes but if the clock is not synchronized they’ll eventually drift off again.

Check the link I gave. It explains and brings examples of how bad the network clock actually is.

The only reason to use it here is that at least it will get everyone on the same variable eventually.
And that individual clients won’t notice hiccups with it.

How can I use the network code like system for an Ocean that’s build in niagara and Materials? Can I just use this blueprint node “get world time” - or whatever it was called- and turn it into a user parameter?

Again, normally you don’t.
Each client has its one loosely syncd simuation.

This can be pretty spot on if you only have the clients respect the server given game time (or any authoritative client in case of P2P), so you rarely get artifacts unless the commections drop for a client.

You need to look into what time that returns.
My guess is that its completely client dependent.
Each client has its own non-replicated instance of game… and not every game necessarily starts at the same time.

Again, this topic / considerations were all specifically for multiplayer server to client setups.
If you have a single player game you can use the local time without any issue.

It is client dependent. “World Time” starts when the level is loaded on the client.

An accurate Network Clock is needed…as noted in previous post.

An alternative and better approach in my opinion is Unreal Engine - A non-destructive and better synced network clock - Devtricks

1 Like