Changing maxclients on-the-fly in stanard Quake

Discuss programming topics for the various GPL'd game engine sources.
Post Reply
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Changing maxclients on-the-fly in stanard Quake

Post by Baker »

Can't be done. (In a backwards compatible way, that is ...)

Reason:
cl.parse.c: CL_ParseServerInfo: wrote: // parse maxclients
cl.maxclients = MSG_ReadByte ();
Would have to have a new svc to tell clients that it changed. Of course, this isn't backwards compatible. And will affect demo playback too because in same function ...
cl.scores = (scoreboard_t *)Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
Only allocates scores and such, which controls player colors and such among other things, based on the initial connect.

Trivial idea for a future NQ protocol ...
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Changing maxclients on-the-fly in stanard Quake

Post by Spike »

why should a client care? if a slot has a name in it then its active, otherwise what difference does it make?
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Changing maxclients on-the-fly in stanard Quake

Post by Baker »

Well, for example, if I record a demo and change maxplayers while the game is going, another player connects an engine that doesn't support it like FitzQuake 0.85 should get an error like "slot > maxclients" or some such message and likewise if such an engine tried to play the demo.

I don't want to introduce an incompatibility.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Changing maxclients on-the-fly in stanard Quake

Post by Spike »

MAX_SCOREBOARD is hardcoded as 16, no?
always say maxclients is 16 and ignore the setting yourself?

thanks to the use of bytes, and colormap 0 being special, the logical max of the vanilla network protocol (as defined by datatypes rather than arbitrary limits) is 255 players max (this is the limit in dp+fte, if configured to ignore compatibility).

the real problem with changing it mid-map is that player slots and entities have a specific mapping, and certain mods have certain expectations about player slot limits (frikbot comes to mind). this would require you to reserve the first 256 entity slots, meaning you only have 350ish more until you reach the weird 600-entity limit (which could be bumped to 65k with vanilla data types).

the quakeworld method is to just say 'the limit is 32', and then control whether those 32 player slots can actually be used or not with the maxclients/maxspectators cvars (naturally the maximum combined value of these is 32).
this is the simplest approach of course, but does mean that you're always eating 32 entity slots even if they're never going to have players in them.
for compat you would need to say the limit is 16.
just so you know, fte strips colormaps and scoreboards above 16 slots for nq clients. it at least keeps it playable despite quakeworld requiring 32 player slots.


there shouldn't be any issues with changing the limit on map changes, so long as you're prepared to kick clients if the limit is reduced. just make sure the client gets reset to a state where its asking for the serverinfo until it gets it.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Changing maxclients on-the-fly in stanard Quake

Post by Baker »

Spike wrote:this is the simplest approach of course, but does mean that you're always eating 32 entity slots even if they're never going to have players in them.
for compat you would need to say the limit is 16.
So it can be made to work and is entirely server-side modification.

(1) Split svs.maxclients from the allocation. Always allocate 16. Make sure the first 16 entities slots are players, etc.
(2) Always tell a client to allocate 16. ClientConnect and SV_Spawnserver
sv_main.c --> SV_SendServerinfo wrote: MSG_WriteByte (&client->message, svs.maxclients); <---------- modify
(3) When a "test" command comes in (CCREQ_SERVER_INFO), tell it the truth (that it isn't necessarily 16).
Like qstat, an online server browser or typing "test quake.shmack.net" in the console)
net_dgrm.c --> _Datagram_CheckNewConnections wrote:MSG_WriteByte(&net_message, svs.maxclients);
(4) Probably disallow lowering maxplayers if a connected client is using the slot.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Post Reply