Implements a cache for train collision checks for better performance
Implements a cache for train collision checks for better performance Before: https://spark.lucko.me/cgjtsUl25f After: https://spark.lucko.me/p7ZcDxAUFA Criticism welcome. Made with the help of Copilot
World used for testing : world.zip
If this works properly this is brilliant @stacode123 and definately needed. We've turned train collisions off entirely to help with lag but thats definately not a fix most servers want to implement.
Using Copilot is a little worrying though because you need to know exactly whats going on for this. Make sure you've tested it thoroughly and used the debugger to step through the code to see whats going on and if it aligns with what you expect.
test world has 180 trains more than that would have caused my computer to have a seizure
Will address the comments
Performance impact on a server with 475 trains:
Before:
After:
To be honest it's rare u see such a stark contrast between before and after. A similar number of players are connected to the server as well so the difference likely isn't down to that. :)
@Jozufozu Please review the changes :D