This project has moved and is read-only. For the latest updates, please go here.

Server Side Question

Dec 31, 2009 at 9:22 PM
Edited Dec 31, 2009 at 9:25 PM

Hi all,

I am writing a 2d top down shooter prototype client/server and was curious if this physics engine could be used server side (to run authoritative physics simulation).  If the engine only uses screenspace to do the collision detection/response, I guess it wouldn't work for what I want.

Thanks for any help.

Jan 3, 2010 at 2:22 AM

All collision detection and physics reactions are calculated using math. There should be nothing to prevent you using this engine on a server and send the position and rotation of game objects to the clients.

Jan 3, 2010 at 3:43 AM

Excellent.  Thanks genbox = )

Jul 26, 2010 at 2:45 PM
Sorry to resurrect an old post but i have a problem. I have made a server and it seems to work.. kind of.. Gravity works and and the objects accelerate according to mass and gravity, however we do not get any collisions at all! none, no events get triggered or anything. This is done outside of XNA, but i have references added to Microsoft.XNA.Framework and Microsoft.XNA.Framework.Game as well as farseer libraries. The Physics Simulator update is done in a thread that runs in windows forms every 33 milliseconds.
Jul 26, 2010 at 7:16 PM
I had an issue like that when I first migrated to FP3.0. Turns out all bodies are marked as Static by default. Try setting them to dynamic and see if that changes anything.
Jul 26, 2010 at 11:04 PM
Edited Jul 27, 2010 at 12:47 AM
Hi Ron, Thanks for replying however, I am still using 2.13 as I do not see a download link to version 3. But like I said before, I have 2 objects. One acts as terrain and other is affected by gravity. I have a client that connects to the game and it gets updates of those two objects. The terrain block is set to static. Now everything goes like it should (the non static block gets accelerated by gravity) but it goes right through the static terrain block Edit: i was going to downloads rather than source, i have found the version 3 of FP, i will try and give it a go when i get home from work. It still doesn't explain why 2.13 does not detect a collision tho
Jul 27, 2010 at 7:42 AM

Why would a static object send updates? That's a waste of bandwidth.

First check if the physics simulation on the server works like it should; are both objects created and does the not-static one falls down? Is the update of the physics world going well? What argument do you pass with the step() method?
Then, see if the client gets al the messages it should get. If not, check where it goes wrong; at sending or receiving.

Jul 27, 2010 at 8:22 AM
The reason everything is sending updates is to see if the phys sim working, im obviously wont send updates that dont need to be sent. also like i have mentioned in the post above, static object stays where it is and the nonstatic object moves down and accelerates. It just doesn't stop when it hits the static object. The collision categories are set to all. As for the step method i pass it a 0.033 float. I will post my methods shortly if i cant resolve it
Jul 27, 2010 at 8:27 AM


Entrio and I are both roommates working on the same project. He runs the server, I work on the client.

The server is simply updating ALL entities at the moment until we are sure that it is working properly.

Currently the client is receiving all updates. The server simply lets the simulation run with an update/step time of 33ms, which then transmits all information to the client after running.

The server is a windows form using references to Microsoft.Framework.XNA and Microsoft.Framework.XNA.Game, along with all farseerphysics references. We have tried even adding Geom.OnCollision Events to all entities just to check if collisions are being detected at all and the events never get triggered.


We have been using an old build of Farseer though, we'll try updating to the latest build and see if that makes any difference, although I doubt that is the problem.

We have used the exact same code in a simple XNA + Farseer game, and collisions are detected perfectly. The only difference is that the clients are not running a simulator, but rather simply drawing the objects whereever the server tells them to, all simulation is done server-side.




Jul 27, 2010 at 10:32 AM

What I mean with my earlier post is try to isolate the problem.

If you say the server sends updates of all objects and the clients receives them properly; the problem should not be looked for in the networking part.
What leaves is the server's physics simulation. I understand you want the server's application to be as small and fast as possible, but while developing; why not just make it a 'regular' game and have it's objects drawn? You then have narrowed the problem down to a very normal situation, in which it should be easy to find why objects are not colliding.

Good luck :)