ioquake / ioq3

The ioquake3 community effort to continue supporting/developing id's Quake III Arena
https://ioquake3.org/
GNU General Public License v2.0
2.39k stars 529 forks source link

"sv_maxclients" is reset to 64 #531

Open isaacbernat opened 3 years ago

isaacbernat commented 3 years ago

I increased POOLSIZE (thanks @zturtleman for that https://github.com/ioquake/ioq3/issues/457 ) and MAX_RELIABLE_COMMANDS and compiled ioquake3 to windows (make ARCH=x86 PLATFORM=mingw32). I can't add more than 64 bots, because when I set "sv_maxclients" to a bigger number (like 100) when the server is restarted is set to 64 again. I changed the default value of sv_maxclients = Cvar_Get ("sv_maxclients", "8", CVAR_SERVERINFO | CVAR_LATCH); so it's "100" instead of "8", but that won't work. Any idea of a workaround? I need to add more bots ^_^' Thanks!

sv_maxclients64

ghost commented 3 years ago

If I remember correctly than the limit is set here in SV_BoundMaxClients: https://github.com/ioquake/ioq3/blob/main/code/server/sv_init.c#L250 This piece of code checks the sv_maxclients cvar value. If this value is higher than MAX_CLIENTS, than the cvar will be reset to MAX_CLIENTS. By default (unmodified code) MAX_CLIENTS is 64. As far as I know, there is no real workaround without modifying the source code (and probably break compatibility). Either you change MAX_CLIENTS (defined in q_shared.h) to a higher value, but this is error prone if I remember correctly, or you exclude bots from being counted as clients whenever 'SV_BoundMaxClients' is called. I'm no expert, these are just some basics I found out, when I wanted to increase sv_maxclinets too.

zturtleman commented 3 years ago

Quake 3 only supports 64 players. You would need to increase MAX_CLIENTS and run the built engine with the built cgame/game/ui qvms with this increased as well. This probably breaks network and mod compatibility with Quake 3. I'm not entirely sure but there is a good chance some things will break.

You may also want to increase max entities sent to client (MAX_SNAPSHOT_ENTITIES, 256 to 512) and then need to increase max snapshot size (MAX_MSGLEN) if you receive errors. Sending scoreboard info to client already maxes out and truncates with 64 players (DeathmatchScoreboardMessage()). SVF_CLIENTMASK is limited to 32 players but Quake 3 itself does not use it.

isaacbernat commented 3 years ago

Thanks both for the fast reply and useful insights. I'll look into changing those values and re-compile again 👍

isaacbernat commented 2 years ago

hi again, I changed SV_BoundMaxClients in code/aserver/sv_init.c to always set Cvar_Set( "sv_maxclients", va("%i", 90) ); instead of MAX_CLIENTS (which is set to 64), because I saw MAX_CLIENTS used in many places and didn't want to break more stuff (as a proof of concept; I'd like to add more than 90 bots). That worked, but I got errors with Z_Malloc allocation from main zone. I increased cv->integer from Com_InitZoneMemory in /code/qcommon/q_shared.h so s_zoneTotal = cv->integer * 1024 * 1024; was bigger. Then I got errors on AI chat like chat state handle 0 out of range. Disabling chat with /bot_nochat 1 "fixed" this issue which happened after adding more than 64 bots. I also remember getting bad clientNum on client entity at some point. I also increased MAX_SNAPSHOT_ENTITIES and MAX_MSGLEN as suggested by @zturtleman .

The current situation: I get cvar_update handle out of range just after restarting an arena after setting "sv_maxclients" on the console, even without adding any bot now (see screenshot). I am not sure how to proceed. Help will be appreciated. WhatsApp Image 2021-11-07 at 19 46 06

cesarfd commented 2 years ago

@zturtleman Does Quake 3 use/read any kind of client identification so that we could increase the number of bots only within ioq3 clients but maintain compatibility with vanilla q3 clients?

pdc-frans commented 2 years ago

Is it possible to just disable non-needed features, such as multiplayer, easily? Maybe we could make it work by setting the maximum number of bots and just enabling the required modules for the local demo one at a time, not sure if this is possible though.