Finally, after two weeks of work, the new AI is complete!
Update Info
All opponents' AI in the game has been updated.
It should now have stronger strategic planning and performance than before—please give it a try in the Practice Match and Tournament!
But, if I end this update with just that, won’t everyone think I’ve been slacking off for the past two weeks?
So, please allow me type a few more words and ramble a bit about what’s behind this update:
The AI-related code has been completely rewritten, retaining only a small amount of legacy code for auxiliary calculations and definitions. At the same time, to meet the requirements of the new AI architecture, the game’s underlying logic and rule calculations have been optimized and improved, adding nearly 5,000 lines of codes in total.
The overly fragmented scoring rules from the old version of AI have been standardized, consolidating them into three key components: piece score, position score, and resource score. These are then reused and expanded to evaluate the overall board state and the AI’s actions. This approach not only facilitates future expansion and allows for focused refinement of the scoring rules, but also allows the code to make greater use of caching to reuse the AI’s previous calculation results, significantly optimizing performance.
Thanks to this new AI architecture, the new AI can now correctly process certain scenarios that the previous version was unable to handle and had to skip.
In fact, the coding work described above took only one week. However, simply writing the code isn’t enough; an equal amount of time must be spent testing it. While debugging is one aspect, it’s even more important to fine-tune the scoring rules so they provide the AI with practical and accurate value judgments.
When designing the new AI architecture, I reserved some scoring adjustment interfaces for it. In the future, depending on the opponent, I’ll be able to adjust its playstyle through specific scoring adjustments, allowing it to learn how to use specific cards effectively. Of course, once the mod documentation is updated accordingly, modders can also use this approach to teach the AI how to better utilize the cards in their mods!
Of course, limitations still exist. The new AI’s performance in handling complex situations will still fall short of that of top human players; this is likely the limit of an AI based on a single-step scoring algorithm. To go beyond this, we would need to introduce an AI based on search, backtracking, and better board evaluation. However, this would not only require a more thorough code rewrite, but also more disruptive changes to the game’s underlying logic, and it would inevitably consume more time. Unfortunately, given the game’s current state, we may not have that much time to spend on it.