Physics and Networking

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Physics and Networking

Postby Firefly » Thu Aug 28, 2008 3:29 am

Hi guys,

I just wondering what people on these forums have to say about the physics networking dilemma. I've read the threads on here and I read an article over at the gaffer and two methods seem to be mentioned:

- Simulation by each client. Everybody trust everybody. The server just broadcast the state of the clients. Clients interpolate the other client’s states.

- Simulation on the server. Prediction on the client. Speed up clients so that they deliver input in time to the server. Interpolate between prediction state and server state.


At the moment my current implementation uses the second method and I'm starting to think if I should switch as it seems prediction might start to get fairly complex. I have some basic interpolation working but I now need to work out a way to interpolate the player input as well and it seems like it might prove to be a bit tricky.

What are your thoughts, and/or what have you implemented that works?

Cheers
Firefly
 
Posts: 32
Joined: Wed Jan 17, 2007 4:58 am

Re: Physics and Networking

Postby dpadam450 » Fri Aug 29, 2008 11:18 pm

Just gonna post some ideas:

1.) Say you have a game with tons of boxes that you can shoot. I would do all of those updates on the client side. There is no need to send (plus it would take tons of bandwidth) to send updates of 100's of boxes and players at one time.

2.) Here is an issue I have yet to decide how to fix. Imagine that you are online and for some reason it takes you 1 second to contact the server, most games will move you back to where they think you should be (the main reference of lag). Otherwise every 1 second you would jump randomly in the game world to everyone else. But on your screen u would see everyone pause for 1 second, and you could kill them.

So: Use states for non-player objects. Have the server do most of the player updates. Essentially your right in doing what you do I guess, you should probably read a networking book though. Maybe one of the GP Gems books has some info.
dpadam450
 
Posts: 7
Joined: Mon Jun 23, 2008 10:02 pm

Re: Physics and Networking

Postby DarthGak » Sun Aug 31, 2008 4:46 pm

One of the guys who did Mercenaries 2 gave a talk at last years GDC about this subject. I dont remember the details but it seemed like a really clean solution.

http://www.gaffer.org/archives/summary-of-gdc-talk
http://www.gaffer.org/archives/gdc-slides-released
http://www.gaffer.org/game-physics/networked-physics
DarthGak
 
Posts: 25
Joined: Sat Nov 25, 2006 4:55 pm

Re: Physics and Networking

Postby Gaffer » Tue Feb 24, 2009 1:12 pm

hey guys, gaffer here

so i'm doing two talks at GDC 2009 this year

first i'm doing a 1hr talk "Networking for Physics Programmers" during the physics tutorial days (monday/tuesday)

and i'm doing a lecture called "Drop-In COOP for Open World Games"

*both* talks will explain how to network a physics simulation, and build on the work i presented at GDC 2008 - the key idea here is simply that you send the physics state for objects as frequently as possible (in one direction), and you always extrapolate using the physics simulation itself. there is no traditional interpolation/extrapolation - just a visual smoothing of objects you render from the snapped states in the physics simulation, i'll be explaining this in the first talk.

so networking physics is actually really easy, but there are interesting aspects like how to synchronize input, how to distribute authority (who "owns" an object) and various other tricks that help you remove the perception of latency. for example with authority management (or an "authority scheme") you can remove any perception of latency when players interact with physically simulated objects, even when there is seconds of lag. this works as long as the players interact with different sets of objects. effectively, each player is the server for objects they control, and becomes "the server" for objects they interact with.

i'm so convinced this is the right way to do things, that my lecture is about a generalization to a new peer-to-peer architecture for synchronizing physics in an open world. i'll show you guys how to synchronize a physics simulation of a million cubes *without* having a server, each player is a peer and they have a set of authority rules that keeps the world in sync, and minimizes latency

see you guys at GDC! if you can't make it, check back on my website, i'll have the slides and hopefully a video of the demos up

http://www.gafferongames.com

cheers all!
Gaffer
 
Posts: 3
Joined: Tue Feb 24, 2009 1:05 pm

Re: Physics and Networking

Postby JernejL » Tue Feb 24, 2009 4:04 pm

Gaffer: To have players own the simulation of object they own sounds so awesome and simple, until you take into account cheaters, you simply cannot trust *any* client at all, if there were no cheaters networked physics would be much easier than they are in reality, there are always people determined to challenge and ruin the game, i'd like to some of your articles focus also focus at that, because it is a severe problem (if you ever got chased in a helicopter by a flying bus you'd know this problem very well ;) ).
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Physics and Networking

Postby Stucuk » Thu Feb 26, 2009 1:01 pm

As Delfi sais you always need a server. Most online games that have lots of cheaters are vunrable because they rely too much on client's being truthful. You always need a server to make sure no client has lied. War Rock is a perfect example of a game which rely's on clients being truthful. In it cheaters can fly (Without any helicopter) to the top of the level and just shoot continual rockets down to the people below.
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: Physics and Networking

Postby Gaffer » Sat Feb 28, 2009 2:17 pm

if you are making console games, communications are encrypted, and nobody can change the executable without being banned from xboxlive or PSN

and in general, i work on COOP games

so i guess, my main point is - for these sort of games, you are going to see much richer physics interactions, with latency completely eliminated

for PC competitive games, yes stick with clients and a dedicated server, but good luck trying to network the physics, there is no good way :)

cheers
Gaffer
 
Posts: 3
Joined: Tue Feb 24, 2009 1:05 pm

Re: Physics and Networking

Postby agi_shi » Sat Feb 28, 2009 2:21 pm

Stucuk wrote:War Rock is a perfect example of a game which rely's on clients being truthful.

F.E.A.R. is a better example.

Everything was clientside. I don't even know what part the server did, except tell you where the other players are. Weapons, speed, health, position, everything. In fact, you could literally freeze the server (stop it from updating) from the client... (with the appropriate hacks, of course)
agi_shi
 
Posts: 263
Joined: Fri Aug 17, 2007 6:54 pm

Re: Physics and Networking

Postby JernejL » Sun Mar 01, 2009 3:39 pm

Gaffer wrote:if you are making console games, communications are encrypted, and nobody can change the executable without being banned from xboxlive or PSN

and in general, i work on COOP games

so i guess, my main point is - for these sort of games, you are going to see much richer physics interactions, with latency completely eliminated

for PC competitive games, yes stick with clients and a dedicated server, but good luck trying to network the physics, there is no good way :)

cheers


You are being too self-confident, i seen what the hackers are willing to do to cheat, you will see hacked routers with aimbots, etc.. in the future..
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Physics and Networking

Postby Gaffer » Mon Mar 02, 2009 1:35 pm

You are being too self-confident, i seen what the hackers are willing to do to cheat, you will see hacked routers with aimbots, etc.. in the future..


You do realize that modern game consoles run IPSec for connections between peers yes?
Gaffer
 
Posts: 3
Joined: Tue Feb 24, 2009 1:05 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 13 guests