Mob Scarecrows

Mob Scarecrows

2M Downloads

[1.18.2] Performance Issues

itsdinkd opened this issue ยท 10 comments

commented

Could you provide more information. What version of the mod are you using? How many scarecrows are on the server? Are you using any mods that increase the number of mobs? What is the whole mod list? How many people are on the server?

commented

I'm having a similar issue:
https://spark.lucko.me/7UNro79pxi
Mob Scarecrow version 1.2.2
Minecraft version 1.18.2
Basic installation from the Valhelsia Vanilla Extended modpack.

It looks like the AvoidScareCrow goal is a significant performance hit. I see that it's currently trying to rate limit how often it runs with the canStart and scarecrowCheckLimiter.

However this does not seem to fix the issue; as whenever it DOES run, it dramatically increases the MSPT for the tick it runs in.

commented

It's spending most of its time in BlockPos.findClosest()

Not sure what the best fix would be; but if there's no scarecrows an early out would probably help a bit.

commented

Would it be simpler to kind of invert the search; and have each scarecrow find the list of mobs w/in their own range, and then update the mobs pathfinding that way? I assume there's a similar findClosest function for mobs that only searches the entity list instead of every block

commented

currently there is no good fix for this until I complete the overhaul of the mod which will make the scarecrows entities like armor stands which will dramatically reduce checks as findClosest searches a ridiculous amount of blocks. There is no ETA on this update though as I am still working on probably chests and am looking for an artist for the overhaul. If you want to reduce the problem a bit you can in the config decrease the scarecrow radius which also decreases the area in which findClosest searches.

commented

It would but I won't be updating until the overhaul of the mod so changing the current implementation would be unnecessary work as it will run much faster once they are all entities and the mobs are not searching 100s of blocks per second.

commented

Sorry I wish I could give you detailed information but I do not have it. Our official server was lagging for our modpack, aqm2, and the profile above was what came out of the check. I asked everyone in the server if they had scarecrows and they said no. Which is believable as the world was started today, not many people are aware of the mob scarecrows as well. That's the weird part. Why is there performance hits if there are no scarecrows placed?

My modpack doesn't have any mods that increases mob caps / spawn rates.

commented

The issue is that currently each mob scans a large amount of blocks to check if there is a scarecrow block nearby which causes lots of lag. I am working on an overhaul to the whole mod which will fix that and add a lot more content but that will be a while before it is out so I would recommend just disabling the mod until then. There is no ETA on when that will be done though. If you really want to keep the scarecrows you can shrink the radius that they scare in the config which should reduce the lag a bit.

commented

What you could do is inverting the search, instead of having mobs search for blocks you could have the blocks scan for nearby mobs(every 60 ticks or so) and alert those found of the scarecrow pos to avoid.
That way you still have some lag, but its just X scarecrows scanning vs All Entities. Should be much less lag and it is localized to the blocks

commented

This issue has been fixed in version 2.0.0 which should be ready for release in the next few days.