Changing Maximum Player Count

From Valve Developer Community
Revision as of 16:19, 5 February 2009 by £cho (talk | contribs) (New page: '''NOTE:''' This problem and solution only applies to the HL2DM OB (Orange Box) source code at this time. ---- '''Problem: ''' * You are unable to create a listen server with more than 1...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

NOTE: This problem and solution only applies to the HL2DM OB (Orange Box) source code at this time.


Problem:

  • You are unable to create a listen server with more than 16 players.

Cause:

  • For whatever reason, Valve decided to limit the maximum amount of players to 16 by altering the way the maxplayers cvar works. Fortunately, this is easy to fix.

Solution:

  • Open hl2mp_gameinterface.cpp and commit the following changes:


REPLACE THIS:

void CServerGameClients::GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const
{
	minplayers = defaultMaxPlayers = 2; 
	maxplayers = 16;
}

WITH THIS:

void CServerGameClients::GetPlayerLimits( int& minplayers, int& maxplayers, int &defaultMaxPlayers ) const
{
	minplayers = defaultMaxPlayers = 2; 
	maxplayers = 32;
}

Now you can have up to 32 players on your listen server at any given time. It is not recommended to go any higher, because after 32 players, your mod may become unstable.