Hello. Like title says, how should i add spectator players to my game? I just cannot add more playerSession to gameSession allowes me to. Can i somehow add more playersSessions to game or is it really fixed number? Should i add spectators to my matchmaking logic somehow and when i’m using party system i reserve xNum of playerSessions to spectators?
Firstly, you don’t have to use player sessions with GameLift - they are there as convience layer to manage/track connected players.
If your specters know the game session details then:
- They could connect directly as they have the ip and port for the session.
- You could modify your connection logic so they connect with with some special player identification that lets you know they’re a spectator (ie a one of claim code that starts with a known prefix etc) and bypass calling GameLift to accept the PlayerSession etc.
You could also as stated, provide a set number of slots ie 0-10 for spectators and let FlexMatch etc take care of this for you. The advantage here is that spectators are handled by your existing connection logic and GameLift will prevent too many joining etc.
I am working on a game with 2 players, but I wanna add spectators as well. I am trying to connect the spectators directly just using the ip and port, but gamelift seems to allow only 2 connections to the server. I can only connect a spectator if one of the players leaves the game.
I do not use gamelift as on now at least, but I feel like this could help. If your gamelift server can only have two people then it will not allow any more connections in, why not just do what Pip said sort of, and make it so more than two connections are allowed, but only two connections are allowed in with a certain claim code. After those two have been redeemed, just allow all others to join with a different claim code that shows they are spectators.