Högni and Amy's game project

Thought in deed

Client Server Physics Integrated

leave a comment »

Well, I finally managed to integrate the hkpCharacterRigidBody into the client server networking in a satisfactory manner. After weeks of trying to get it to work sending the inputs across network I finally gave up and have it running separately. The client has its own physics handler integrated in its message loop, while the server runs completely indepentently in a separate code stack and thread. There is no communication between the two aside from the client interface being able to start and stop the server thread using a message pump through the scripting engine.

What I do is run a separate replica of each static geometry object on the client. When the server starts it creates the world and then proceeds to transmit all the relevant static geometry data to the clients. It doesn’t transmit the pathfinding phantoms nor does it transmit any physical properties for dynamic entities, only position and velocity updates are sent for those.

The client in turn takes input for the character controller the player owns and transmits the position and velocity updates to the server. The server then takes the position, verifies its validity and keyframes it into position. After watching the effects in the Havok debugger it seems to work very well. I’m not sure how to affect the player with dynamic server side objects, as the player character is a keyframed object and therefore has infinate mass, but I figure I can solve that later as long as the baseline is set. The memory footprint for the replicated objects doesn’t seem to be too significant, so I think this will do it quite well.

After this long battle I’m looking forward to continuing implementing the engine features that remain.


Written by Högni Gylfason

19.07.09 at 14:30

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: