RTS Construction Layout AI


So, I am trying to create an AI to handle the construction layout of a real time strategy game like Age of Empires II. The process has too many steps to be handled effectively by brute force, but also has enough structural requirements that it also cannot just be done randomly.

Assuming a limited area to work with, which can be represented by tiles, the AI must be able to place several structures within the area. A layout once fully created can be given a score based on the pathable distance between certain structures as well as a few other factors. If paths between certain structures become completely blocked, the AI has failed.

The starting area that is defined by tiles is also random in nature, containing a few predefined elements that the AI cannot control, which include randomly placed terrain and resource nodes.

I know this problem case has been quite vague, but the actual question relates to the type of AI that would best fit solving this issue. I currently have an algorithm that runs through what it believes are the best few results in a series of steps trying to create the most optimal layout, but it fails with many starting layouts, which require manual adjustments to the AI before it can process them properly. Even then, it is just an approximation at best, since it starts out assuming that the steps I gave it to check contain the most optimal layout.

Here is an example of what a finished layout might look like. It doesn't state which colors are which objects, but it might help in determining what type of AI I should be looking at using.

screeps example


Posted 2018-02-08T14:39:26.087

Reputation: 31



Because the OP was a bit longer, I made a small mindmap to illustrate the topic and a possible answer. At first, the problem is called “Walling” and is described in the literature in the context of the “Starcraft AI” challenge. The question was, where to place buildings to win the game. A possible answer to the problem has to do with formalization of knowledge. Usually, the human player is aware what a good layout is, and he also knows where to place his units. The question is only how to express this knowledge in sourcecode.

In my opinion the answer is called “Computer based training”. CBT is a technology, not with the aim to program an AI, but to formalize knowledge in a game for training human players. The idea is, that a human player plays the walling game, and while he is doing so he learns to take the right decision. From the standpoint of AI it is important, that every CBT game has an evaluation algorithm which is often called a tutorial mode. This is done in cases. For example, in case 1 the player learns how to use a given terrain, in case 2 how to protect the structures and so forth. So my recommendation is, at first create a computer-based training game as a tutorial for human-players, and use the formalized knowledge in step 2 for building the AI for “Starcraft AI walling”.


Manuel Rodriguez

Posted 2018-02-08T14:39:26.087

Reputation: 1

This reminds me "strategy ladder" approach I'm planning to use with M-games, prior to some form of deep learning. It's can be instructive for humans to play a series of automata that rely formalizations of sets of pure strategies, which they can learn to beat. – DukeZhou – 2018-11-06T02:22:48.133

Also, this strikes me as a localized approach to what is largely a local problem. (Is that a correct assessment?) – DukeZhou – 2018-11-06T21:02:48.463