Hello again!
It is already time for another AI mini diary, going into some more detail about points in the changelog for the upcoming Together for Victory update!
(To read part one, scroll to the end of the last DD, which can be found here.)
Todays story from the trenches relates to one of the seemingly basic AI features that is a hell of a lot harder than it seems; balancing the divisions between the orders. A human can do this without much thinking, given our superior pattern recognition capabilities. The AI is not as lucky, and has to do some educated guesses based on what numbers are available in a given situation. The code for doing this has grown in phases since about two years back, in some sences almost uncontrolably so due to chasing a good enough state for deadlines. After a while, what easily happens with such systems is that parts of the code "fix" problems that are no longer problems. Indeed, more than just making the code unnecessarily complicated, it can cause new bugs.
This is exactly what happened with this system. It can roughly be divided into three steps, and after some failed attempts at fixing some bugs related to it, I ended up ripping out and rewriting the entire step two, reducing the size of it by about 30%. This also meant that I could remove about 20% of step three. The result has been that the system is easier to read, debug and maintain, even though it lead to some new bugs related to the rewriting. I still see cases where the behaviour is not 100%, but the overall performance of it appears a significant improvement, and the AIs ability to recover from strange situations is a lot better.
- Fixed bug where AI would keep swapping a fighter with land equipment at the top of the list for all eternity.
- AI should now be capable of using rockets.
- Fixed overflow that cause some countries to not build planes causing USA to end up with 0 strategic bombers.
- Made sure released AI countries don't get stuck building nothing.
That covers some more of the fixes that has been made for the AI. As before; I have more to tell you about so hold off on worrying about your favourite AI bugs
Next time I will be talking about some of the improvements, though when it comes to AI the line between what is a bugfix and what is an improvement is very blurry.
It is already time for another AI mini diary, going into some more detail about points in the changelog for the upcoming Together for Victory update!
(To read part one, scroll to the end of the last DD, which can be found here.)
Todays story from the trenches relates to one of the seemingly basic AI features that is a hell of a lot harder than it seems; balancing the divisions between the orders. A human can do this without much thinking, given our superior pattern recognition capabilities. The AI is not as lucky, and has to do some educated guesses based on what numbers are available in a given situation. The code for doing this has grown in phases since about two years back, in some sences almost uncontrolably so due to chasing a good enough state for deadlines. After a while, what easily happens with such systems is that parts of the code "fix" problems that are no longer problems. Indeed, more than just making the code unnecessarily complicated, it can cause new bugs.
This is exactly what happened with this system. It can roughly be divided into three steps, and after some failed attempts at fixing some bugs related to it, I ended up ripping out and rewriting the entire step two, reducing the size of it by about 30%. This also meant that I could remove about 20% of step three. The result has been that the system is easier to read, debug and maintain, even though it lead to some new bugs related to the rewriting. I still see cases where the behaviour is not 100%, but the overall performance of it appears a significant improvement, and the AIs ability to recover from strange situations is a lot better.
- Fixed bug where AI would keep swapping a fighter with land equipment at the top of the list for all eternity.
- If you ever observed the AI (sorry about observer mode still not being a guarantee), you may have noticed at least some countries getting stuck swapping the two top lines if they were a fighter and some land equipment. A fairly basic code booboo that has now been resolved, resulting in a positive impact to AI production.
- AI should now be capable of using rockets.
- Exactly what it says. The problem here was that rocket bases, though internally represented as air bases, are kept in a separate list from the regular air bases. Just including that list when considering missions should mean AI can now use their sometimes ample supply of rockets.
- Fixed overflow that cause some countries to not build planes causing USA to end up with 0 strategic bombers.
- Yet another basic one. When implementing features it is easy to just look that the standard cases, and thus miss the late game edge cases. In this case the USA wanted strategic bombers so much that the number overflowed and became a ridiculous negative number in stead.
- Made sure released AI countries don't get stuck building nothing.
- Again, pretty basic. A flag was not set, and the AI was never run for released countries. But who releases a country without playing as it, anyway? ;P
That covers some more of the fixes that has been made for the AI. As before; I have more to tell you about so hold off on worrying about your favourite AI bugs
Next time I will be talking about some of the improvements, though when it comes to AI the line between what is a bugfix and what is an improvement is very blurry.
Last edited:
- 70
- 31
- 1