best way to make a multiplayer physics heavy game (3000+ rigidbodys)

well I have my game running 3000+ rigidbodys perfectly fine and now it is time to start on multiplayer. does anybody know of a good way to make a game with 3000+ rigidbodys with about 700 non-sleeping blocks multiplayer?

I was thinking the clients do all the physics and the server manage the players positions and when they have fired so the bandwidth is at a minimum

does anybody have any other suggestions on how to do this
and what server side software should i use for this, it would be really nice if the server software was open source. thanks

also is there a way to edit prefabs inside of prefabs?

There is no simple solution for this, because this is not a simple question. The only real answer that can be given is “it depends…”

If you aren’t worried about being authoritative, e.g. you trust all players not to cheat, you can run the physics on client machine(s) and take the load off of your server. You’ll either need to pick a user to be the authoritative physics or find a way to manage divergence among your users. If you do want physics to be based off of more than one user, that will entail more communications (rather than one-to-many, you’ll have many-to-many syncing).

If being authoritative is important to you, then you have to run the physics yourself, on your server. The easiest way to do it is to run a copy of Unity running the same game with the same state the players are, and let it have the final say on physics. Alternatively, you could set up PhysX to run without Unity, use another physics solution, or write your own physics calculations that will run in Java or some other language (preferably a native one, not a VM).

Either way, you will have to communicate that information over the network to players. You will run into a couple major issues there:

  • Latency: by the time the physics gets there, it will already be old
  • Bandwidth: sending position and rotation for 3000 objects will take at least 72 kB per frame, so at 30 frames per second that’s 2.1 MB per user, assuming no compression.

The short answer is: it’s not possible to send that much information over the network. You will likely need to come up with a solution that interpolates or extrapolates (to account for latency), and send the data less frequently, more as a ‘correction’ than a driver of physics. E.g., let the local user handle physics, and send them rough corrections every so often for when their physics diverges from what is authoritative.

I have to stress that this is a monumental task that professionals would struggle with, which is why people get paid big bucks to design gaming servers.

Well… it depends how much accuracy is needed.

One way, of many, is a lock-step method with a deterministic physics engine. You will be able to avoid sending loads of physics information. However, there will be a slight input lag which is not great for competitive play. This is what halo does for their multiplayer Campaign mode.

If you can’t do that, you will have to find someway to compress, cull, and prioritize that information. For example, the player does not need to know that a box shifted 2 feet on the other side of the map right away. You can send this information at a later time. So, “sending position and rotation for 3000 objects will take at least 72 kB per frame, so at 30 frames per second that’s 2.1 MB per user.” Now if you prioritize that info where 10% (300) of the objects are sent at 30 fps and and the rest are sent at 1 fps then you have 281 KB per user

Something to remember is that what you’re trying to do is create the illusion that everyone is playing together.
I recommend watching this video:
http://www.gdcvault.com/play/1014345/I-Shot-You-First-Networking

I was thinking the clients do all the
physics and the server manage the
players positions and when they have
fired so the bandwidth is at a minimum

So this maybe a good idea for a players vs monsters(npc) game. However, this becomes a problem in a pvp game. Lets say you crouch behind a box. If the physics is out of sync another player may see you crouching but they may not see the box! it could be on the other side of the map. They shoot you, you die, you rage quit.

does anybody have any other
suggestions on how to do this and what
server side software should i use for
this, it would be really nice if the
server software was open source.
thanks

You will most likely need a server with the exact same physics engine (headless unity). Unless, you are ignoring all physics, or physics is somehow calculated and sent by the players.