IOnlineSession::StartSession blocking joins?

In the lecture, the instructor says that StartSession will prevent others from joining. And as in the video, once the session has started, I can’t find it anymore, and thus I can’t join it.

However, if I did find the server before it started, I can still join it at any time. Is that expected?

It’s easy enough to fix by overriding the PreLogin function of the PuzzleGameMode to deny it, and overriding it again in the LobbyGameMode to overrule the deny.

But is that the way to go or is there a simpler solution?

It does depend on the type of game. For some games, they do allow for players to come and go, others do start with a fixed number of players. Online matches in fighting games such as injustice would be a good example of the latter and some match games like titan fall 2 do sometimes add players in mid game when the teams are unbalanced do so someone losing connection or whatever reason.

This would be down to game mechanics and so implementation specific.

As you were so insistent of telling me in the other discussion, what matters is what the lecture is trying to do :wink:, which is to block new players once the game has started.

But I give you that what the lecture is trying to do is not typical. For instance, as far I can remember, multiplayer servers don’t hide once they are full, they still show in the list. This makes sense, since it’s better to show a list full of popular servers, rather than an empty list which gives the impression that the game is dead multiplayer-wise.

As for allowing to join mid-game, a server must first be discoverable to do that. Which again, is the opposite of what the lecture (seemingly) does. Based on the little documentation there is, I do feel that calling StartSession is right, and that the fact that it hides the server from the search is more likely a setting somewhere.

All that said, none of it really answer my questions. Maybe I can rephrase them too. Are the sessions the main place to block new players? Or is it pre-login? Where is the threshold where the session’s responsibilities end and where the pre-login’s start?

For dedicated servers, I would 100% agree with you but this isn’t dedicated servers. The course doesn’t cover those and there are legal reasons for that - it was explained to me and it is complicated.

Once a match has started, and this is what happens towards the end of section 3, the host does lock the game which effectively removes it from availability. You are also right that this may not be the desired effect - you could leave the game available and show only those available to join so if a player drops, it could be joined again which it actually doesn’t allow as it stands. I would argue however, if a game became popular that the list of games could be huge so it may not practical or feasible to show all matches - so showing what matches have available slots does suit.

I do assume it was a design decision for the course and like I said, it suits games like Injustice or actually Killer Instinct on the Xbox One for example in which games only have 2 players. Once 2 players are in, it makes no sense for this type of game to expose the match to other players and if the if a player drops, the game ends. It is a slightly trickier implementation so perhaps this was why it was done this way. This is unless you wanted to add some sort of spectator mode.

All these things that both you and I have mentioned do depend on what you want your multiplayer mechanics to be like and those mechanics may not suit other games.

I hope this makes sense. Again, as always this is my opinion and I appreciate that yours may be coming from a different angle so really, this is all subjective.

Why the distinction? I don’t see why that would matter. If I see few servers, I do not know if it means that most servers are full, or if there are just few of them. It’s even worse for this course’s game since the server disappear when the game is in progress as well.

That’s my point: it does not lock the game. It just makes it undiscoverable as far as I can tell. If one is already discovered, it can still be joined mid-game.

For that matter, I could even have 4 players in my 3-player-max game:

  • In the course’s github, change NumPublicConnections to 3
  • Start 4 game instances
  • Start the host with one instance
  • Have all 3 other instances discover the server
  • Have one of them join the server
  • Wait for the server to timeout and load the main map
  • Have the remaining 2 instances join the server

→ You have now 4 players in your 3-player game supposedly locked with 2.

I guess then that would be a bug with the engine if you set connections to 3 and it allows 4. Is this the NULL OSS or steam at this point?

I’m using the NULL subsystem (I don’t have 4 computers to run 4 steam accounts :stuck_out_tongue: )

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.