ServerCore

ServerCore

384k Downloads

Trying to control hostile mob-cap with more then 1 player online

XavierBit opened this issue ยท 6 comments

commented

Hi!
We are a little server community and play normally on Paper / Purpur. We had the idea of setting up a Fabric server for some modded content but don't have a lot of experience with Fabric.

This isn't a bug report but for sure a lack of understanding. Please bear with me :)

We would like to limit hostile mobs around each player (in 128 block radius) to 75. If those players are nearer together, the mob cap for both should not exceed 100 hostile mobs (please take an value you like for this example). If they are farther away as 128 blocks, each of them should get back to max 75 hostile mobs in their range.

Today, if there is only one player on the server, this seems to work. But as soon as another player logs in and stays farther away than 128 blocks, the mob-cap doubles for the first player and the server starts to lag behind.

We are not sure if this is related to ServerCore but hope we can get this under control somehow.

Is there any explanation why this happens and is there any way to avoid it using ServerCore?

ServerCore: 1.3.7
Minecraft: 1.20.1
ServerCore.toml:
servercore .txt

commented

Reading through your explanations made things a lot clearer, thank you so much.

The dynamic part of lowering several parameters depending on server load wasn't obvious to us but is a very big advantage which we will start using better now and this makes ServerCore a really useful tool.

Thank you again for your time and your hard work which went into this mod!

commented

Vanilla already has mobcaps, which are essentially exactly what you described, almost word for word.
Quick overview of how these work:

  • Global mobcap: mobcap that exists 'globally' across one dimension. This value is based on the total amount of unique mob-spawnable chunks (any chunks within 128 blocks horizontal distance from players).
  • Per player mobcap (1.18+): mobcap calculated for each player. The purpose of this mobcap is to ensure the mobspawning algorithm can't naturally spawn too many mobs near one player, so that one player doesn't easily clog up the entire global mobcap denying any more mobs from spawning for other players even if they don't have any.

What are you using to figure out what the mobcaps are, and how they are doubled? If the metrics you are reading are from the global mobcap, like you could with carpet mod, then these numbers doubling would be completely normal unless the two players are standing in the same area.

ServerCore also provides a /mobcaps command, that gives you the metrics for your per-player mobcap (note that this likely won't work in spectator mode). Hope that helps!

commented

Also noticed this in your config file: max_mobcap = 7.0
This number is a modifier for the mobcap of each spawngroup. 7.0 = 700% vanilla mobcaps, which is rather absurdly high.
With the vanilla hostile mobcap of 70, this would for example allow 490 hostile mobs to spawn for each player (plus the mobs from other spawn groups but hostile is the most important one).

I generally don't recommend putting this above 1.0 unless you know what you are doing.
It could explain any lag issues with mobs you might be having.

commented

Hi Wesley!
Wow, you are quick... let me read through your comments and see if I understand it.

commented

I'm using the mod https://www.curseforge.com/minecraft/mc-mods/mobcountmod for a quick overview what's going on around me. That's how I noticed the difference if I'm alone on the server or with a second player. And yes, I used '/mobcaps' after that as well to confirm the numbers.

So if we would like to tweak the vanilla mob cap, we could do this by changing the 'max_mobcap' in increments, right? Let's say we would like it slightly over 1 (100% or the vanilla mob cap of 70), we could set it to 1.5 which would correspond to 150% or roughly 105 mobs per player in a horizontal distance.

The section with the settings:
max_mobcap = 7.0
min_mobcap = 0.8
mobcap_increment = 0.1

Aren't very clear to me.

Please be so kind and let me ask some questions I'm not sure about:

  • As you mentioned, 'max_mobcap' is a vanilla modifier, I got this one. But how should I understand 'min_mobcap' and 'mobcap_increment'?

  • I assume 'min_mobcap' is the minimum of mobs, around the player, in any case. so this would be 80% of the vanilla mob cap?

  • How does the 'mobcap_increment' work? Is this depending on TPS / MSPT values and goes up from 0.8 to 'max_mobcap' in increments of 10% and if so, over which time spawn?

  • If we wanted to stay with vanilla numbers, than ServerCore wouldn't be necessary or would I loose some other important advantages?

Sorry for my noob questions, I looked for some more documentation about ServerCore but I couldn't find any and thank you for your patience!

commented

The settings you described are part of the dynamic performance system. The goal of this system is to automatically modify certain values like chunk_tick_distance, mobcap_multiplier, simulation_distance and view_distance based on the performance (MSPT / milliseconds-per-tick) of the server.

In the config:

  • update_rate = decides the specific intervals at which the server runs these checks to modify dynamic settings.
  • xyz_increment = The value "xyz" can increase or decrease by at once when such a check is ran.
  • max_xyz = The maximum value of "xyz" the server can increase this setting to.
  • min_xyz = The minimum value of "xyz" the server can decrease this setting to.

min_mobcap for example in this case is referring to the minimum mobcap multiplier that the server can automatically change it to if needed.

So if we would like to tweak the vanilla mob cap, we could do this by changing the 'max_mobcap' in increments, right? Let's say we would like it slightly over 1 (100% or the vanilla mob cap of 70), we could set it to 1.5 which would correspond to 150% or roughly 105 mobs per player in a horizontal distance.

Yes, but do note that the server can still automatically lower this value to whatever the min_mobcap is set to over time if the server is performing poorly.

If we wanted to stay with vanilla numbers, than ServerCore wouldn't be necessary or would I loose some other important advantages?

ServerCore does a lot more than only having the ability to change mobcap values. Whether these optimizations / features are worth it, is up to you. If you only want it for changing the mobcaps, there are probably other mods that specifically target this issue (and give you more control over mobcaps).