Facepunch / garrysmod-requests

Feature requests for Garry's Mod
84 stars 24 forks source link

Increase player limit 256 #877

Open aStonedPenguin opened 7 years ago

aStonedPenguin commented 7 years ago

The engines limit is 256 so there's no reason the game should be limited to 128 when servers are pushing 128 with headroom to spare.

willox commented 7 years ago

The engine's limit definitely isn't 256. I think Valve's server list has a cap of 256 player slots though.

aStonedPenguin commented 7 years ago

I've always been told it was. I know people have made modules to unlimit maxplayers but clients would crash instantly presumably due to something internal.

Kefta commented 7 years ago

I'm guessing it's from the MAX_PLAYERS preprocess definition, which is heavily used for setting max network array sizes, so if you had more, it would overrun the memory. MAX_PLAYERS is set to 32 in the 2007 branch, but changed to 64 for CS:S, so I'm assuming that is the only thing that needs to be bumped up.

willox commented 7 years ago

I can guarantee it's not that simple

Kefta commented 7 years ago

If the code was kept consistent with that definition, it seems like the original intention was for anyone to change that to add more players:

// The Source engine is really designed for 32 or less players. If you raise this number above 32, you better know what you are doing // and have a good answer for a bunch of perf question related to player simulation, thinking logic, tracelines, networking overhead, etc. // But if you are brave or are doing something interesting, go for it... ywb 9/22/03

Obviously with efficiency concerns, but it's intended to have a max of 255:

define ABSOLUTE_PLAYER_LIMIT 255 // not 256, so we can send the limit as a byte

drizmans commented 7 years ago

sup needs higher playercounts tbh

JustinCase224 commented 7 years ago

This is possible, but if we did this have you thought about if the source engine could even handle this, plus how do we know the game wont become unstable

Im not saying this is a bad idea im just saying that you should look into it befor asking on the request board.

Just think-to yourself. is this possible

Kefta commented 7 years ago

Yes

JustinCase224 commented 7 years ago

alright i still like your idea don't get me wrong

VaasKahnGrim commented 5 years ago

Will this ever be added in nativly? I'm apparently unable to force it to 255 myself. Would be nice to be able to especially with the x64 branch coming up. aswell valve confirms its possible already :p https://developer.valvesoftware.com/wiki/Maxplayers

hiddencoders commented 4 years ago

Any news on this one? It is possible to do this with dll injection, so I guess it is just the stability concerns and lack of interest that cause this not to be included. 255 players as a limit would certainly be used sparsely, but the few servers that utilized it right would be surely offer a great experience.

VaasKahnGrim commented 4 years ago

you'd need more than just dll injection. iirc the serverbrowser is also an enemy of this aswell. I believe it basically drops anything that tries to list itself above 128 even if it actually could hold that many. least thats how things went when I was tinkering around with some things

artemking4 commented 2 years ago

The engine's limit definitely isn't 256. I think Valve's server list has a cap of 256 player slots though.

unfortunately, it is. not technically but it is. alot of source's code is bound to max 128 players and player ids get written as bytes always

Jaffies commented 1 year ago

Any updates?

RaphaelIT7 commented 1 year ago

As far as I know, only the MAX_PLAYERS var would need to be raised to 255. It could cause some Issues and some bugs, but it would be useful for some servers. Currently, if you use tv_enable 1 and have maxplayers set to 128 you will end up having 129 slots which cause a crash for the client.

The-Lord-of-Owls commented 1 year ago

I guess now we wait till it gets updated to 255 or rubat denies us again

RaphaelIT7 commented 1 year ago

Maybe this could for now be implemented like tf2 did it with -unrestricted_maxplayers but for Gmod it could allow one to go up to 255. This would allow Servers who want more than 128 slots to have more, but Gmod wouldn't actively support it like tf2: image

How it could be implemented:

// game/shared/shareddefs.h
#define MAX_PLAYERS 255 // Raised to 255
#define SUPPORTED_MAX_PLAYERS 128
// game/server/hl2mp_gameinferface.cpp
void CServerGameClients::GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const
{
    minplayers = defaultMaxPlayers = 1; 
    int unrestricted_maxplayers = CommandLine()->ParmValue( "-unrestricted_maxplayers", -1 );
    if (unrestricted_maxplayers == -1) {
        maxplayers = SUPPORTED_MAX_PLAYERS
    } else {
        maxplayers = clamp( unrestricted_maxplayers, minplayers, MAX_PLAYER );
    }
}

NOTE: If this is implemented all Gmod branches should get updated because if for example the server is running on the dev branch and a client joins, the client will crash because of MAX_PLAYERS being different/the client will crash because the server has a higher MAX_PLAYERS