About physics calculations

I'm still evaluating photon to be used in our project and I have thought up a problem that I’m not sure if it can be solved.

Our game requires physics calculations as it is a MMOFPS so I will require us to check 3d data to see if what the player is doing is what it should be doing to prevent cheating because nobody wants to play a game full of hackers.

So my problem is how would you check the 3d data from unity3d within photon to create a fully authoritative server?

Comments

  • Unless you implement a new physics engine into photon and unity, you can not do that.
    What you normally would do is either 'approximate' the simulation for verification or alternatively, if you use PUN anyway, not do it inside of photon at all but host headless unity clients on your backend, that do the verification (and use them as authorative servers)
  • Hmm I kind of get what you mean, we use photon V3 to set up all our communication then use a trusted client (Headless unity client) to work out if what the player is doing correct, so in theory you are using photon as more of a proxy rather than anything else.

    This to me seems very inefficient though and looks like it could cause issues further down the line unfortunately.
  • This headless unity model is done by others, too. At least one bigger MMO is doing this. It meant some extra effort to get the communication between server and unity-headless to handle updates for up to 1000 entities but now this works.

    In reality, most MMOs could do without a full-blown 3d physics. You want collision detection and maybe position updates due to constant forces but you rarely need a complex rigid body intersection solving or floating-precision gravity. If you know the speed of some item, you can move it around and avoid intersection with a collision detection. You could build a simplified level geometry and export this for your custom "physics", using the same mesh on client and server.

    If you can get away with such a rough(er), simple(r) "physics replacement", it might be more effort on the Unity side (compared to in-built physics) but it can save a lot of CPU and thus hosting-cost per player.
  • Athan wrote:
    Hmm I kind of get what you mean, we use photon V3 to set up all our communication then use a trusted client (Headless unity client) to work out if what the player is doing correct, so in theory you are using photon as more of a proxy rather than anything else.

    This to me seems very inefficient though and looks like it could cause issues further down the line unfortunately.

    If you use PUN photon always is only a proxy primarily.
    Would be something different if you use Lite + the .NET Unity SDK and work with the 'bare metal'

    But even then: trying to get a physcis library in that works performant and reliable is a major pain as you have to integrate it into photon and unity to even work (physx does not exist in .net form and using two different ones will not make the client prediction work well) and on top of that you would need much more processing and handling than you need when you use photon as lobby manager, chat, community, whatever central platform + unity masterclients as 'game simulation nodes' where the distinct game sessions run.
    Its also very easily scaleable, as you can just fire up more unity clients and more servers with unity clients (its instantly, 0 effort scalable)
  • I will give this a try does anybody have this sort of setup working or as a small showcase of a headless server and photon + unity client all working together, because I really like photon and would love to use it and as you say it can be very easy to scale with. I'm just inexperienced in this field.

    Thank you again for all the help and suggestions.
  • You already have this setup by default when you work with PUN.

    The first client entering a room / creating it is the master client.
    If you only allow room creation in your own headless clients then you actually have this setup already as the master client is where all others who join a room will be connected to for simulation.
  • Won't be able to use PUN for this it won't handle the amount of concurrent players we want plus it does not allow even somewhat close to the amount we want to be using, If we where to using anything it would be photon V3 with some AOI (Area of interest).

    So unfortunately we cannot use PUN for this instance well not until it has been developed to be authoritative and have some sort of AOI.
Sign In or Register to comment.