MarkusBordihn / BOs-Adaptive-Performance-Tweaks

Adaptive Performance Tweaks is a collection of Minecraft Forge server-side Mod which automatically adjust specific settings on the server to allow a more balanced TPS/FPS.
Other
4 stars 2 forks source link

APTweaks Spawn Module 1.20.1 Hostile Mob Issue #57

Closed mahjerion closed 10 months ago

mahjerion commented 11 months ago

MC 1.20.1 Forge 47.2.1

IMPORTANT CONTEXT: Server is constantly at 20/20 person as it's an Open Beta stress test (how we found out about this, lol). In SP or a few friends, problems are not really seen (makes sense).

Describe the bug This may be related to #55 . I have been trying to configure APTweaks extensively and cannot figure out why my settings are not applying. I know that APTweaks Spawn mostly works, but currently it seems like aggressive Vanilla mobs are not obeying the spawn limitations.

I've attached a chunk of the debug log, you'll see that it's not preventing any of the spawns of like zombies. The image shows the count of mobs (has been at 300-400 for the zombies/skeles/creepers).

Things I've tried: Default Configs: of course then mobs just don't really spawn since there are 20 players each with 8 mobs limit and only 32 per world.

Removing the hostile Vanilla mobs from the MinecraftSpawn.toml: what ends up happening is one mob in our modpack (pillagers) due to something on our end spawns a lot which prevents everything from spawning - likely an issue with global limitations.

After removing hostile Vanilla mobs from MinecraftSpawn.toml, adding them to the optimization blacklist in global: mobs start spawning like crazy (as expected) - confirms that the MinecraftSpawn.toml and the blacklist seem to work.

Setting it back to Default settings but adjusting the values (see pastebin below): results in what we have now. I set high amounts per world due to high player capacity. 8*20 = about 160 so I thought 192 was good.

Basically my issue is why the zombie/skele/creeper spawns aren't capping at the set 192?

image

Spawn.toml: https://pastebin.com/KKf9819S

MinecraftSpawn.toml Config: https://pastebin.com/BR2RQ2iR

Debug: https://pastebin.com/HRtanL5m

Expected behavior Cap at 192, or at least around 192, I understand it might go above a bit.

MarkusBordihn commented 11 months ago

Thanks for the detailed issue report, it helped me to isolate the issue a little bit.

Let me asks some additional questions.

In general the ...MobsPerPlayer and ...MobsPerWorld limits are not server limitations they are limitation for a single world like minecraft:overworld, minecraft:end or mmorpg:dungeon. Normally this is not an issue because most type of mobs are normally not spawning in the same world like piglins will never spawn naturally in the minecraft:overworld.

I assume that's the reason for your higher than expected numbers if the screenshot shows all mobs from all worlds on the server.

Please also keep in mind that the spawnAggressiveMode is not enabled, which mean that if the server load is low it's allowed to spawn some mobs over the defined limitation. This could happen if players left the server and only a few player exploring the world.

What I could do in this case is the following:

  1. Adding a possibility to limiting the spawns on the server over all worlds / mobs instead per world only. There is already a general spawnLimitationMaxMobsPerServer which is set to 512, maybe you can check if setting this to 192 will give you the expecting behavior.
  2. Adding better debug messages which show how many mobs already known in the current world.
  3. Optimizing the ignored entities like patrolling monster, raider and npcs which are automatically excluded by the optimization.

Let me know if any or all of the option above would help in your case and I'm happy to implement them.

mahjerion commented 11 months ago

Thanks for the thorough response. I remember you helped out with Daily Rewards too. Just want to say your attention to these issues should be the gold standard in mc modding.

Yes the mod in question would be Mine and Slash, it's an instanced dungeon world similar to Dimensional Dungeons.

Now that you mention it, I do blacklist the dungeon dimension. But I believe the mobs are overspawning in the Overworld. I'll have to check and confirm, but when I was on default configurations, and then the second configuration I mentioned, no zombies/skeles/creepers spawn. And from the get go I already blacklisted the mmorpg:dungeon dimension (it's very important in the pack). So that's why I don't believe it's from there (but like mentioned, will need to confirm.

Regarding your suggestions:

  1. Yes I think this could be helpful, it's basically the global limiter but accessible to each of the other tomls correct?
  2. Would be helpful if it's worth your time to do.
  3. Right now raids are a huge issue, we sometimes get 300 pillagers in a single raid... Not sure why it's happening but could be related.

Thank you Markus!

MarkusBordihn commented 10 months ago

I just released and updated version 10.0.0 which includes a separate global limiter and some other fixes. The order of the new "options" inside the tomls could be incorrect, in this case you could just delete the files and the new auto-generated files will have the correct other.

I also added an additional check for raids, so any raiders from an no longer active raid will be spawn limited as well. Only raiders from active raids will not be optimized as long the raid is still active.

Additional I added a fix that pillagers will not over populated outposts and other structures. I recommend to adjust the limits for your 20/20 server, because most of the defaults limits are designed for 4 players servers.

Additionally you could check out the "gamerule" module, which automatically disables raids and patrols if the server load it to high until it's return to normal levels again.

The new debug will provide better details about the blocked and allowed entities like:

[16:03:44] [Server thread/DEBUG] [APTweaks(Spawn)/]: [Allow join (low load)] For Rabbit['Rabbit'/8607, l='ServerLevel[Test World 1.20]', x=-1452.66, y=63.00, z=-2441.36] in minecraft:overworld and 44 in world and 76 global
[16:07:09] [Server thread/DEBUG] [APTweaks(Spawn)/]: [View Area Visibility] Blocked spawn event for Bat['Bat'/827, l='ServerLevel[Test World 1.20.1]', x=458.50, y=48.00, z=-2600.50] with 12 entities and 0 players in minecraft:overworld.
[16:07:09] [Server thread/DEBUG] [APTweaks(Spawn)/]: [Allow spawn (low load)] For Skeleton['Skeleton'/828, l='ServerLevel[Test World 1.20.1]', x=458.50, y=74.00, z=-2674.50] in minecraft:overworld and 26 in world and 26 global

This should help to isolate any issues, if needed.

Let me know if this already helps in your case or if you experience any other kind of issues, which are visible in the logs as well. If an entity is not showing up in the logs like [Allow spawn] or Blocked spawn its mean it was not optimized by this mod. There are some mods which using their own spawn logic which bypass the standard events and so the optimiziations.