Bye Bye PUN2? Car rigidbody sync problem case 56.000 ...endless...

Options
Hello dear people,

before I turn my back on Photon and PUN, or PUN2 to be precise, I will try one last attempt here.

I run and develop a game called "GeneRacing". It is an arcade top down racer.

I've been developing the game for almost 2 years now and have been using Photon with PUN since day 1 in the hope of easily finding a usable solution here. In itself, everything works really flawlessly, except for the synchronization of the rigid bodies, the physics and the cars.

The collisions obviously feel extremely bad or wrong. Clear. Can also not work if every client calculates himself.

All possible attempts to send force via RPC led to nirvana because this is simply too laggy and useless.

Before I finally turn my back on PUN2, I wanted to know whether anyone has already successfully solved something similar without an authoritative server?

I don't need any complex solution, just a reasonably realistic behavior in the event of a collision.

greetings


Michael

Comments

  • Tobias
    Tobias admin
    edited February 2021
    Options
    Collisions and physics are really really hard to network. PUN 2 is using state transfer and does not take care of the simulation at all, which does not "help" for this case.
    It can be done but it's tricky to pull off, admittedly.

    This is a known issue but we can not fix this without changing PUN 2 completely, which we don't really want to do either, so we develop a new networking solution: Fusion. It will be different but enable much better results with less complex coding.

    Have a look here:
    https://doc.photonengine.com/en-US/fusion/current/getting-started/fusion-intro

    So essentially, yes, Bye Bye PUN 2 for this case.
    A public beta for Fusion is planned but there is no ETA yet.
    There is a sign up for the alpha: https://download.photonengine.com/fusion-early-access

    Care to show your game?
  • James_MF
    Options
    I would also love to see these issues you're speaking of. I'm well into development on a among us/prop hunt mashup. As you could imagine, collisions on clients and un-owned props over the network has been a huge struggle for me. On average, I was spending about 4-5 days just digging for a solution and trying new ways to overcome collisions with PUN2. I may be able to offer up some advice if I could see what sort of collision issues you're getting.
  • Elharter81
    Options
    Tobias wrote: »
    Collisions and physics are really really hard to network. PUN 2 is using state transfer and does not take care of the simulation at all, which does not "help" for this case.
    It can be done but it's tricky to pull off, admittedly.

    This is a known issue but we can not fix this without changing PUN 2 completely, which we don't really want to do either, so we develop a new networking solution: Fusion. It will be different but enable much better results with less complex coding.

    Have a look here:
    https://doc.photonengine.com/en-US/fusion/current/getting-started/fusion-intro

    So essentially, yes, Bye Bye PUN 2 for this case.
    A public beta for Fusion is planned but there is no ETA yet.
    There is a sign up for the alpha: https://download.photonengine.com/fusion-early-access

    Care to show your game?

    Bad news and good news.... the prospect of Fusion is good, but of course, bad to dont know when its estimated.

    If you have Steam i´ll send you an alpha-key for a short test ride, if not:
    https://www.youtube.com/channel/UCIs3MwZ4wrdaIv3g2LoGI8Q

    But i listed all networking-races to "private" because of bad looking.

    But as @James_MF asked for a video too, so i will follow up with one in the next few hours/days.
    I will answere here again.

    At the end, its not the big deal. All cars are handled with 1 spherecollider in the middle, with 1 rigidbody.
    But if they collide, nothing happends (of course) because the other client is calculating against the other one.
  • Tobias
    Options
    This looks really nice! I think I saw something of the game earlier. Cool idea.

    Knowing a bit more about the game, I wonder if you need perfect physics or can get away with simpler but "ok" results.

    You want nothing else than keeping the cars out of one another?

    You mentioned that you are sending the force via RPC. This is not going to work out, cause a) it's too late and b) RPCs are not sent immediately, so they potentially queue for a moment in the client and this adds to the variable lag (variance/jitter), which is really bad.

    But: The car movement is somewhat predictable. Speed and direction are known and could be sent with each position update. This can help on the receiving end to predict where the car is going.
    Probably, the remote sphere(s) could possibly be set to IsKinematic and your simulation should drive their position.

  • Elharter81
    edited March 2021
    Options
    @James_MF Look here: https://www.youtube.com/watch?v=7An7mF-F5JA
    00:57sec, between blue and black car.....this is an bad behaviour and very unrealistic. The black car did not move while hitting it with 200km/h from the side.

    Yes, for sure - i do not need really much. The physics model on the client is okay and very useful and working for all cases: tarmac, jumps, grass, snow...etc.

    Its just the very unrealistic behaviour of collissions between the cars.

    In some races, for pro-drivers there are driving 40 rounds, fighting in curves and they are trying to overtake in a curve by leaning inside to the opponent, to push them a little bit out and win the fight.

    This is not possible because the outside car did not move. A real fight is not possible which is disturbing.

    Ive tried to solve it over RPC-Calls, but this is not usable too because of to high delay, especially if users in the room with different pings. The RPC-Calls are too late in any case.

    At the moment, and in this video, no RPC Call is integrated at all.
    Yes, now i read your sentence about RPC - you are completly right, exactly what i figured out by trying it.

    Yeah i tought about this way to solve it: but how?

    Lets take 2 different point of views - from the view of Car1:

    Car1 is driving and syncing to all others....
    Car2 is driving and syncing to all others...
    Car1 (me) is hitting car2 (other) inside a curve....
    Car1 set Car2 to isKinematic=true ..... now my client (car1) is able to move it.
    Car2 sync his current position to Car1 and the collission-behaviour is overwritten by Car2 - here on my side.

    If i set isKinematic on the remote-client too (which is Car2) the Car2 could not control his own car for some milliseconds, which results in a weird behaviour too - i think.

    So im confused...
  • Elharter81
    Options
    Tobias wrote: »
    This looks really nice! I think I saw something of the game earlier. Cool idea.

    Yeah, the genre isnt new :) MicroMaschines, TurboSliders, SlicknSlide are in the same genres from the 80ths and 90ths....we are working 2 years now on a remake to ensure the survival of "Top down arcade racers" :)

  • Tobias
    Options
    I will ask my colleague to chime in on this. I am not deep enough into synchronizing game state, so I have a hard time to make useful suggestions. It may be, that PUN without a tick based system isn't properly up for the task but we will make a suggestion or two.
  • Elharter81
    Options
    Tobias wrote: »
    I will ask my colleague to chime in on this. I am not deep enough into synchronizing game state, so I have a hard time to make useful suggestions. It may be, that PUN without a tick based system isn't properly up for the task but we will make a suggestion or two.

    Thank you a lot! I appreciate it
  • Elharter81
    Options
    One new video: https://www.youtube.com/watch?v=lsQ0tqPJWzk&t=80s
    3min20sec , start of the race, 3 cars.

    First curve: collission. Cars are stopping completly.
  • Tobias
    Options
    I talked to my colleague and sadly he doesn't have that much to add. It is a tricky problem to sync and there is no out of the box solution to this.
    Our pre-built PhotonTransformView and PhotonRigidbodyView are relatively simple components, which should be customized to fit the gameplay. You could send input, velocities and so on to help the remote player to place the other's cars correctly.

    You could increase the SerializationRate but if this gets you good results, depends on the lag and loss that players will have.

    The only "proper" solution would possibly be to run all of this in Quantum, which does all of the simulation in a deterministic way, based on the input that arrives on time on the server.
  • Elharter81
    Options
    Okay, thats really bad :( But of course i appreciate the try...

    How "easy" its to port it to Quantum?
  • Tobias
    Options
    Sorry for the silly answer but this really depends on your project and approach.

    Quantum is using it's own ECS, so the coding approach is unusual at first. It will require a rewrite of most systems.
    However, it does feature deterministic physics and tick based input handling, so a lot of the problems you normally have to tweak in network code, will be non-issues. A colleague wrote a sphere based car controller, so this might be a fit.
    Mixed local and remote multiplayer is an option. Replays are possible. There is an option to use a tournament server.

    Use the "Contact Us" button on the Quantum page, so we can setup your account. There is a trial month and material you can check out to have a look.