I noticed that there is a limit at marauroa MAX_NUMBER_PLAYERS = 128. Is it safe to increase this number and if so, how much? Is there any correlation between resource needed by the marauroa server and this constant. Is there any documentation available about marauroa resources and relation between max number of players and server hardware requirements?
Second question is can I have two, three or more instances of marauroa/stendhal server that are on different physically separated computer servers but all of them using the same marauroa database on a single mysql server? If this is true, players can connect to particular server which has less players then 128, and I don't need to increase number of players.
You seem to have CSS turned off.
Please don't fill out this field.
I'm pretty sure that number is after so much testing. But again the current server is on a normal PC (unless they changed it recently). So its tied to resources and CPU. Don't think there's a study to show you the amount based on processor/RAM,etc. It would be experimentation from your part.
The sharing of marauroa servers is not implemented yet. I had plans of doing such thing but I have 3 projects right now that have priority over that. (Including a new game using Marauroa)
I had a look of at the code and the history. The reason for this check was fixed 5 years ago by adding timeout handling. Before that players who connected to the server but never send a single message (not even logged in) used up resources. Those connected are correctly timed out now.
I think, however, that the ability to limit the number of players is a good thing, especially for server running on small hardware. I removed that hard constant and replaced it with the configuration setting max_number_of_players in server.ini. The change is commited to CVS HEAD and will be part of the upcoming Marauroa release 3.4.
javydreamercsw is right that you need to experiment how many players your server hardware and Internet connection can handle. The new textclient (games.stendhal.bot.textclient.TextClient) may be helpful as a starting point to simulate many clients.
You can share a database across multiple marauroa servers with two little changes: First you need to prevent that one player logs into multiple servers at the same time (basically check the online column of character_stats). Second you need to load zone objects from the database before they are modified (using SELECT FOR UPDATE of course) in order to be able to use the Trade Center and Housing. While both changes are possible with very little effort, there is a huge catch: Player on different servers cannot see or interact with each others. This catch renders the whole approach useless in my point of view.
Working towards true cluster support is an item we keep in the back of our minds while improving Marauroa. There was a number of small changes we did in the past which brought us closer to that goal. And there are some feature requests ahead that will bring us very closely to true cluster support:
* We want to allow player to make a copy of there character on the real server and transfer it to the beta server. This will create some infrastructure for transferring players from one node to another.
* We want to be able to tunnel and multiplex the game protocol over https. This requires a login to a .php script which will generate a session-id and tell the client the address to use in the http-CONNECT-method. This will result in some infrastructure to delegate players to servers on login.
* Automatically relogin after disconnect. This feature request will be implemented in a way with allows us to reconnect players to another server (for example after teleporting) by using the technic described in the last paragraph.
* Asynchronous database access is a hot topic. It will not only totally eliminate lag caused by database queries but it will also be the base for inter note communication.
For now, I think you are fine by increasing the limit of max players.
About MAX_NUMBER_PLAYERS I remember adding it because players we handled on a array but later I changed it to a HashMap ( as far as I remember ), so raising the number of players have not big impact on the server. About how that correlate with server hardware resources it is not really relevant on the CPU+Memory part but on the banwidth usage. The more players the more bandwidth and I would be that it grows similar to O(a·n^2) where a < 1
I won't recomend you to do that. Marauroa is designed to be a single server thing, so changing it to multiserver would requiere more than a few hacks and as nhnb said players would play on different worlds in fact.
BTW I place 128 as a random number, you know… 64, 128, 256, … no real testing on that, just we wanted to avoid someone filling all the player slots and 128 seemed fine to me. You can put it to 65536 or whatever it won't have any impact on performance.
Bandwidth is a major issue if you host the server on a private DSL connection intended for consumers with a huge downlink and a small uplink. Stendhal was hosted that way for years. However, if you rent a server with 100Mbit/s or 1000Mbit/s bandwidth isn't an issue anymore. I made some diagrams of the bandwidth use by Stendhal on stendhal.game-host.org at http://stendhal.game-host.org/wiki/index.php/Stendhal_Bandwith.
Average bandwidth use seems to be linear to the number of players for us. In theory it is not really linear because multiple players in the same zone can see each others actions like moving and fighting. Compared to the other traffic, however, this is negligible in our case. At 40 players the bandwidth is 0.2Mbit/s (plus TCP/IP overhead). I did not include higher number of players because there were too little samples, but they fit into the trend.
The second diagram includes the maximum traffic peak we had anywhere in the complete year 2009. Those peaks are very seldom and don't last long.
At the moment Stendhal is CPU bound in the creature logic loop because of a suboptimal implementation of collision-detection during path-finding (a new Rectangle2D is created on every check, millions per second). I guess it is fixed easily. So far we have not reached the point at which that starts to create lag and our hardware is not the best.
Those are some great numbers! Are those Marauroa Specific or Stendhal specific? Such analysis would be great for the Marauroa framework itself if that's not the case.
Those numbers are based on real world data from the Stendhal server on stendhal.game-host.org from 2009-01-01 to 2009-12-31.
I guess it is not really possible to get such number for Marauroa itself. The size of perception messages heavily depends on what has changed in the current turn in the zone. So if you visit a zone with a lot of monsters running around the perception are larger as if you visit a zone where nothing happens.
If you drop into the mix variables like: amount of object updates, amount of object removals, amount of zones it can be done I guess. It would be helpful for the framework to have such analysis.
Sign up for the SourceForge newsletter: