About
AI Improvements was born out of the need to improve server performance for large servers. Which any experienced server owner will know is impeded by heavy mod usage already. Rather than going after messing with the mods installed I started to look at Minecraft's core code. I found that as a server's population grows so does the amount of CPU entities start to use. At first I though "lets reduce the spawn rate of mobs on the server" this then lead to a complaint about mob farming. So rather than taking that approach I decided to improve how the AI's function. After a few hours I found my solution and a new mod.
FAQ
Can this be installed on the server only?
Yes, the mod is coded to function without it being client side
Can this be installed on the client only?
Yes, though it may not do much to improve fps.
What will happen if i disable the EntityLookHelper replacement?
Your not going to see much of an improvement in the AI code. However, if you enabled the other disable configs it should be fine.
Current Features
Config to disable AI Watch Closest Entity
By default the config is set to false and will not do anything. When changed to true it will remove an AI segment called EntityAIWatchClosest. This AI segment handles the coded AIs use to rotate their head towards a nearby entity.Visually this will cause a few odd issues. However, for the CPU this frees up a lot of usage caused by entities.
Config to disable AI look random, config is not enabled by default
By default the config is set to false and will not do anything. Setting the config to true will cause entities to no longer use the 'look idle' AI code. This can improve performance for servers will large populations. As almost every entity on the map will use this when not doing anything important. Visually this can cause the entities head to not rotate sometimes but mostly goes unnoticed.
Config to replace EntityLookHelper with a more efficient version, config is enabled by default
This is the main feature of the mod and can greatly improve CPU performance at a small cost to RAM. How this works is MC's look helper code is replaced with a custom version. The custom version stores some data that makes it faster to get the angle for a location. Threw some testing with VisualVM result have shown a 50% to 80% decrease in CPU usage by the AI code. For a server with 25 people on constantly this resulted in a gain from 5 to 7 tps.
Planned Features
- Multithreading for AI nav pathfinder
- Mob spawning restrictions
- Disable Visual AI code when not near players
- Reduce wondering distance
- Reduce wondering distance when not near players
- Reduce how often Mobs raytrace targets
- Config to control the amount of RAM atan2 cache uses