Search Unity

Tekken Styled Fight Game Network Strategy?

Discussion in 'Web' started by ippdev, Sep 16, 2021.

  1. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    I am creating the network PvP framework for a fight engine that will run on WebGL using PUN and WebSockets. I have the two opponents fighting already. The way I understand it is I put a desktop version of the game on the server and the clients are the WebGL players. During regular arcade play with player versus AI driven NPC I have a reactive procedural IK block and strike system and a large Mecanim graph. During networked Player versus Player I imagine I would disable the whole fight system on the clients and update the rig transforms over the network as derived from the game running on the server. I foresee the sequence of steps per frame to be something like this...

    1.Get Inputs per client, if any, sent to server instance.
    2. Server instance receives inputs.
    3. Fight engine processes inputs.
    4. All subsystems, such as Damage, Recovery, EFX resolve themselves to their new state per frame.
    5. Relevant rig transforms are recorded per client on the server instance.
    6.Server rig transforms are sent to each client to update the rigs pose and position/rotation.
    7.Client subsystems data updated from server instance state.
    8.Repeat 1-7 on next frame.

    Sounds like plan..but..given network lag and a block or strike may occur in .25 seconds how can I be assured both WebGL client instances are synced?