6
\$\begingroup\$

I've been performing a little bit of research in my spare time on ways to increase the interactivity of environments in a networked game or simulation.

One of my areas of research is fluid-dynamics and whether it would be possible to synchronize it over the network. I believe the short answer to that is - Yes of course you can. But there will obviously be trade-offs as there are with any network synchronization problem.

I was recently playing Battlefield 4 and a number of their maps have playable ocean areas with fully functional waves large enough to obscure entire boats during gameplay. It seems to work quite well as well.

My assumption here is that the ocean simulation is completely offline and each client performs synchronization with the server during initialization. This would allow all clients to run the exact same ocean simulation that appears to be dynamic but is in fact the same offline simulation every time.

Interaction with the ocean simulation appears to be only superficial with local splash/wave depression. I assume that is entirely local to the client and not synchronized.

My question here is:

Would the above be an appropriate way to synchronize fluid simulation over a networked game? If not, what would you suggest?

\$\endgroup\$
2
  • \$\begingroup\$ I would also guess that it works that way, if they synchronize it at all. All it takes is a common seed for the number generator controlling wave motions. Many games don't bother synchronizing such things, however. Players won't notice/care if it's not part of the gameplay and don't sit next to each other. \$\endgroup\$
    – bogglez
    Commented Jun 20, 2014 at 4:10
  • 3
    \$\begingroup\$ Well the reason that I bring up BF4 is that it is important that the simulations are completely synchronous as player driven boats will be performing physics on each other (Shooting, collision) amongst the waves. \$\endgroup\$
    – S.Richmond
    Commented Jun 20, 2014 at 4:14

2 Answers 2

3
\$\begingroup\$

Have you considered generating the waves from a 3d pearl noise generator? That way you can find the height of each wave using just a simple function call with time and exact position, as long as you synch the time across all machines the result should be synchronized waves. Now you only need to send updates whenever one of the waves interacts with something else (well if you do it right you don't even have to do that only when a player interacts with the waves).

So basically use a 3d noise map to generate your waves from and then tread the physics simulair to how you would treat the map (you don't pass the map every frame do you?)

\$\endgroup\$
1
\$\begingroup\$

You don't sync the simulation at all. Only the results.

Or in other words: Those waves wouldn't be synced over network (only start/intensity and such). Only things moved by the waves (players, vehicles, etc.) are synced as usual.

The waves themselves are calculated by the clients on their own with details/accuracy based on local settings.

You can't really sync the whole simulation (with all details/elements/nodes) as that would require you to transfer/sync lots and lots of data. If you only have to simulate the surface, consider it being a net or mesh of points.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ "You can't really sync the whole simulation..." yes you can. In the same way as any RTS game is synced, by making sure all inputs to the simulation including time are the same. \$\endgroup\$
    – API-Beast
    Commented Jun 20, 2014 at 10:14
  • \$\begingroup\$ That's something you'll have to do anyway. I was referring to the state of each and every element (like all surface nodes). \$\endgroup\$
    – Mario
    Commented Jun 20, 2014 at 10:24
  • \$\begingroup\$ No, if you feed the same input into the simulation then you don't have to transfer any data computed by it since the result will be the same on all computers. \$\endgroup\$
    – API-Beast
    Commented Jun 20, 2014 at 10:28
  • \$\begingroup\$ You misunderstood me. Of course you're able to (and you'll have to) sync the initial state of the physics simulation, but from then on the clients simulate the waves on their own (unless occassional resyncs or similar). Otherwise your waves probably wouldn't match what's visible on screen. \$\endgroup\$
    – Mario
    Commented Jun 20, 2014 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .