Weights And Limits

Limits

Limits are relatively simple, on their own they tell the AI how many of a certain unit it may build. Please note that a unit does not count toward this AI limit until it has been finished. If the AI had a limit of 3 Fusions and already owned 2, then it could still start building another 2, because its limit is only a limit of 3 or more finished Fusions. An AI will not cancel a building project once it has started. Your AI should take into account the possibility of building over the limit.

An AI also takes a second to check its limits once a building project has been completed. If you had a limit of 1 Construction Aircraft, your AI may build 2, one after the other because the plant starts the project before the AI can enforce the limit.

Limits also work alongside Weights for a much more complex effect.

Weights

A weight determines how likely (combined with the limit) the AI is to build a unit. A value is generated which can then be compared to all the other units in a single construction unit or factories menu, and you can work out an overall probability that this unit will be built.

Here is an example.

There is a plant, which builds 2 tanks, A and B.

A is weighted to 5 and limited at 2.

B is weighted to 2 and limited to 5.

No A or B tanks have yet been built.

The AI (we believe) then looks at the situation like this:

Unit Probability = Weight x (Limit - Number of that unit in existance)

So for this example you would have:

A: 5 x (2 - 0) = 10

B: 2 x (5 - 0) = 10

The total is 20. 10 / 20 = 0.5, which * 100 gives you 50%.

There is a 50% chance A will be built and a 50% chance B will be built.

Now lets say an A tank already exists. The sum would now be:

A: 5 x (2 - 1) = 5

B: 2 x (5 - 0) = 10

Total = 15

A: 5 / 15 = 0.33 * 100 = 33%

B: 10 / 15 = 0.67 * 100 = 67%

There is now a 33% chance A will be built and a 67% chance B will be built.

Please note that this is not a precise science, no one knows exactly how the AI works, plus there are many programmed safeguards that will sometimes override your AI profile. A good profile will take this into account.

The AI also reads the AI profile from top to bottom, and if A was higher up the list than B, it would likely get built more often because of it. For those of you using the AI Profiler, your units are stored in alphabetical order of unit codes.

Incidently, if a units weight is 0 but the limit is set higher than 0, the AI will build the unit, though not very often.

- Quitch