Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
    
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. –  bogglez Jun 20 at 4:10
3  
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. –  S.Richmond Jun 20 at 4:14

2 Answers 2

up vote 3 down vote accepted

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?)

share|improve this answer

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.

share|improve this answer
1  
"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. –  API-Beast Jun 20 at 10:14
    
That's something you'll have to do anyway. I was referring to the state of each and every element (like all surface nodes). –  Mario Jun 20 at 10:24
    
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. –  API-Beast Jun 20 at 10:28
    
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. –  Mario Jun 20 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.