GDC 2010 Networked Physics Slides + Demo

Big thanks to everybody who attended the physics tutorial today. You guys had some excellent and very thoughtful questions at the end of the talk. I really enjoyed answering them – thanks for being a great audience!

UPDATE: I just uploaded the final versions of the slides with lots of extra notes + instructions for reproducing the demo sections. If you downloaded the previous versions then you should take another look!

Here are the final keynote slides for “Networking for Physics Programmers” with presenter notes:

Here are the final PDF slides with notes sans superfluous visual effects:

Here is the demo shown in the talk: MacOSX 64bit Binary + Source, Win32 Binary

Have fun!

, ,
44 comments on “GDC 2010 Networked Physics Slides + Demo
  1. Pingback: 网络游戏的移动同步(三)平滑算法 | Dalton's Dev Blog

  2. Pingback: Unity Networking

  3. Pingback: MMO的网络延迟处理相关参考资料

  4. Hi, I really enjoyed your notes and the demo!

    I like the distributed physics sim load approach, but, when scaling, internet bandwidth worries me. Since you’re maintaining connections with three players simultaneously, does that mean that you’re actually aiming for a 192kbps user internet connection instead of 64kbps? Or does this network not scale this way.

    • Yes it does scale that way if you use P2P. These days I prefer to have a dedicated server that runs the simulation so the clients only run sim for objects they have authority over, bounce it off the server. Only the server needs O(n) bandwidth – clients can get away with 64kbit/sec up down and it scales nicely. cheers

  5. No there is no easy way around this that I have discovered. You could have an ordinal of player join, eg. 5th player to join, 6th player to join etc. but this would be unbounded.

    In the end, I have decided at least for my home project that I am moving toward a dedicated client/server approach instead. Many reasons, simplicity, late join, anti-cheat, higher player counts etc.

    The dedicated server owns the white objects and simulates them, the colored objects are under authority of the client and are “committed” by the client to the server. If the server accepts this commit, then the dedicated server owns the database of all object state so late joining becomes much easier.

    Alternatively, you could have a smaller world and like you say, not stream in prior-state on a need to know. Consider using a deterministic lockstep networking model instead, it may be better for your game.


  6. Was reading through the PDF, and I have implemented the authoritative method in my P2P game. Essentially you stack blocks with other players to get through the levels. In the PDF, you mention a late joiner getting confirmation from the first player before broadcasting changes.

    You mentioned that the 3rd and 4th player need to ask for confirmation from player 1 and 2. If the world is persistent, and player 2 sends updates to player 1, then wouldn’t late joiners only need confirmation from player 1? He was there the entire time right?

    Essentially player 1 knows everything, and player 2 only knows about the area around him, as confirmed by player 1. Why would you ask player 2 for anything but what he currently owns? Player 2 may not have ever been around player 3’s area. What would player 2 know?

    And touching a subject that wasn’t covered… What if player 1 leaves? Should the entire world state be sent to player 2? At this point, I’m having a hard time justifying streaming on a need-to-know basis. If player 1 leaves, the confirmed world state goes with him. Any way around this?

  7. Hi Glenn,

    I work for an indie MMO developer in the UK, and I was wondering what you’d advise for an MMO client-server model with respect to physics? It will affect some fairly important aspects of the game, we have a few ideas, but just wondered what your take would be.

    Thanks for your time, and for this great series of articles, I really ought to donate again soon!

    • I have no MMO experience you really shouldn’t ask for my advice on this! I’d say it’s a very hard problem and not likely to have an easy solution. On one hand, you probably cannot afford the simulation cost on the MMO server, on the other hand you probably have a PC platform and cannot afford client authority. Can you find something in the middle where the MMO server can look at the stream of physics state coming in from the client and correct if the client tries something that is obviously non-physically correct? I’d think that would be the only option unless you have a closed platform like console MMO (where they *do* cheat by having client side simulation btw…)


      • Cheers for the input, it looks like we’ll get around it by only sending detailed physics updates when it really matters, and we’ll try to avoid axis-unaligned bounding boxes and so on.


  8. On a whim I decided to refresh my knowledge on multiplayer game network coding. Came across your very insightful site.

    Your demo got me thinking about how Firefall would implement their 100 player + FPS server. The only downside is that you rely on the peer to peer networking model to communicate state (a nono for FPS games due to cheating). I was thinking maybe clients connecting to multiple servers: peer to peer authoritative servers (like ).

    It seems to be quite complex, but it could solve the cheating issue.

    Dunno, just thinking out loud.

  9. Hi,

    I downloaded the macosx source code and tried do build it. I’m on a MacBook Pro 13″, Snow Leopard. The binary distribution runs fine.

    Since I didn’t have ODE, I installed it from macports (which was a challenge in itself, but I did it in the end) and installed UnitTest++ from macports as well.

    Adding /opt/local/include and /opt/local/lib to your makefile, I was able to build the .app, though it doesn’t run (gives a black screen and crashes afterwards). The tests fail with an ODE error (“ODE Message 2: mass must be > 0 in dMassCheck() File mass.cpp Line 49”).

    Do you happen to know how could I go about building your demos so I can play with them?

    Thank you very much for these, they’re awesome!

    • I don’t really know what is going on there. You could try making sure the ODE lib is built with the same settings as the Cube demo — that may help. cheers

      • Hi, Glenn.

        I pinged you on twitter about this, but it was just too short! So I hope it’s ok to ask you here as well:

        Since I had some difficulty in compiling your demo on my machine, I have written some instructions and put ode’s source along your files as well.

        Would it be ok for me to publish that on github for other people that might have the same problem? I would, obviously, link to this article on your site. The intention is merely to help others that might be trying to learn from your code, as I am.


  10. I’m digging through the source and re-reading the presentation (which is great btw) trying to figure out the answer to this question, but sadly it still seems to be over my head: if each player is authoritative over their cube, then how can you ever resolve constraints which effect multiple players? (for instance, all players stacked on top of each other)

    I can see that this works well in the demo (stacks of three was the most I could finesse into position), even with high latency, but I don’t understand how this can be, since to stack properly all cubes need to be moved by the solver.. but which player’s solver is authoritative?! Is this no different than any other tie-break situation, in which case lowest ID is authoritative? This seems like it would ruin the higher-ID’s game but it doesn’t seem to. I suppose I may be conflating “player is authoritative over their cube” with “player’s cube has infinite mass in their solver”.. I’m just unclear on how you could resolve such constraints without giving authority to one of the players (and thus subjecting the other players to jitter/lag as their character’s position is now subject to round-trip latency).

    I’m asking because I’m interested in making a co-op game that involves lots of physical interaction (the players would be e.g coupled together via rope or point-to-point constraints or similar) but it’s never been clear to me how to get this to work sanely. Sorry if it’s a stupid question!

    • OK so here is the basic answer. It is not possible to have two players interacting with the same object without latency and synced “perfectly”. You must choose one or the other. Either, accept that lag exists and don’t client side predict or use authority scheme, *or* use authority scheme and trade-off consistency for a sync that looks “good enough”.

      This is how the player vs. player cube collisions work in the demo. I consider that each player running P2P has their own “time stream”. eg. red cubes are in red player’s time stream, blue cube in blues etc. Objects which interact in different timestreams are *undefined*. You will get some sort of weird resolution between the two machine simulations eg. red objects on red player’s machine collide with lagged blue objects, and vice versa for blue vs. red on blue’s machine. This is what I do in the demo. It’s not perfect but with visual smoothing on top of the sim it does a good job. Note that also I add rules for the katamari and cube blow effect such that I do not apply forces on cubes which are not my color to make it more well behaved. Doesn’t help with direct interactions though. There will always be “weirdness” in these collisions proportional to RTT.

      Now for your case you are wondering how to have two players interact with the same object via authority. It’s not a problem – think of authority like this. Authority does not mean player n is the only one who can interact with object X, it means that the state of the object on player n’s machine is the one which is transmitted to other players. So, you could have four players interact with object X, but it’s their interactions on player n’s machine which drive the state of the object.

      Consider a heavy object with four handles. Maybe it needs four players to pick up each handle in order for it to move. Maybe on player n’s machine you could evaluate if all four player inputs are in the same direction, to move the object in that direction. This means that other players on their machines are not really applying forces and trying to drive the object, it’s all happening on player n’s machine because player n has the authority over the object.

      Now think of a case where the players are not grabbing the object directly but are attached by springs. Again, you want to make it such that the springs on player n’s machine are the ones really driving the object, this means that players other than n feel lag when pulling the object. The trick here I think would be to cheat. Make the springs on other player’s machines have some small amount of “give” locally (non-authority) such that the player can displace and indicate that they want to move the object, then on player n’s machine run the REAL physics spring simulation. You could for example treat the mass of the object being pulled by springs as infinity (wrt to spring force) on non-authority machines.

      These are just ideas I have but I hope they help you out. Always remember, lag hiding is all about cheating. To make everything a perfect sync, you must have lag — to hide lag you *will* cheat like mad. Find that cool cheat that works for your game and you have made a good “consistency – throughput tradeoff”


  11. Pingback: links for 2010-03-22 « Blarney Fellow

  12. Cool! lot’s of networking related goodies in here. Million kudos! thanks for sharing the knowledge.

  13. Has the presentation been ported to a PPS or some other format with presentation notes for us poor non-mac users?
    BTW Really nice demo & slides Glenn

  14. Hi, I’m getting this error when I launch the Demo on Mac OS X 10.5.8. Do I need to be using Snow Leopard?

    dyld: unknown required load command 0x80000022
    Trace/BPT trap



    • It’s a 64bit MacOSX executable but your system is 32bit — try building it from source, you’ll need to build 32bit ODE (Open Dynamics Engine) and UnitTest++ libs as well

  15. Cant read the presentation notes on a pc and the slides on their own are a bit too sparse. Would it be possible to put up the notes in a more pc friendly format?

  16. Thanks for a very interesting presentation Glenn. This was by far the highlight of the day.
    Any chance of releasing the windows port of the code?

  17. Pingback: GDC 2010 proceedings | .mischief.mayhem.soap.

    • Yeah it’s designed for MacOS-X where it’s normal to Apple-Q out – a friend of mine ported it to win32, I assume that ALT-F4 should work, let me know if it doesn’t — thanks

      ps. Normally I’d quit on escape but since the demo is designed for live presentation I try to avoid having a single key which quits the demo — keys tend to get accidentally pressed in front of a live audience =)


Comments are closed.