Changing Maximum Player Count

From Valve Developer Community
Revision as of 08:11, 14 July 2011 by £cho (talk | contribs) (moved Maxplayers 16 Fix to Changing Maximum Player Count: I am in the process of generalizing this article to make it more relevant to more people.)
Jump to navigation Jump to search

NOTE: As of February 5, 2008, this only applies to the HL2DM OB (Orange Box) source code.


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 instead of 16. Please do not try to set maxplayers to a value higher than 32. It's experimental, and after exceeding 32 players, a server would begin to become unstable.