Artificial intelligence and more

This is a brief progress report to give you an overview what work has been completed recently and when the newly designed AI for Heroes V can be expected to go live so that you can try it out hands-on.

The reason why this progress report makes sense now is that a few days ago an important milestone was reached: the design of the AI is complete. Let me explain why this is significant and what it means in terms of tech and for the strategy game.

The work I have done on AI in the last years was primarily to figure out how to build a new type of advanced AI that can recognize what events can occur in an interaction space and deduce from this what course of action serves its goals best. This sounds deceptively simple and as a human being you grasp the concept effortlessly but from an AI point of view it requires to trace an abundance of basic events (the interaction space) and then interprete what can happen to develop a sense of what is desirable. It is clear that such an analysis centers on the impact of events, but an impact can be direct, indirect and affect an outcome in subtle and even counterintuitive ways, like a sacrifice in chess, with consequences that are hard to predict. So it requires an entire set of methods that allow an AI to recognize what has value in large interaction spaces with countless possibilities that are infinite in the classic Greek sense. Particularly if you want this AI to pass the threshold of guesses and heuristics and to go about its task methodically with a high degree of accuracy.


Figure 1 gives you a conceptual overview of the design of the AI for Heroes V.

Conceptional view of the upcoming Heroes V AI. Larger picture available here.

The key challenge that needed solving is to gather all the data that is necessary for the AI to develop a strategic plan, with accuracy and the required level of detail, and then to maintain this level of focus through the entire pipeline of processing the data. There is of course a recursive dependency in the form that you don't know what is important until you have a strategic plan, so you have to make reasonable guesses to arrive at a first strategic plan, visit the data again to check whether it serves its original purpose, expand and adapt it, and iteratively refine the work-in-progress strategic plan.

Essentially a strategic plan is for the AI rather a guidance that it develops itself and then goes about to hone it by analysing all the dependencies, events, their impact and so on. So what we are talking about here is a form of abstraction that so far hasn't been mastered.

The main task steps in figure 1, event parsing, coordination, leverage and strategic valuation, have emerged during the years as the key methods to solve this particular technological challenge. Naturally there is technically much more to it than these relatively simple monikers suggest.

Software architecture

Figure 2 gives you an idea of the software components that need to be implemented to make this AI a reality.

The software components that need implementing. High resolution picture available here.

The different components and their associated data structures do not only need to solve so far unmastered technological challenges but also have to do this as performant as possible. In principle the AI design allows for an iterative process to develop a strategic plan, i.e. a first rough plan is found relatively quickly, but its worth depends mostly on how much data and dependencies the AI can process in a limited time in order to arrive at a fairly accurate and sound plan that matches what humans can come up with. To solve this challenge this AI design utilizes a number of innovations that allow for the abstraction of events, leverage, decision making processes and such to make the processing as efficient as possible.

There is a particular reason why I consider the AI design complete now and a major milestone. All the different components and the way they work have reached a level of completeness that I can say with confidence that they will perform their intended objectives. This is truly a difference to how things were before. I have been multiple times at the point where I believed that I have an AI system that is worth implementing, and only realized when I began drilling deeper to begin implementation that there were still major functions not solved satisfactorily. This is different now, all the steps required to assess whether this AI design can be implemented successfully, in terms of achieving its goal, have checked out this time and what remains now is its implementation for real. There are a lot of individual pieces, concepts, mechanics and methods that integrate neatly with each other and together perform the desired function. While this might give the impression that this design was developed specifically for Heroes V, in fact the AI was developed on a much more abstract level during all the years. Figure 3 further below shows that underlying the specific AI design for Heroes V are much more general concepts how such an AI needs designing in principle. The solution itself was developed on this generic level, which is another reason why I am sure that the AI can do what I expect. The challenge is on an abstract level not less formidable, but on this level things become much more clear and it is more easy to verify whether a certain design fulfils the requirements. Once you have the general solution you can go about developing specific algorithms that implement it. Usually during this phase more issues and problems pop up and solving these verifies the approach on an abstract level and confirms that it can be implemented successfully.


On the coding front it requires well crafted and compact highly performant C++ to implement this design. To give you an idea of the amount of code required, you look at something like 50,000 lines of C++ code. Additionally I would like to port the H5 AI process to 64-bit, it has been 32-bit so far.

Given this sizeable task, you might wonder when Heroes V with the advanced strategic AI will be ready to play around with. Coding should be fast and the chances are good that we will have a first playable build in approximately one month. I worked with this speed before when I did major refactoring work. Once all specs are nailed down, writing code becomes straightforward, the C++ almost emerges naturally in my mind. Plus if you look at figure 2, the parts that are actually new are the components with a yellow background colour, i.e. a lot of the code can be reused one way or another. Still it is a lot of work, so please take it as an ETA.

In a way this prototype has become a key to move forward with my life, which is another reason to get this work done as fast as possible. Figure 3 shows what this AI can do conceptionally. There are in principle no limits as to what it could be used for, if it is successful it marks the transition from machine learning (ChatGPT et al) to algorithmic AI. It is like an upgrade to fusion power, all the components, even the established rules, can be implemented in a programming language like C++ or Rust, the result of which is a magnitude of order better performance, reliability, accuracy and versatility, not to mention you can monitor and trace what the AI is doing. Particularly for games this AI opens up an entirely new level of productivity to create highly reactive gameplay. It isn't limited to strategy or turn-based games, it is a general AI solution.

The general AI architecture behind it. High resolution picture available here.

But let's not get ahead too fast. Let's see what this prototype tech actually can do. It should be fun to figure this out, and for Heroes V fans there is also a surprise coming that will upgrade the playing experience further.

You’ve successfully subscribed to Quantomas AI
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.