Friends&Foes (Fabric/Quilt) (Copper Golem, Glare, Moobloom, Iceologer, Barnacle, Wildfire, Rascal, Tuff Golem)

Glares causing noticeable tick usage

Skeithh opened this issue ยท 6 comments

commented

Minecraft version information

1.18.1

Mod version information

1.2.3

Expected Behavior

Glares should not be using this amount of server tick time to calculate AI movement

Actual Behavior

Glare movement AI, specifically goalselector, is using an immense amount of server tick time. Sparkprofiler result states that a glare was 32% of the entity tick usage

This was noticed on a server that had only three players active at the time, where its normal tick lag is ~100 ticks behind when someone is actively doing something hefty. When someone was in an area with a glare, that ticklag went as high as 590 ticks behind.

Reproduction Steps

  1. Have glare present somewhere
  2. Run sparkprofiler
  3. View results

Screenshots & files

Spark profiler results: https://spark.lucko.me/SJv9N8b1bD

Here's the full modlist:
full modlist.txt

commented

looks like it's been fixed with that dev build, haven't had any noticeable glare-related lag as far as I can tell!

commented

Hey, Just letting you know I didn't forget about this! We'll be testing today and I'll get back to you with a report on how performance is doing afterwards

commented

I will look into that, also mentioning sparkprofiler is great for me, because i did not have any experience with debugging AI tick complexity(now i at least know what to use). Thanks, hopefully i will let you know today with some good news :).

commented

@Skeithh Also can you please tell me how much Glare entities is loaded(and ticking)? As in version 1.2.2 of the mod was bug with glare persistance. So it is possible that they are overpopulated.

commented

@Faboslav
No problem regarding Spark, I found out about it recently and it has been a lifesaver for the server.
I investigated some of the supposed areas but I also found some new lush caves to investigate. After waiting a bit, only a few glares spawned, and significant tick lag followed. There wasn't an excessive amount of these at all, pretty much about 10 of them in the area Before I killed them it set the server to ~220 ticks behind and growing. I ran a sparkprofiler again just for general reference before I started culling them to see it behave
https://spark.lucko.me/YszfTLJkiA

Killing them off immediately caused the tickrate to recover back to its standard 20-40 that is expected on my server.

commented

So i tried to use spark for profiling and all was relatively okay(i tried it with about 20-40 glares), sadly the worst part of Glares performance is the code of WanderAround goal which is just reused code from the Parrot :D.

Now i have no idea how to approach this as i cant simulate it properly, anyway i tried to look at every goal used by glare and then tweak it somehow for better performance, so if you would be so kind and tried this dev build i released https://github.com/Faboslav/friends-and-foes/releases/tag/mc1.18.1-1.2.4dev (friendsandfoes-mc1.18.1-1.2.3.jar file) it would be great help.