what should I do to let clients join to the host scene in online games

Options

hi , i'm about to get a membership in photon but i have one question before , I'm working on online game, and I'm facing an issue related to network management, what should I do to let clients join to the host scene, as you know normally they are spawning in different scenes but what happening is syncing their animation and transform, cuz i'm trying to make a random maps generator and if the client join to the host server it appears normally , but in a different map so please help me

Answers

  • Tobias
    Options

    Sorry, I don't know where to start. Could you break this down for us to help?

  • ziyad1160
    Options

     I'm trying to build an online dungeon game were the map gets generated randomly every round to make the game harder and impossible to memorize it by the players, I tried using mirror and phantom and still have the same problem , the host makes a scene and when the clients join they spawn in another scene and another dungeon map but i see the other players moving , but as i discovered they just sync the movement but every client have there own scene

    for example:

    this is the first player dungeon:

    and this is the second player dungeon:

    as you see there is a differences between each player dungeon , is there any method i can use to let the clients spawn in the same scene .

  • Tobias
    Options

    Have a look at the "Procedural Demo" in the PUN 2 package. It shows how to sync a seed for the random map generator and then generate the same map everywhere (this bit must be deterministic).

    That should be what you need.

  • I think you need to first to set this property to true, which helps the client joins the same scene as the host

    PhotonNetwork.automaticallySyncScene = true

    then, let the host load the level and check if this level is completed loaded.

    StartCourtine(LoadScene(int _sceneIndex))

    private IEnumrator LoadScene(int _sceneIndex)

    {

    {PhotonNetwork.LoadLevel(_sceneIndex);

    while(PhotonNetwork.LevelLoadingProgress < 1){

    yeild return new WaitForEndFrame(); //Delay

    }

    }

    // now you can safely instantiate the players