General AI

From OPU Wiki


Table of contents

Background

What is General AI and Why is it Important?

If you have ever paid close attention to enemy colonies in Outpost 2, you might notice that the enemy always builds them in the exact same way each time you play that map. This is because the OP2 AI is, in a word, fake. Each map containing enemy units has a set of instructions attached to it that determine exactly what units and structures the enemy will build, where, and in what order, as well as where each unit will move, how they will defend themselves, and how they will attack. Aside from a few bits of randomness (such as what direction an attack wave will come from), the AI in OP2 will perform the exact same way each time, and its behavior and development must be manually reprogramed for every new map it is added to.

Some members of the OPU community have taken on the task of programming a General AI, that is, an enemy that can be placed in any map, in any situation, analyze that situation, and respond to it in unique ways. Ideally, such an AI would be able to present players with far more of a challenge, use unpredictable stratageies, and even be able to hold its own in multiplayer games.

General AI

The way the AI choses between certain "Goals", like which building to build, or what weapon/technology to research (I haven't played but a few minutes of OP2, so I'm generalizing), by giving each goal a "weight", a number that represents that goal's importance. The way the goal's weight is set is determined by the specific need for that goal. This need could be a lotta of things in a lot of game situations. Oh, and this also can be used to make a desired goal list, where the most important and primary goal is put at the top, then the ones that are secondary are right below, and it continues down. But, when one goal is finished, the goals in this list are re-evaluated, and resorted, based on their *current* weight, determined, again, by changing game situations.


I'll be looking into this further soon enough. Once i got this dynamic repair-list going, i'm going to look into a replacement class for BuildingGroup as well, using the same method.

Any help is appreciated.

signed: Eddy-B

Project start

The AI is controlled using several ordered lists: a building-order, a reasearch-order and a vehicle order.

Instead of designing a general AI, i started off creating a Colony game which had in fact an AI. In further developping the colony mission, i added new 'algorythms' to the AI, one at a time. I will try to line out what they do, and for what purpose.

AI Algorythms


In order to work with the groups as descibed below; the AI will keep a list of all groups it creates. There are Building groups, VF groups (which are building groups also), Guard groups, Collector groups and Attacking groups.


Building groups

Each Structure Factory will be assigned 1 Building Group. The Building Group can contain one or more ConVecs and an Earthworker. It usually also contains 1 RoboMiner.

When a new building is added to the building list, the AI finds the closest active BuildingGroup and adds the new building to the building list. This also happens for mines: the building will then be built by the miner instead of a ConVec.

The AI checks the new building orders for tube connection. If none is avialable, a new tube construction order is sent to the closest BuildingGroup (should be the same group as the one that's building the structure itself).

When ore is abundant, the AI will start adding walls to the building list. Again, it selects the group closest to the wall position.

Personal tools