I’ve been cleaning up and fixing NTai ready for applying for my placement year. I’ve started moving things around making everything work with common sense, and undoing a lot of foobarred stuff I coded half asleep.
So I’ve implemented the behavior system I wanted, and I’ve started moving old code into the new system with some clean up and improvements. There was also the majro refactor to store all the AI specific unti data and checks in a custom class, rather than having it strewn out across countless source files.
I’ve also gained an insight into the mysterious lag spike issues and I have a theory! Looking through the debugger I noticed it was particularly laggy when untis atatcked each other, so I looked through NTais internals and found lots of move commands for the same unit and other repetitive things. For example retreat was being recalculated per hit, as was dgunning. I was testing in XTA and sent 10 peewees, and a peewee fires 12 rounds per second, so that’s 120 unit hit calls per second, or 120 retreat commands per unit, regardless of wether its already retreating or not.
Now that I know what’s going on, I know howto correct the issue. Regardless of whether this is the cause of the lag it would be needed to clean up the code. Those routines are full of bitrot. So I would expect a testable build before new year, sooner if you’re lucky, but be patient.