Announcement

Collapse
No announcement yet.

PostSeamlessTravel Network Synchronization

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

    PostSeamlessTravel Network Synchronization

    Hi Everyone,

    I have a couple networking questions I am hoping to get help with.

    A little background: I am making a two player game using a listen server architecture implemented in mostly blueprints (and some C++ when absolutely necessary.) In the game there is a shared multiplayer lobby. After both players have joined the lobby ( and made appropriate settings selections ), I use seamless travel to transport both characters to the main game map. Also currently I am using the steam online subsystem.

    The problem: I want to have two barriers (static mesh actors) in my main game map that disappear at the same time on client and server. For this example I want them to disappear five seconds after both players are fully loaded in the map so the players can engage with each other at the same time. I need to ensure I know exactly when both players are loaded in the map and the map is fully loaded on both client and server, before starting the countdown on the server to start the game. I also need to ensure that both barriers are aware of the countdown so that they can display it to their respective player.

    Issue/Question 1:
    Currently I have overridden the HandleNewStartingPlayer event in my game mode to see when both players are spawn in the map post seamless travel.

    Is this the appropriate method of determining if all players are loaded in the map post seamless travel in blueprints? I have also tried exposing the PlayerController's C++ function HasClientLoadedCurrentWorld(). By the time that HandleNewStartingPlayer has been called, this seems to always return true. So I believe at this point I can rely on all players loaded in map.

    Issue/Question 2:

    This leads me to my next question: At this point can I rely on all the actors in the level being loaded on both client and server? If so, will this effect replication of these actors. I seem to be getting issues with that regard.

    My Setup: The timedown barriers are currently placed in the main game level. The Barrier BP is set to replicate and I also have the barrier instances set to Net Load on Client. I have two variables, timeRemaining, isAvtivate, in the BP, and I am setting them in the game mode.

    My understanding is that setting these onreplicated variables via the game mode should set them on the server, replicate them to the client, and their corresponding on replicate functions will be called on both client AND server. The issue I am having is that each time I start my game and run through a game loop sometimes the clients version of the on replicate function gets called, but then other times I run the game loop it does not. It works about 70% of the time. Each time I run the loop it either works fully or it does not.

    I am wondering its possible that, on occasion, the timebarrier actors that are in the level are not fully loaded on the client at the time I call the replicated functions (even though the player is loaded)?

    If anyone has tips or suggestions about how to synchronize these persistent level actors I would be extremely grateful.

    Thanks!

Working...
X