How does server perform tasks without knowing about game.

edited August 2011 in Photon Server
Yeah the title is confusing.
So for example if I use photon with unity, how does photon do stuff? Since photon is a third party system, how could it do raycasts or physics sims or anything? I heard you need a unity instance on serverside for that stuff, but that seems really inefficient for large scale multiplayer games. In games like counter strike and even mmo emulators, the stuff is server side, but photon doesn't have access to physics or anything. Hell, it isn't even aware of the level since it can't load unity levels. So how can one check if a player can or can't go there if the server doesn't even know the physics model of the map? I am really curious on how this is done.


  • Photon does not provide a unity physics, photon is just a socket server that you can use with unity clients (and that is extendable with C#).
    If you need physics you will either have to write your own or find a library that you can use or customize for your needs. I know of a couple of developers that do this with success. Others prefer to do everything in unity, so they use photon just as a networking proxy and run a headless unity client on the server for the game logic.
  • And what kind of physics solution could I use? I don't know any that is for .net or c# myself.
  • here are two that might be helpful to get started:
  • OpenSteer is not a physics solution. It's a "AI" solution and offers basic steering behaviors / pathfinding.
    We used box2dnet in a project before. It's 2d, obviously but in some cases, that's enough.
  • So if I do a photon + unity combo for the serverside, it means I can take advantage of photon and everything that unity offers?
    But how would I get unities to run on a server? For example if my game is lobby based, how would I get a unity running when a new lobby is created?
  • There are two ways:

    1. Fire it off from within photon as part of the lobby startup (unsure this works or if the environment is self contained)
    2. have a small java / .net standalone "server" running next to it to which the lobby upon start send a "start instance for lobby XXX" message which will make this little program fire up a new headless client and pass the required informations so it gets into the right place.

    I prefer 2, reason is simple: you can make this small "server" there write its existance into a DB including his machines load and then have photon read from this DB and selected the "lightest used" machine in your cluster to fire up a new instance that way.