Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

SeamlessTravel: How does server know all clients are ready?

I'm trying to build a lobby/game configuration system that gathers users, and when the configuration is ready, start the game. I call SeamlessTravel on the server as a console command. I presume that all clients will follow this server and also load the target map.

However, how do I, on the server, know that all players have actually connected and are ready/replicating? I was thinking I could have each client send a to-server RPC when they start playing the level. However, if I wait for a message from a client, then if a client is faster at loading a map than the server, then the clients may send the message before the server is ready.

Or does "seamless travel" just take care of all this for me?

Product Version: UE 4.9
more ▼

asked Sep 09 '15 at 03:56 AM in Blueprint Scripting

avatar image

1.3k 48 42 88

avatar image State128 Jan 19 '17 at 12:16 PM

Hi! I have a system with a dedicated server and had the problem of knowing when the clients are ready to receive replication etc. My solution is that I replicate a test variable (an integer) and then let the client answer on On_Rep to the server "ClientIsReady" (server, reliable). When all the clients are ready i setup all relevant data from my preplan phase.

It works perfect and is stable.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

alt textSo, the answer I'm going with, is polling "Num Travelling Players" until it goes to zero. It's not perfect, but I can make it work. (Draw-backs includes that entities will be ticking while I'm still having the loading screen down.)

This is from my GameState blueprint; SetupPlayers is called from Event Begin Play in the Level Blueprint.

more ▼

answered Sep 10 '15 at 04:00 AM

avatar image

1.3k 48 42 88

avatar image lotodore Dec 19 '16 at 04:12 PM

I am also struggling with this, and I could not find any event which marks when it is done. However, this workaround does not work for me, because it seems even if "Num Travelling Players" is 0, there is still some replication ongoing. I can only make it work through an additional delay, which feels bad.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I know this question is fairly old but I noticed that there isn't any answer here that doesn't rely on a poll.

I think the best way to tackle (as you mention in a comment) is via a GameMode callback.

Unreal's client-server model is focused around the concepts of worlds and their GameModes. A dedicated server will sit listening on a particular map with a GameMode loaded. When connections happen, the GameMode gets the chance to reject or accept connections with PreLogin, available when deriving AGameModeBase in C++ (this is probably also available in BP but I'm not sure of it).

After PreLogin is accepted we get PostLogin which will happen for you in the Lobby and I guess this is what is how you are detecting to initiate the Seamless Travel.

I think the callback that you are looking for is called HandleStartingNewPlayer. According to the GameMode docs, it is:

Called after PostLogin or after seamless travel, this can be overridden in Blueprint to change what happens to a new player. By default, it will create a pawn for the player.

So overriding this will give the server a notification after a seamless travel has occurred.

Sam Pattuzzi - Co-instructor on the Udemy's Best Selling Unreal Course

more ▼

answered Aug 10 '17 at 03:17 PM

avatar image

11 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Without just copying a pasting this answers everything.... https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Travelling/index.html

Have you checked into the advanced sessions plugin if your using bp's only? It gives you some additonal BP exposed OSS stuff but not a check "are all clients connected" AFAIK

youd probably want to have a game instance or player state boolean make sure everyone is in the level somehow maybe a get all start points and check if characters are overlapping, thats be my half-assed solution.

Let me know if this helps Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

more ▼

answered Sep 09 '15 at 04:14 AM

avatar image

1.8k 67 27 137

avatar image jwatte Sep 09 '15 at 09:30 PM

Thank you. I had read that documentation already. Unfortunately, it doesn't answer my question. In fact, it claims that ServerTravel is asynchronous, and thus it just makes the problem even worse -- the server may have some clients connected that are on a previous map and haven't yet received the notification to travel to the transition map (and then the new map.)

Is there any callback in the GameMode or level or whatever when a player has completed transitioning?

The only other solution I can think of includes the map telling the player (on the client) to set a "my currently loaded map" string on the player state. The server could then poll this state for all players until it's the correct value for all the players. That seems ... inelegant. Given that the server already knows when all players have traveled to the transition map, there has to be some notification I can tie into.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question