Game Development Community

Custom Server Info

by Electrk · in Torque 3D Beginner · 02/27/2013 (7:25 pm) · 9 replies

How do I edit the game so that the Join Server GUI shows things besides Name, Ping, Players, Map, etc.?

#1
02/27/2013 (10:34 pm)
In Engine\source\app\version.h at line 14:
#define TORQUE_GAME_ENGINE          1100
Change this and rebuild.
#2
02/27/2013 (11:33 pm)
thanks
#3
02/28/2013 (12:13 am)
What if I wanted it to show something else? Like appversion in torqueConfig.h or if I wanted to have a server variable called $Game::Version or something?
#4
03/01/2013 (8:45 am)
Electrk: Everything you're wanting to modify in regards to the stock game server browser can be found in game/art/gui/joinServerDlg.gui. There you can see that both the GUI control layout and operation code of the user interface can co-exist. Everything below this inline marker will be preserved whenever you or anybody else modifies the Join Server Dialog within the GUI Editor:
//--- OBJECT WRITE END ---

The four important things you need to know about are that:
  1. queryMasterServer() is used to query the master server (by default it is master.garagegames.com:28002) to retrieve a list of games currently in session. queryLANServers() is similar in that it just does a broadcast request for active game sessions on however far broadcast packets goes on your local area network. Luckily their usage is well commented within JoinServerDlg::query() and JoinServerDlg::queryLan().

  2. onServerQueryStatus() is a callback from within the engine after using the two query function calls talked about above that updates the caller on the current query status. Of which upon "done" state in this case JoinServerDlg::update() will be called to cause the game server list to be populated.

  3. Within JoinServerDlg::update() the %sc = getServerCount() call is done to retrieve the number of game servers responded during the internal engine master protocol handling states of "start" and "done".

  4. Within the for() loop the function setServerInfo(i) is called to have the internal engine update the $ServerInfo global variable namespace with several variables associated with the server i out of %sc -1 because setServerInfo() is zero-index based. So the first server is 0(zero) and the last will be getServerCount() -1.

  5. $ServerInfo:: namespace has the following member variables:

    • Status
    • Internal engine query status on the game server. This is an integer value that makes use of bit stats to indicate the current status of the server.
    • Address
    • Public IP (IPv4) address of the game server host.
    • Name
    • Game server or session name.
      This is set via $pref::Server::Name global variable on the game server hosting side.
    • GameType
    • Short string name of the game being played. Most use is as a filter on master server queries so that other people's games won't show up in the results when multiple games share the same master server.
      This is set via $Server::GameType global variable on the game server hosting side.
    • MissionName
    • Name of the current mission, map, level, or whatever that the game server is currently hosting that the players are playing on or in.
      This is set via $Server::MissionName" global variable on the game server hosting side.
    • MissionType
    • Mission type string that states what kind of a mission it is. Examples are DM (Death Match), CTF (Capture The Flag), etc.
      This is set via $Server::MissionType global variable on the game server hosting side.
    • State
    • Current server operating state string.
      This is set via return in onServerInfoQuery() callback function on game server hosting side.
    • Info
    • Info string returned by the game server.
      This is set via $pref::Server::Info global variable on the game server hosting side.
    • PlayerCount
    • Number of real players currently in the game session.
      This is set via $Server::PlayerCount global variable on the game server hosting side.
    • MaxPlayers
    • Number of maximum players (not excluding bots) the game host will allow at a time.
      This is set via $pref::Server::MaxPlayers global variable on game server hosting side.
    • BotCount
    • Number of none real players in the game session. Typically these are AI Bots.
      This is set via $Server::BotCount global variable on game server hosting side.
    • Version
    • Current version of the game that the host is using.
      This is the same value as the internal engine source that the TORQUE_GAME_ENGINE C macro is set to.
    • Ping
    • Roundtrip latency in milliseconds.
    • CPUSpeed
    • Processor speed of the machine hosting the game session in MHz. This can be zero for most Mac OS X and Linux hosts as the x86 assembly code that sets this value is usually disabled in order to build Torque on such OSs.
    • Favorite
    • true that the local user has favorited the server in the past, else false when not.
      This flag is currently not useful as the internal support for server favorites aren't implemented.
    • Dedicated
    • true when ran as a dedicated server, false when a player is running it.
    • Password
    • true when password protected, false otherwise.
#5
03/01/2013 (9:01 am)
The engine source that makes all the above possible can be found in Engine/source/app/net/serverQuery.cpp. Good source file to read over in case you want to know about all what is involved when querying for active game sessions, well if you understand C/C++ that is.

The control used to list the game sessions is a GuiTextListCtrl and it is very limited in fuctionality. If you really want to provide more details in the server browser I suggest checking out GuiModernTextListCtrl that I created. as I designed it specifically for displaying complex row based information in a report view visual style. It currently isn't apart of the stock Torque 3D game engine, yet, so you will have to recompile the game executables yourself if you want to use the control by following the ReadMe.txt provided in the download zip file.

Have fun.
#6
03/01/2013 (6:57 pm)
Wow! Thank you for the detailed explanation! I really appreciate it.

EDIT: I changed the TORQUE_GAME_ENGINE variable and recompiled but it still says 1100 in the server list.
#7
03/02/2013 (6:39 am)
Are you sure you compiled both debug and release builds? I just did this myself and it worked fine - changed the TORQUE_GAME_ENGINE variable to match the "human readable" version value 2011 and it displays correctly in the server list.
#8
03/02/2013 (11:29 am)
I tried both and it still didn't work. I must be doing it wrong...
#9
03/02/2013 (12:41 pm)
I can't imaging it -
#define TORQUE_GAME_ENGINE          2011

www.roostertailgames.com/images/ver2011.jpg
<shrug>