Search Unity

Determinstic PhysX, GangBeast Setup, and LockStep Frame

Discussion in 'Multiplayer' started by FuzzyShan, Jan 22, 2017.

  1. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    I was just wondering how Gang beast setup their server tech, seems like lockstep frame by passing commands to server or p2p communication to emulate all client device to have same PhysX emulation would be impossible, how did gang beast go solve this kind of problem able to have same emulations for all their clients.
     
  2. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    475
    Anybody?
     
  3. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    On Gangbeast they have official and non-official hosting, but I am still wondering how they sync their physics variables, having bunch of players sync all their rigidbodies, making an Unity Physics Server just seems like unreasonable thing to do... I was wondering if they just use fastest's player's physics simulation data passes into server, where server will adjust to all these variables?
     
  4. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    After doing some research and I saw this: https://steamcommunity.com/app/285900/discussions/1/142261352645982013/, Seems like gangbeast didn't use lockstep framework, I guess it's because of PhysX and animation of Unity, rather they just use Unity to start a server instance with -batchmode and -nographics, and probably simulate most of the stuff inside of Unity server, which probably figure why they start letting other players to host because of the usage is huge, if they hosted so many official servers could end up with a huge cost.
     
    Shizola likes this.
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Gang beasts isn't very many players and it is slow paced, so it's OK to just send a whole lot of correction data.
     
  6. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I think you're really chasing the wrong bunny. You don't need deterministic physics for this, but if you want to go there, please do.

    You need deterministic physics, or do you need deterministic results? They're not the same thing. And why deterministic? do you mean accurate or forecasted?
     
    larku likes this.
  8. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    I want exact deterministic physics because I want to use lock step implementation on my mobile game simulate all 3D physics to be deterministic, rather than using state sync with heavy server simulations.
    So far using Newton Dynamics, I was able to generate exact same physics deterministic simulations over and over on different PCs, using 1 thread worker and fixed update, just like what DPhysics is doing.
     
  9. imgodot

    imgodot

    Joined:
    Nov 29, 2013
    Posts:
    212
    Just to throw it out there, Photon has TrueSync which is a lockstep framework with built-in physics for 2D/3D.
     
  10. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    Their source code is not exposed, they don't have Joint Component which is what I need to simulate ragdoll behavior.
     
  11. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    475
    Have you asked them about adding that? I think they're open to suggestions like that.
     
  12. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    I was able to get TrueSync to work, I also have their source code, so I went with that, however the problem remains with getting mecanim's animate physics to work with any outside physics engine code, seems like they react differently with animations(unity animation). PhysX itself has with its compound collider system implemented inside unity is already some other 3D physics engine doesn't have, without full source code, I can't really do a full implementation. I think it was always been a big topic having animations and physics been mixed together, it doesn't always play right together, just when you tought having a deterministic physics 3D engine solved all the problem, but really another problem arises, also implementing modifying 3D physics engine itself is a hefty work(trying to implement configurable joint). Back to Snapshot Interpolation, heavy physics simulation over server for now... Not try to discourage anybody out there, but I am on a deadline.
     
    Last edited: Feb 21, 2017
  13. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Hello guys, I'm looking for deterministic physics solution for a while, I need my bullets to be a local objects with ricochet ability and to be synced over the network without any client/server side corrections, can I achieve this with
    Newton Dynamics or anything else? Is this even possible?
     
  14. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    If it is just bullets you can probably write your own deterministic solution, you don’t need the whole physics engine.
     
  15. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Hi, thanks for reply and yes, all I need is a points based shape logic with height to detect and calculate first collision hit normal and possibility to spherecasting in to this shapes for other gameplay features. Another question is a skill needed for this, I've not any experience in this.. I would very appreciate any links to any sources that could help me with this.
     
  16. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    um... right, sounds like something you could do yeah... so basically you just need a math library that has different type of 3D detection, I believe there is one on assetstore that's pretty good. I am also making a deterministic 3D physics engine right now based off truesync, got a ragdoll to walk almost, if anybody with good physics background, feel free to join me and work on the physics joints and stuff.
     
  17. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Yes, Truesync is very promising, but I can't use it for now, because there is no dynamic connections support, no raycasts and a lot of bugs.
    I've found an opensource C# physics engine, which can work with unity called BEPU and considering to this topic (https://forum.bepuentertainment.com/viewtopic.php?t=2302), it seems to be a way to make a crossplatform deterministic physics, but I dont think I can handle this. Would be great to cooperate with community, with all who ran in to this problem, so we can make a solution together
     
  18. FuzzyShan

    FuzzyShan

    Joined:
    Jul 30, 2012
    Posts:
    182
    I have integrate a simple version of this into unity as you described, I find that the performance for this is not going to anyway close to commercial use, I spent 2 hours integrating this, so there might be some stuff I am not getting. I was able to run alot of cubes, but the frame rate just drops to pretty much nothing.

    I am also following the avatar physics forum, their engine is pretty deterministic running very accurate complicated 3D physics in a good performance.
     

    Attached Files:

    Last edited: Jun 22, 2018