x

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"

Lobby beacons: is the host a client?

Hi everybody!

I try to implement a lobby system with Steam in my online multiplayer game. This is what I want to do:
- A player can create a lobby from the game menu, without any map transition
- He can invite friends to join his lobby
- Friends can join the lobby without map transition, and see information about lobby members (nicknames, ranking, etc.)
- The owner of the lobby can find a match online, and every player in the lobby follows him

Here is my process:
- I spawn a LobbyBeaconHost and I call the Init function on it
- I call the SetupLobbyState function and call the StartLobby function on it
- I create a Steam session, so other players can see it
- I spawn a OnlineBeaconHost, in which I setup the BeaconState to AllowRequests
- I start my OnlineBeaconHost with the InitHost function and I add to it the previous LobbyBeaconHost (with the AddHost function)

From what I understand, I think that my lobby is created and now accessible for other players.

So, I successfully created a lobby on a client, I can invite friends, and they can join my lobby.
The thing I don't understand is when I check the GetNumPlayers() function in my LobbyState: when I'm alone in the lobby, it returns 0, and not 1, as I first expected. If a friend joins me, the function returns 1.

So my question is: does the owner of the lobby beacon have to connect to his own lobby?
If this is the case, how can I do this? I tried it by calling the ConnectToLobby function in the LobbyBeaconClient of the session owner, but it resulted in a Time out, so I assume this isn't possible?
If I don't have to do this, then is this normal that the GetNumPlayers() function returns the wrong number of players? How can the other players can access the owner of the session then?

There are probably some concepts that I missed in the lobby beacon system, but since there is almsot no documentation, I'm stuck on this right now :(

Could someone help me?
Thanks!

Product Version: UE 4.13
Tags:
more ▼

asked Jan 05 '18 at 08:04 AM in C++ Programming

avatar image

Syalen
126 5 9 12

avatar image Syalen Jan 09 '18 at 09:09 PM

I'm still stuck on this :(

avatar image RJS Jake Apr 22 '19 at 05:46 AM

Got stuck at the same thing too. Any news on this matter OP ?

avatar image Syalen Apr 23 '19 at 10:58 AM

I switched to UE 4.21 recently, and I plan to use the Steam Party plugin to handle this properly.

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

2 answers: sort voted first

I updated my engine to 4.21.2, and I'm now using the Steam Party plugin, so this question isn't relevant anymore.

more ▼

answered Jul 17 '19 at 11:18 AM

avatar image

Syalen
126 5 9 12

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

If you don't have a dedicated server and your host is working as a listen server then you are both a client and server, since you created the session you don't have to join, you are already in, check out the FOnlineSessionSettings->settings and read the NumPrivateConnections and NumPublicConnections, with those two you can display the amount of players connected to your session. I'm not experienced with Online Beacons but what I did to go around this was to use custom settings on my sessions, to do this I created a session with settings like settings.Set(TEXT("SETTING_CUSTOM_PARAM"), CustomSetting, EOnlineDataAdvertisementType::ViaOnlineService); and since Steam passes them every time you search for sessions then players that lookup for your sessions will have this information available without using a beacon, you only need to call FOnlineSessionSteam::UpdateSession whenever you want to update the session info.

Also I think the purpose of Online Beacons are to have them InGame so that players can lookup the match info and join once the session has already started.

more ▼

answered Jan 05 '18 at 08:52 AM

avatar image

virtual_nomak
361 16 17 25

avatar image Syalen Jan 05 '18 at 09:09 AM

Thanks for you answer!
I'm not sure to understand what you're saying.
You're suggesting to give up on beacons and to use the session settings instead? If I do this, my clients will have a loading time while joining the session, no? Or they don't have to join it? Then how do they notify things like "I leave the lobby" in case of alt-f4 or connection errors?
For me the main reason I use beacons is the "clients will follow the host if he joins a game" part. Do you know if there is a way to do this without beacons?
Maybe I misunderstood you, though.

avatar image virtual_nomak Jan 05 '18 at 09:51 AM

Sure! I'm suggesting you that instead of using the beacons you share the session/room info with the OnlineSessionSettings, as a host you will create and join a session so if players want they can list the session info from the main menu without having to join the host at all. They won't have any loading time (besides waiting for Steam to retrieve the session data as you would normally would anyway).

If a player joins the session the FOnlineSessionSettings will update the NumPrivateConnections and NumPublicConnections automatically, also the PostLogin method will be called and if someone leaves the Logout/EndPlay method will be called depending on the situation.

As for "clients will follow the host if he joins a game" that's what I meant by the beacons are mostly used for joining a player inside of a session that has already started, if that's what you want to do then Beacons are definetely the way to go, but of course you can also use them for sharing the session info, in the end it's all up to you.

avatar image Syalen Jan 08 '18 at 09:04 PM

"If a player joins the session" <-- This will result in a map transition. Furthermore, I want my clients to follow the host when he's travelling to another server, so I think your solution isn't what I want. Thanks anyway :)

avatar image virtual_nomak Jun 25 '18 at 03:39 PM

Believe it or not I'm coming back to this, you are right, what I said was wrong. I'm also using the Lobby beacons right now and you indeed need to join your Lobby with the host by creating a ALobbyBeaconClient and calling the ConnectToLobby method. My problem right now with this is that my LobbyState and LobbyPlayerState aren't being replicated, I even made sure to setup the lobby state after I registered the ALobbyBeaconHost.

(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