Captive Imagination
July 31, 2010, 11:59:27 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Check out the teaser site for the first official game by Captive Imagination: http://www.galaxiesbeyond.com
 
   Home   Help Search Calendar Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: How does PhysicsNetworking work?  (Read 1160 times)
0 Members and 1 Guest are viewing this topic.
wolfgang
Newbie
*
Offline Offline

Posts: 14


View Profile
« on: March 30, 2009, 03:35:05 PM »

Hi all,
Could someone explain roughly how the PhysicsNetworking API works behind the scenes? Is it based on Dead Reckoning where the physics is being calculated separately on each client with messages spawned only for "sanity checks" and on events like collisions and user input, or are the clients kept in sync every update?

Thanks.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #1 on: March 30, 2009, 07:54:19 PM »

Similar to dead-reckoning yes, and a sync happens at the same rate as positional synchronization occurs.
Logged
wolfgang
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #2 on: March 31, 2009, 04:54:13 AM »

Thanks for the reply Darkfrog Smiley

How does the client deal with latency? I'm guessing the server will send out messages like: at time t, object x at position p has force f applied, and the client then works out where x should be given p and f at time t + latency?

Also, I'm guessing if something like Dead Reckoning is used then the PhysicsNetworking API will be pretty quick? How many physical objects (simple cubes) do you think it could handle?

Thanks.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #3 on: March 31, 2009, 09:03:08 AM »

Well, using UDP and a fire-and-forget mentality all synchronization information is stored in each message, so if one or many get lost another message is right behind it.  Also, both incoming and outgoing queues have a special feature for synchronization messages so if multiple synchronization messages get stacked up into the queue for the same object only the newest one is kept and the older one is removed.  This keeps from sending information that is no longer desired or wasting time applying information that has been deprecated.  The lag adjustment code was very simply implemented previously and then it was removed, so in the current scenario there's no adjustment being made, which really needs to be resolved, but nobody has given it any time yet.  For most things it's not noticeable, but in consistently laggy environments it could be very bad.  If you're interested in providing this functionality to JGN it would be greatly appreciated

I personally have never used very many objects at one time (around 10 is the most I've really used), but I know others in the community have done a lot more than that and have not had problems.
Logged
wolfgang
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #4 on: March 31, 2009, 10:42:28 AM »

I was kinda hoping PhysicsNetworking API had solved the lag issue  :'( Is there no way of doing prediction in ODE?

On second thought, I could imagine prediction to be very difficult, or computationally expensive depending on the size of the time-step.
Logged
darkfrog
Administrator
Inspired Imagination
*****
Offline Offline

Posts: 2650


View Profile
« Reply #5 on: March 31, 2009, 11:46:15 AM »

Two major reasons this is not done. Smiley

ODE does not support prediction, and it can be very expensive and very complex.
Logged
wolfgang
Newbie
*
Offline Offline

Posts: 14


View Profile
« Reply #6 on: March 31, 2009, 12:27:02 PM »

So how do commercial games do real-time networked physics? Or do they not?

I want to build a game using networked physics over the internet. Obviously latency is probably going to be quite high and inconsistent. I suppose that I can get around the lag issue by changing the way the game is played, make it more turn based rather than completely real-time. I'm sure that if I'm clever with the game design I can get around it Smiley

I would like to research this problem a bit more though because it would be awesome to have proper real-time networked physics Wink

If you have any ideas about how to make it a reality, I'll gladly give it a go.
Logged
TheMatrix154
Newbie
*
Offline Offline

Posts: 1


View Profile
« Reply #7 on: April 01, 2009, 02:59:09 AM »

Hi,
there is an interesting article on gafferongames about Networked Physics. This is a site from Glenn Fiedler, a game dev pro in LA. Maybe there are some thoughts to get on the right track.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.212 seconds with 21 queries.