Jump to content

MaxPlayers problem


Duion
 Share

Recommended Posts

I think I have a problem with my game, it seems like the the MaxPlayer limit which is set in scripts/server/prefs.cs as $Pref::Server::MaxPlayers does not work, this means unlimited amount of players can join servers, even if set to 1 or 0 you can still join the server.


Maybe it has to do with a change I did where I put the prefs into the users home directory, you can view it here: https://github.com/Duion/Uebergame/commit/aaf79d7d772f48e9fbc48db3fe018061b17b6ac6


Update: I made a test where I hosted a server with 1 player max, so nobody should be able to join, the first few people got blocked from joining, but after a while some people were able to join the server anyways, so I wonder where this comes from.

If someone wants he can install my game and try it out.

Link to comment
Share on other sites

I think I have a problem with my game, it seems like the the MaxPlayer limit which is set in scripts/server/prefs.cs as $Pref::Server::MaxPlayers does not work, this means unlimited amount of players can join servers, even if set to 1 or 0 you can still join the server.


Maybe it has to do with a change I did where I put the prefs into the users home directory, you can view it here: https://github.com/Duion/Uebergame/commit/aaf79d7d772f48e9fbc48db3fe018061b17b6ac6


Update: I made a test where I hosted a server with 1 player max, so nobody should be able to join, the first few people got blocked from joining, but after a while some people were able to join the server anyways, so I wonder where this comes from.

If someone wants he can install my game and try it out.

 

@Duion Did you not have a programmer on the game? I remembered a blog about that some time ago.


You find that global pref variable "MaxPlayers" here:

client\prefs.cs

server\prefs.cs

core\scripts\server\defaults.cs

game\core\prefs.cs


Hence NOT only in scripts/server/prefs.cs.... unless that has changed in the newer version from 3.51 and up.


I recommend a Torsion and a search whole project search ;)

Link to comment
Share on other sites

Note it maybe defined at different locations:

\core\prefs.cs(8):   $Pref::Server::MaxPlayers = 64;
\scripts\client\prefs.cs(47):   $Pref::Server::MaxPlayers = 64;
\scripts\server\prefs.cs(8):   $Pref::Server::MaxPlayers = 64;

 

Do a search like Dwarf King said and make sure they all have the same value.


IMO only in \scripts\server\prefs.cs should be enough :?

Link to comment
Share on other sites

Yes I already made a bunch of searches and there is a bunch of locations where they get saved and loaded and it is not that it is set different elsewhere, since the set number gets displayed on the server list, it just gets ignored sometimes.


I made a few more tests and I could save the server from overpopulating most of the time, by creating a buffer zone, by reducing the maxplayers a bit more, so it is not that bad if a few more join than planned.

Link to comment
Share on other sites

Yes I already made a bunch of searches and there is a bunch of locations where they get saved and loaded and it is not that it is set different elsewhere, since the set number gets displayed on the server list, it just gets ignored sometimes.


I made a few more tests and I could save the server from overpopulating most of the time, by creating a buffer zone, by reducing the maxplayers a bit more, so it is not that bad if a few more join than planned.

 

If the scripting does not work out of the box then:

Same thing again then. Open a Visual Studio compiler and search for MaxPlayers in the entire solution. In other words go brute force and attack the issue through the scripts and the source code... Also the prefs sometimes needs to be reset. Hence you have a "DeletePrefs.bat". I know that some(not all) people need to use that one before they can change their prefs.


You might notice this file:

you info from your machine\Engine\source\app\net\serverQuery.cpp(88):// Pref::Server::MaxPlayers


In that file the maxPlayers limit is set to 255:

 ServerFilter()
  {
     queryFlags = 0;
     gameType = NULL;
     missionType = NULL;
     minPlayers = 0;
     maxPlayers = 255;
     maxBots = 16;
     regionMask = 0xFFFFFFFF;
     maxPing = 0;
     filterFlags = 0;
     minCPU = 0;
     buddyCount = 0;
     buddyList = NULL;
  }



In the very same file this is written:

//    maxPlayers        No more than this many

 

In other words use the search functions and tweak and test. :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...