Search Unity

Multiplayer using Firebase RealTime db.

Discussion in 'Getting Started' started by Isheta, Nov 30, 2019.

  1. Isheta

    Isheta

    Joined:
    Aug 9, 2019
    Posts:
    4
    Hi,

    Me and my friends are trying to develop a game which requires a real time feature.
    So, lets assume for a second that the game works somewhat like Clash Royal, which
    means that each game room has 2 clients placing soldiers attacking each other.

    So I thought, as a daytime backend teamleader, that we can use Firebase real time database for the syncing and Cloud Function (another feature of Firebase) for the matchmaking.

    So my question, as a new game developer, is how the syncing works?
    So for example i can send each "spawn" event for both clients. but 1 client has a lag of 60 and the other has a lag for 1000.
    So how the synchronization works here when a client A's solider hits a client B's solder and both clients see the same thing? because as far as for client B, the A's solider hasn't gotten to client B's solider.. (because client B sees everything in a higher lag than A's)
    Assume that I dont want to sync every movement and every solider hit from the Firebase because it will cost A LOT (for example syncing positions 3 times a second)

    Another option im investigating is to host (i have no idea how or if its even possible) the game on the cloud and 2 clients are some sort of spectators with "spawn" privileges.
    Is there any guide for this or any advice of how to make this work?

    Clash Royal (a game by Supercell) obviously works AMAZING with this and every movement and every hit is deterministic.

    Ill provide more data and information if required.

    Thanks Alot,
    Ori.
     
    Last edited: Nov 30, 2019