Interesting behind the scenes view of Battlefield Bad Company 2 physics

http://www.youtube.com/watch?v=evpt3bD1clg



Look at this video from about 2:20 on. The guys shoot lots of tracer tags onto the sniper guy and interestingly it reveals something about the physics in BFBC2. One can see that when the guy turns very fast that the tracer bullets are actually attached in the shape of the character but they move at a different pace. This on one hand shows that the final interpolation and visual positioning of the models on the screen is only happening on the graphics side. Also it shows that there seems to be different priorities for different data thats sent over the network.

All in all a nice little example of how one can look behind the scenes of AAA games and what usable information one can find there.



Cheers,

Normen

If by graphics side, you mean on the client then yeah all graphical representation should only happen on the client. I’ve been reading up on Valve’s architecture for the source engine (halflife, counter-strike, team fortress) and like most FPS games they use UDP to communicate between client and server. When using UDP you cannot guarantee that messages arrive at all and in the correct order, so you have to build a priority system.



Valve’s system was designed as an attempt prevent cheating as much as possible. So all positions go through the server and are checked there.

They also developed a lag compensation algorithm which accounts for a users lag to the server. For this method they actually go back in time (server wise) and find a valid position compared to when the other player shot at you, and do a calculation from there. With this method sometimes you will notice that even though you have ran behind a wall, the server registered you as dying in a different spot right before you reached cover.



I have never played this bad company game and it’s hard to tell from the video if they used the same approach. If they didn’t its more than likely that everything is checked on server than sent back to the players without compensating for internet connections.



Good observations Normen :slight_smile:



On a side note my co-worker always knows some behind the scenes tricks they use in games since he has worked on some before. He has been writing his own 3d engine for the past 10 years I think. If you are interested he has some videos up on youtube. It is called 3D Kinesis.



http://www.youtube.com/results?search_query=3d+kinesis&aq=f

Yes, this was actually only about looking at games to see whats up, good training. Theres lotsa papers on game and software design but sometimes its better to see things than reading them. Where to do the physics is a topic for each online game time and again, producers dont like to pay expensive supercomputers as servers and cheating has not the uber priority there…

I would say bf2 bad company does lag compensation in pretty much the same approach I currently use.

Everything is slightly delayed ( you always have a ping 75+ maybee the tickrate?)

So as long as your physical ping is less you won’t have any real disadvantage. Combined with real flying projectiles nobody is expecting to hit the same millisecond they shot so it works pretty good,

I dont think so, thats what I meant by priorities. Look at how different the player mesh and the player physics body move. This is more than a delay, different data is transferred at different speeds. Also with a low ping BFBC2 is quite accurate, not much “advance-aiming” due to the lag (only due to bullet speed ;))

Well actually I only told my feelings from playing the game, I never noticed that some stuff is different in speed. (Except buildings destroying)

Actually I can get up to a 4ms ping on cs servers ( thanks to uni-internet), however I never found a bf server with a ping lower 75 so I guess they are delaying it. (Would need a test in lan to verify this)