create room's server-side

sorry, my english is not very good.
I have disabled, that the user can create room's. I wish to create room's only server-side.
if I start the server I wish to create 10 room's instantly, but I can't find a way.

can you help me?

EDIT: I have another little question ;)
I wish to create a bomberman game with lobby, account system and npc's.
it's a good idea to create a "dummy player" for every room? if playing 4 players in a
room, there are a 5. dummy player (local unity instance on the server-hosting computer).
this 5. dummy player handles as master-peer and handles the npc's and handles
some anti-cheat routines. I ask this question, because I need a robust and
secure client-server architecture. for example I wish to instantiate all prefabs
server-side/dummy-player-side. players can collect ingame gold and buy items.
it's important to have a cheat-free ingame-economy.


  • What's the difference if a room was created server-side? It means work and problems but I think it won't feel different.

    You should try random matchmaking, which will make sure rooms get filled the fastest way possible. If none is available, random match fails and the client who wants to play creates one.

    You need to get accustomed to server-side programming with Photon to achieve the other goals. It's all possible and a "simple" logic like bomberman should be possible to implement in Photon / C#, without running dummy clients. Check the Room class in the LoadBalancing Application, where you could place logic.

    Server SDK:
  • the difference is, the client has no control over the room. I don't wish to give a client the authority.
    if a client creates a room, he can manipulate the network packets and (for example) create a room for 20 players instead of 4.

    it's important to handle all stuff server-side, except the player movement and collision.
    I'm not sure, if the (photon) unity network plugin the right choice.
    or I have too many concerns about the security?
  • If security is the only concern, then you could just send the createRoom operation encrypted.
  • So far, we didn't worry about that "20 instead of 4 players" scenario, even though it's valid.
    Sooner or later we will have to add a checksum or even use encryption. The bad thing is: If you want to hack this, you could still do it in-memory and then it still gets into the message.

    I fear we can't brace the Photon Cloud for all eventualities and come up with some way to administer all that.
    To get more security in, you can only host the servers yourself. Then you have full control of what you allow and what's considered hacking, cheating or malfunctioning.
  • haha, oh no! we have a misunderstanding!
    i already use my own photon server.
    my question is, how do I create rooms on my own photon server.
    i'm not an absolute beginner. i have already created a login and character
    creation/management system with mysql for the photon mmo demo.
    but, the photon server code is very difficult to understand for me. it is all very nested.
    i cannot figure out how to create a room, on my own server photon.
    now, you can help me? ;)
  • i created this new public method in AppLobby.cs:
    public bool CreateEmptyGame()
       IncomingGameServerPeer gameServer;
       if (!this.LoadBalancer.TryGetServer(out gameServer))
          log.Error("Vampir: Try Get Server Failure");
          return false;
       GameState gameState = new GameState(Guid.NewGuid().ToString(), (byte)this.MaxPlayersDefault, gameServer);
       if (this.schedule == null)
           this.schedule = this.ExecutionFiber.Schedule(this.PublishGameChanges, 1000);
       return true;

    i call this function in MasterClientPeer.cs:
    case OperationCode.JoinLobby:
       if (lobby.CreateEmptyGame())
          log.Info("Vampir: Empty Server Created");
          log.Error("Vampir: Create Empty Server Error");
        this.lobby.EnqueueOperation(this, request, sendParameters);

    i can read in the logfile:
    "Vampir: Empty Server Created"

    but there is something wrong. the room will not be listed in my (unity) game lobby. if i create a room in unity, he will be listed.
  • Games are only listed in the application lobby if they have been created on the game server instanz.
    We decided to implement it this way to ensure that the client who created the game game on master is the first who creates the game on the game server instanz. Otherwise it is possible that another client with a better network connection tries to join a room on the game server which hasn't been created yet.
    If you don't care about which client is the first who joines the game on the game server instanz you can modify the following property in the GameState class.

    public bool IsVisbleInLobby
    return this.IsVisible && this.IsCreatedOnGameServer;