Game Development Community

Determining Server Status?

by Bruce Wallace · in Torque Game Engine · 03/22/2003 (1:13 pm) · 3 replies

Hello,

I am looking for information on resolving a server's status.



Is the Server::Status variable still being used at all?

The setServerInfo function returns a ServerInfo::Status that ends up being a number.

1073741825 was returned.
then:
1073741827 (only differance was password flag was set)

I know flags are represented here but any information on decoding it would be appriciated.

thanks,

Bruce

#1
03/24/2003 (11:10 am)
But, that number is a symbolic constant. You need to find where the $ServerInfo::Status is defined. It's probably set to stuff like "Running" or "Warmup" or "Cycling", etc.

If that doesn't help, then it's probably broken and you'll have to fix it yourself :\
#2
03/24/2003 (11:20 am)
I believe that game\net\serverQuery.cc has the information you need. The number must be "decoded" to get to the individual bits.

The simplest way is to determine the bit you want to check, and then do something along these lines:

if(Server::Status & (1<<5))

(If you wanted to check the 5th bit).

You might be well serverd to bone up a bit on your binary math :)
#3
03/24/2003 (3:45 pm)
Thanks for the responses,

I took some time and reviewed binary math and in the end, I decided to bypass decoding that number to get the flags I was interested in. and just add some more variables to the setServerInfo console function as so:

Con::setBoolVariable("ServerInfo::Linux",info.isLinux());
      Con::setBoolVariable("ServerInfo::Responded",info.hasResponded());
      Con::setBoolVariable("ServerInfo::TimedOut",info.isTimedOut());
      Con::setBoolVariable("ServerInfo::Querying",info.isQuerying());
      Con::setBoolVariable("ServerInfo::New",info.isNew());

and looking further into the ServerInfo::State, I found that in common/server.cs the variable was being returned as "Doing Ok" in the following function. I changed that to $Server::Status as so:
function onServerInfoQuery()
{
   // When the server is queried for information, the value
   // of this function is returned as the status field of
   // the query packet.  This information is accessible as
   // the ServerInfo::State variable.
   return $Server::Status;
}
Hope this information helps someone, I have more digging to do.

Edit: forgot something
Bruce