Changing Maximum Player Count

From Valve Developer Community
Revision as of 18:24, 5 February 2009 by £cho (talk | contribs)
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 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 maxplayers works. Fortunately, this is easy to fix.

Solution:

  • Open hl2mp_gameinterface.cpp and make 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 server at any given time. It is not recommended to go any higher, because after 32 players, your mod may become unstable.