HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: Printout of Lobby System Status  (Read 2018 times)


  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Printout of Lobby System Status
« on: Jun 14, 13, 10:05:56 AM »

I have been working on the Lobby System for some days now, and to make the changes I make to the system more transparent, I wrote this method for the server $_LOBBY system node.
  • Create a server class.
  • Use the System Nodes Configuration GUI to glom it onto the server $_LOBBY system node.
  • Add the method below to that class methods script.
  • (Optional) Create a server command to call that method.

Code: [Select]
remote method EchoLobbySystem()
  where me is kindof _LobbySystem
    //First call the Control Instance:
    if not (me._IsLobbySystemControlInstance() or me._IsLobbySystemWorkerInstance())
      call area me._GetLobbySystemAreaID() instance 0 me.EchoLobbySystem()
    msg as String
    LLD as NodeRef of Class _LogicalLobbyDirectory
    LD as NodeRef of Class _LobbyDirectory
    lobby as NodeRef of Class _Lobby
    presenceLobby as NodeRef of Class _LogicalLobbyDirectoryPresenceLobby
    playerName as String
    LWL as NodeRef of Class _LightweightLobby

    //From the control instance, call each worker instance:
    if me._IsLobbySystemControlInstance()
      msg = "$RControl Instance$R LW Directories: "+me._lightweightLobbyDirectoryMap.length+"$R"
      foreach HWLDid in me._lightweightLobbyDirectoryMap
        msg += "  HW Lobby Directory ID: "+HWLDid+"$R"
        foreach LWLD in me._lightweightLobbyDirectoryMap[HWLDid]
          if LWLD != None
            msg += "   LW Dir ID: "+LWLD._lobbySystemEntityUniqueIdentifier+" _replicationGroupRef: "+LWLD._replicationGroupRef+"$R   Server Destinations:$R"
            //Cannot call LWLD._GetReplicationGroup() because LWLD is a proxy node (replicated here)
            //and _GetReplicationGroup is not labeled to work for proxied nodes.
      msg += "$R LW Lobbies: "+me._lightweightLobbyMap.length+"$R"
      foreach LWLid in me._lightweightLobbyMap
        LWL = me._lightweightLobbyMap[LWLid]
        if LWL != None
          msg += "  LW Lobby ID: "+LWL._lobbySystemEntityUniqueIdentifier+" _replicationGroupRef: "+LWL._replicationGroupRef+"$R   Server Destinations:$R"
          //Cannot call LWL._GetReplicationGroup() because LWL is a proxy node (replicated here)
          //and _GetReplicationGroup is not labeled to work for proxied nodes.
      //Call on each other instance:
      loop i from 1 to me._GetLobbySystemMaxWorkerInstances()
        call area me._GetLobbySystemAreaID() instance IntToId(i) me.EchoLobbySystem()
    msg = "$RLobby System Instance: "+GetInstanceNumber()+"$R--------------------------------$RLogical Lobbies:$R"
    //Now we are on a worker instance.
    foreach LLDid in me._lobbySystemLogicalDirectoryMap
      LLD = me._lobbySystemLogicalDirectoryMap[LLDid]
      msg += "--"+LLD._lobbyDirectoryName+"["+LLD._lobbySystemEntityUniqueIdentifier+"]$R"
      //Presence Lobbies:
      msg += "   Presence Lobbies:$R"
      foreach lobbyID in LLD._logicalLobbyDirectoryPresenceLobbyIDMap
        presenceLobby = LLD._logicalLobbyDirectoryPresenceLobbyIDMap[lobbyID]
        msg += "    "+presenceLobby._lobbyName+"["+presenceLobby._lobbySystemEntityUniqueIdentifier+"]$R     occupants: "+presenceLobby._lobbyOccupants.length+"/"+presenceLobby._lobbyPlayerCapacity+"$R"
        foreach pnid in presenceLobby._logicalLobbyDirectoryPresenceLobbyPlayerNames
          playerName = presenceLobby._logicalLobbyDirectoryPresenceLobbyPlayerNames[pnid]
          msg += "      "+playerName+"["+pnid+"]$R"
        msg += "    -----$R"
      msg += "   Directories ("+LLD._lobbyDirectoryMap.length+"):$R"
      foreach LDid in LLD._lobbyDirectoryMap
        LD = LLD._lobbyDirectoryMap[LDid]
        msg += "    "+LD._lobbyDirectoryName+"["+LD._lobbySystemEntityUniqueIdentifier+"]$R     lobbies ("+LD._lobbyDirectoryLobbyMap.length+"):$R"
        foreach Lid in LD._lobbyDirectoryLobbyMap
          lobby = LD._lobbyDirectoryLobbyMap[Lid]
          msg += "      "+lobby._lobbyName+"["+Lid+"]$R       occupants: "+lobby._lobbyOccupants.length+"/"+lobby._lobbyPlayerCapacity+"$R"

      //Lobby public (displayable) data:
      //TODO (?)
      msg += "***********************************$R"

This is just something I wrote off the top of my head, and could probably be improved.  I have not tested it fully in all cases, particularly when players are in lobbies.

Feel free to use it.
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.