[Feature request] Create a game without joining

lazalong
edited September 2011 in Photon Server
Hey

I would like to create peers (such as a "Game Administrator") that can create games and let other people join the game. Not necessarily the peer creating the game.

But in the LoadBalancing code when creating a game the GameState.IsCreatedOnGameServer is set to false. However this makes the game not visible in the lobby until the game state is updated. This means that the peer that created the game is obliged to join this game (and hence trigger an update).

Is there a reason why the peer creating the game must join?

Note that I didn't try to change the GameState.IsVisibleInLobby() as I am perhaps missing something essential.
public bool IsVisibleInLobby
{
      get
      {
         return this.IsVisible; //  && this.IsCreatedOnGameServer;
      }
}

If this doesn't work could you let the peer being able to create games visible in the lobby (the peer can join if he wants to in a second operation)?

Of course, you can still have the current behavior, by creating game not visible in the lobby and the peer knowing the gameId can still join it and set it visible.

Thanks

Comments

  • Im not sure if I get your usecase: You want to create games that are in the lobby, even before anyone joins them?
    In this logic, rooms don't exist, unless someone is using the room.
    An alternative might be to have a list of room names that can be edited by your admin. Any room in this list (but not in the "existing rooms" list) could be added into your lobby's "existing rooms" list with 0 players. Make clients create a room which has 0 players, instead of joining.
  • Tobias wrote:
    Im not sure if I get your usecase: You want to create games that are in the lobby, even before anyone joins them?
    Nearly. I want the GameState to be visible in the lobby.
    The game / room can still be created when the first user enters it.
    Make clients create a room which has 0 players, instead of joining.
    Mh... that's what I am -nearly- trying to do. But I don't see yet how to do it.

    I don't see where in the sequence you can create them and make them visible without joining first. See the sequence diagram of how you create game states and the only place where IsCreatedOnGameServer is set to true.

    PS: you have a typo as you have GameState.IsVisbleInLobby instead of GameState.IsVisibleInLobby ;)
  • Ouch... I just saw that LiteGame.HandleJoinOperation() has those lines:
    // set game properties for join from the first actor
    if (this.Actors.Count == 1 && joinRequest.GameProperties != null)
    {
            this.Properties.SetProperties(joinRequest.GameProperties);
    }
    

    Which complicates sligthly my use case...
    Mh... I would have set those game properties not on a join event but on the create action, no?
  • For my idea you need to modify the server:
    a) add a list of room-names and make it editable with fitting operations.
    b) before the lobby sends out the room-names to clients, amend the names of the new list, if they are not already listed (because the room is non-empty)

    The clients get the user-count per room, if Im not mistaken, so each client could decide to create the listed room if it has 0 players.