Changing Maximum Player Count: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 29: Line 29:


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.
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.
[[Category:Programming]]

Revision as of 13:28, 25 May 2009

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.