mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-01-18 21:51:37 +00:00
- Add cvars cl_gamename, sv_heartbeat, sv_flatline so standalone games can customise their messages to the master server
This commit is contained in:
parent
0eb5d1720c
commit
67a8b273c2
6 changed files with 60 additions and 18 deletions
33
README
33
README
|
@ -110,7 +110,8 @@ New cvars
|
|||
cl_mouseAccelStyle - Set to 1 for QuakeLive mouse acceleration
|
||||
behaviour, 0 for standard q3
|
||||
cl_mouseAccelOffset - Tuning the acceleration curve, see below
|
||||
|
||||
cl_gamename - Gamename sent to master server in
|
||||
getserversExt query
|
||||
s_useOpenAL - use the OpenAL sound backend if available
|
||||
s_alPrecache - cache OpenAL sounds before use
|
||||
s_alGain - the value of AL_GAIN for each source
|
||||
|
@ -142,24 +143,27 @@ New cvars
|
|||
com_ansiColor - enable use of ANSI escape codes in the tty
|
||||
com_altivec - enable use of altivec on PowerPC systems
|
||||
com_standalone (read only) - If set to 1, quake3 is running in
|
||||
standalone mode.
|
||||
standalone mode
|
||||
com_basegame - Use a different base than baseq3. If no
|
||||
original Quake3 or TeamArena pak files
|
||||
are found, this will enable running in
|
||||
standalone mode.
|
||||
standalone mode
|
||||
com_homepath - Specify name that is to be appended to the
|
||||
home path
|
||||
com_maxfpsUnfocused - Maximum frames per second when unfocused
|
||||
com_maxfpsMinimized - Maximum frames per second when minimized
|
||||
com_busyWait - Will use a busy loop to wait for rendering
|
||||
next frame when set to non-zero value.
|
||||
next frame when set to non-zero value
|
||||
in_joystickNo - select which joystick to use
|
||||
in_keyboardDebug - print keyboard debug info
|
||||
|
||||
sv_dlURL - the base of the HTTP or FTP site that
|
||||
holds custom pk3 files for your server
|
||||
sv_banFile - Name of the file that is used for storing
|
||||
the server bans.
|
||||
the server bans
|
||||
sv_heartbeat - Heartbeat string sent to master server
|
||||
sv_flatline - Heartbeat string sent to master server
|
||||
when server is killed
|
||||
|
||||
net_ip6 - IPv6 address to bind to
|
||||
net_port6 - port to bind to using the ipv6 address
|
||||
|
@ -354,9 +358,26 @@ Creating standalone games
|
|||
|
||||
+set com_homepath <homedirname>
|
||||
|
||||
to the command line. Example line:
|
||||
to the command line. Then you can control which kind of messages to send to
|
||||
the master server:
|
||||
|
||||
+set sv_heartbeat <heartbeat> +set sv_flatline <flatline>
|
||||
+set cl_gamename <gamename>
|
||||
|
||||
The <heartbeat> and <flatline> message can be specific to your game. The
|
||||
flatline message is sent to signal the master server that the game server is
|
||||
quitting. Vanilla quake3 uses "QuakeArena-1" both for the heartbeat and
|
||||
flatline messages.
|
||||
The cl_gamename message is for dpmaster to specify which game the client
|
||||
wants a server list for. It is only used in the new ipv6 based getServersExt
|
||||
query.
|
||||
|
||||
Example line:
|
||||
|
||||
+set com_basegame basefoo +set com_homepath .foo
|
||||
+set sv_heartbeat fooalive +set sv_flatline foodead
|
||||
+set cl_gamename foo
|
||||
|
||||
|
||||
If you really changed parts that would make vanilla ioquake3 incompatible with
|
||||
your mod, we have included another way to conveniently build a stand-alone
|
||||
|
|
|
@ -100,6 +100,8 @@ cvar_t *cl_guidServerUniq;
|
|||
|
||||
cvar_t *cl_consoleKeys;
|
||||
|
||||
cvar_t *cl_gamename;
|
||||
|
||||
clientActive_t cl;
|
||||
clientConnection_t clc;
|
||||
clientStatic_t cls;
|
||||
|
@ -3169,6 +3171,8 @@ void CL_Init( void ) {
|
|||
// ~ and `, as keys and characters
|
||||
cl_consoleKeys = Cvar_Get( "cl_consoleKeys", "~ ` 0x7e 0x60", CVAR_ARCHIVE);
|
||||
|
||||
cl_gamename = Cvar_Get("cl_gamename", GAMENAME_FOR_MASTER, CVAR_TEMP);
|
||||
|
||||
// userinfo
|
||||
Cvar_Get ("name", "UnnamedPlayer", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
|
||||
|
@ -3715,7 +3719,6 @@ void CL_GlobalServers_f( void ) {
|
|||
netadr_t to;
|
||||
int count, i, masterNum;
|
||||
char command[1024], *masteraddress;
|
||||
char *cmdname;
|
||||
|
||||
if ((count = Cmd_Argc()) < 3 || (masterNum = atoi(Cmd_Argv(1))) < 0 || masterNum > MAX_MASTER_SERVERS - 1)
|
||||
{
|
||||
|
@ -3753,14 +3756,24 @@ void CL_GlobalServers_f( void ) {
|
|||
// Use the extended query for IPv6 masters
|
||||
if (to.type == NA_IP6 || to.type == NA_MULTICAST6)
|
||||
{
|
||||
cmdname = "getserversExt " GAMENAME_FOR_MASTER;
|
||||
int v4enabled = Cvar_VariableIntegerValue("net_enabled") & NET_ENABLEV4;
|
||||
|
||||
if(v4enabled)
|
||||
{
|
||||
Com_sprintf(command, sizeof(command), "getserversExt %s %s ipv6",
|
||||
cl_gamename->string, Cmd_Argv(2));
|
||||
}
|
||||
else
|
||||
{
|
||||
Com_sprintf(command, sizeof(command), "getserversExt %s %s",
|
||||
cl_gamename->string, Cmd_Argv(2));
|
||||
}
|
||||
|
||||
// TODO: test if we only have an IPv6 connection. If it's the case,
|
||||
// request IPv6 servers only by appending " ipv6" to the command
|
||||
}
|
||||
else
|
||||
cmdname = "getservers";
|
||||
Com_sprintf( command, sizeof(command), "%s %s", cmdname, Cmd_Argv(2) );
|
||||
Com_sprintf(command, sizeof(command), "getservers %s", Cmd_Argv(2));
|
||||
|
||||
for (i=3; i < count; i++)
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define CLIENT_WINDOW_MIN_TITLE "changeme2"
|
||||
#define GAMENAME_FOR_MASTER "iofoo3" // must NOT contain whitespaces
|
||||
#define HEARTBEAT_FOR_MASTER GAMENAME_FOR_MASTER
|
||||
#define FLATLINE_FOR_MASTER GAMENAME_FOR_MASTER "dead"
|
||||
#else
|
||||
#define PRODUCT_NAME "ioq3"
|
||||
#define BASEGAME "baseq3"
|
||||
|
@ -41,6 +42,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#define CLIENT_WINDOW_MIN_TITLE "ioq3"
|
||||
#define GAMENAME_FOR_MASTER "Quake3Arena"
|
||||
#define HEARTBEAT_FOR_MASTER "QuakeArena-1"
|
||||
#define FLATLINE_FOR_MASTER HEARTBEAT_FOR_MASTER
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
@ -276,6 +276,8 @@ extern cvar_t *sv_floodProtect;
|
|||
extern cvar_t *sv_lanForceRate;
|
||||
extern cvar_t *sv_strictAuth;
|
||||
extern cvar_t *sv_banFile;
|
||||
extern cvar_t *sv_heartbeat;
|
||||
extern cvar_t *sv_flatline;
|
||||
|
||||
extern serverBan_t serverBans[SERVER_MAXBANS];
|
||||
extern int serverBansCount;
|
||||
|
@ -298,12 +300,10 @@ void SV_AddOperatorCommands (void);
|
|||
void SV_RemoveOperatorCommands (void);
|
||||
|
||||
|
||||
void SV_MasterHeartbeat (void);
|
||||
void SV_MasterShutdown (void);
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// sv_init.c
|
||||
//
|
||||
|
|
|
@ -684,6 +684,8 @@ void SV_Init (void)
|
|||
sv_lanForceRate = Cvar_Get ("sv_lanForceRate", "1", CVAR_ARCHIVE );
|
||||
sv_strictAuth = Cvar_Get ("sv_strictAuth", "1", CVAR_ARCHIVE );
|
||||
sv_banFile = Cvar_Get("sv_banFile", "serverbans.dat", CVAR_ARCHIVE);
|
||||
sv_heartbeat = Cvar_Get("sv_heartbeat", HEARTBEAT_FOR_MASTER, CVAR_INIT);
|
||||
sv_flatline = Cvar_Get("sv_flatline", FLATLINE_FOR_MASTER, CVAR_INIT);
|
||||
|
||||
// initialize bot cvars so they are listed and can be set before loading the botlib
|
||||
SV_BotInitCvars();
|
||||
|
|
|
@ -58,6 +58,9 @@ cvar_t *sv_floodProtect;
|
|||
cvar_t *sv_lanForceRate; // dedicated 1 (LAN) server forces local client rates to 99999 (bug #491)
|
||||
cvar_t *sv_strictAuth;
|
||||
cvar_t *sv_banFile;
|
||||
cvar_t *sv_heartbeat; // Heartbeat string that is sent to the master
|
||||
cvar_t *sv_flatline; // If the master server supports it we can send a flatline
|
||||
// when server is killed
|
||||
|
||||
serverBan_t serverBans[SERVER_MAXBANS];
|
||||
int serverBansCount = 0;
|
||||
|
@ -232,7 +235,8 @@ but not on every player enter or exit.
|
|||
================
|
||||
*/
|
||||
#define HEARTBEAT_MSEC 300*1000
|
||||
void SV_MasterHeartbeat( void ) {
|
||||
void SV_MasterHeartbeat(const char *message)
|
||||
{
|
||||
static netadr_t adr[MAX_MASTER_SERVERS][2]; // [2] for v4 and v6 address for the same address string.
|
||||
int i;
|
||||
int res;
|
||||
|
@ -315,9 +319,9 @@ void SV_MasterHeartbeat( void ) {
|
|||
// ever incompatably changes
|
||||
|
||||
if(adr[i][0].type != NA_BAD)
|
||||
NET_OutOfBandPrint( NS_SERVER, adr[i][0], "heartbeat %s\n", HEARTBEAT_FOR_MASTER );
|
||||
NET_OutOfBandPrint( NS_SERVER, adr[i][0], "heartbeat %s\n", message);
|
||||
if(adr[i][1].type != NA_BAD)
|
||||
NET_OutOfBandPrint( NS_SERVER, adr[i][1], "heartbeat %s\n", HEARTBEAT_FOR_MASTER );
|
||||
NET_OutOfBandPrint( NS_SERVER, adr[i][1], "heartbeat %s\n", message);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -331,11 +335,11 @@ Informs all masters that this server is going down
|
|||
void SV_MasterShutdown( void ) {
|
||||
// send a hearbeat right now
|
||||
svs.nextHeartbeatTime = -9999;
|
||||
SV_MasterHeartbeat();
|
||||
SV_MasterHeartbeat(sv_flatline->string);
|
||||
|
||||
// send it again to minimize chance of drops
|
||||
svs.nextHeartbeatTime = -9999;
|
||||
SV_MasterHeartbeat();
|
||||
SV_MasterHeartbeat(sv_flatline->string);
|
||||
|
||||
// when the master tries to poll the server, it won't respond, so
|
||||
// it will be removed from the list
|
||||
|
@ -1139,7 +1143,7 @@ void SV_Frame( int msec ) {
|
|||
SV_SendClientMessages();
|
||||
|
||||
// send a heartbeat to the master if needed
|
||||
SV_MasterHeartbeat();
|
||||
SV_MasterHeartbeat(sv_heartbeat->string);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
Loading…
Reference in a new issue