Announcement

Collapse
No announcement yet.

Cannot get Travel to work properly

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Cannot get Travel to work properly

    Dear Sirs,

    I have a problem. I'm working on a multiplayer game right now that is using UE 4.14.1. We're sticking to C++ (not templates) for most of the development.
    We've started implementing a barebone multiplayer based on the ShooterGame.

    Just like the shooter game, we have our GameInstance (GI) call methods within our Session class / instance, with backpropogation of callbacks.
    We have our Menus done in 3D, so we have a game mode for that. When a player chooses to host a game from the menu, the MenuGameMode calls on GI to host a session. The code for that is basically identical to the shooter game, i.e. in the FinishSessionCreation method of the GI we call
    Code:
    GetWorld()->ServerTravel(TravelURL);
    When we test this in the editor, the hosting (server) instance of the game transitions to a different map, which switches it from MenuGameMode to ArenaGameMode.

    When the "joining" player on the other machine chooses to join a game from the menu, the same operations for FindSession and JoinSession are used as in the ShooterGame.
    As a result of joining the session, this travel function is called from the joining GI:
    Code:
    PlayerController->ClientTravel(URL, TRAVEL_Absolute);
    We know the connection succeeds, i.e. we can see "Sending hello" to the IP of the hosting machine in the logs.

    However, for the joining player nothing changes, i.e. he remains in the menu and does not transition to the other map.

    Now, we have PreLogin and PostLogin implemented for our base GameMode class, the code is exactly the same as in the ShooterGame.
    However, these functions are not getting called on the hosting machine when the other player is joining.

    What am I doing wrong?

    P.S. some background: we're running both instances of the game from within the editor. We cannot do the same for the ShooterGame in its current state and try to trace its logs, since trying to host or join while running it from the editor crashed every time so far.

    #2
    Starting a Server is not made by calling "ServerTravel".

    "ServerTravel" is used in an existing connection to let the "Server Travel" from the current to a new
    Map and let him tell the clients to follow.

    The initial call to start a Server can be done via "OpenLevel" function with a "?listen" option, to make
    sure he's a ListenServer.
    Open for contracted work | C++/BP (incl. Multiplayer) | Tutoring | VR

    My UE4 Blog/Page with Tutorials and more: Hit me for ALL the things!
    (Including 100+ Pages Multiplayer Network Compendium to get you started.)

    Comment


      #3
      Originally posted by eXi View Post
      Starting a Server is not made by calling "ServerTravel".

      "ServerTravel" is used in an existing connection to let the "Server Travel" from the current to a new
      Map and let him tell the clients to follow.

      The initial call to start a Server can be done via "OpenLevel" function with a "?listen" option, to make
      sure he's a ListenServer.
      Thanks, @eXI. We did get the multiplayer to work at this point, without changing virtually anything in our code. Somehow, ServerTravel did work out (OpenLevel is not used anywhere in the ShooterGame, btw). It turns out there was no bug at all on our end. All we needed to do was to host a standalone game instance instead of running our game from the editor. We'll try it with the OpenLevel instead, though, to see if that works from within the Editor, so we can test things more efficiently.

      I'm still baffled as to why an in-editor run vs. standalone game instance would have such a dramatic difference on multiplayer functionality. It seems like there might be a bug in the editor.

      Comment


        #4
        I'd guess the difference is the Multiplayer Options of your Play in Editor settings (drop-down menu attached to the Play in Editor button, then click Advanced Settings). In this panel, there's a down-arrow to expand a brief description of how the settings are configured.

        What does yours say? Something like "The editor will run as a listen server."?

        Comment

        Working...
        X