WAR O F WIZARDS Artificial Intelligence Information
Introduction
to WOW AI
When ever a player drops out from a game or special computer
charaters are setup within WOW it is the WoW AI (Artificial
Intelligence) module takes control of that positions actions. The
artificial intelligence is coverned by a set of algorithms, rules
and random triggers. This web page describes the basics mechanisms
in place to simulate this artificial intelligence.
AI Processing
Sequence
This section describes the sequence by which the system AI
module carries out is various processing steps. For each major
processing step that has further information a link will be
included to the documentation available.
- Analyse Player Presence - Determine what shires on the
map this player has a presence.
- Calculate Path To Capital - Attempt to calculate a path
to the capital city.
- Calculate Available Pop And Recuritment - Calculates the
number of peasants that are available to work in each shire, and
how of those can be recruited.
- Create General Global Orders - Create standard general
global AI Orders.
- Create Build Orders - Attempts to create build orders
for the player.
Simple Rules, Build all from a set then move on to buildings from
the next set.
Set 1 : TOW
Set 2 : TAV, INN
Set 3 : CHR, LIB, BKS, STB
Set 4 : DOC, BAR, INF
Set 5 : Remaining
- Create Recruit Orders - Creates orders to recruit
available units to aid in the defence of the player's empire.
Randomly selects an available unit that is not of the type behind.
The number to recruit is the number available, if that cannot be
afforded, then it tries to recruit a half, if still not able to afford, then a third,
and so on to a thenth, if still not able to afford then it doesn't recruit any
that turn.
- Create Produce Orders - Creates orders to produce
resources required to support and maintain units and create a
buffer for future activities.
First it calculates the maintenance requirement of all units,
heroes, ships that are currently controlled by the player. Note
that gold requirement at this stage is currently ignored. An ideal
resource buffer is calculated, this will then be produced after
maintenance requirements have been produced. The ideal resource
buffer is [WOD:2 STN:2 MIT:1 GEM:1 IRN:1 FOD:2] (Remembering that
Food is still the default for any excess production capacity.)
Multiplied by 100, and then multiplied by the current turn number.
Less the current value in the stockpile after planned recruitment
and building orders have been actioned.
The algorithm used for calculating each of production
requriements described above is : Start with the shires most
distant from the capital, and take their most abundant resource
that we have a requirement for, and produce that using 10% of the
available population, then move onto the next shire, moving in
towards the capital. Once we have reached the capital, go back to
the most distant again and use 20% of the remaining pop, continuing
until we are using 100% to try and meet the production requirement.
Stopping at any point though when the requirement has been
meet.
- Create Tax Orders - Creates orders to tax the population
to produce gold.
If morale < 2.5 then tax none, else if morale < 3.75 then tax low, else
if morale < 5.0 then tax medium, else tax high.
- Create Disband Orders - Creates orders to disband units
that can no longer be supported or are no longer useful. (Not
Implemented Yet)
- Create Feed Orders - Creates feed orders in an attempt
to increase morale. No focus on population growth as yet.
Set feed rate to 0 for every shire to start with.
Set feed rate to
1 for all towns, until out of food or shires.
Set feed rate to 1
for all other shires, and towns to 2 if their morale is less than
2, until out of food or shires.
Set feed rate to 5 for shires
randomly, where the morale is less than 4, until we are out of food
or out of shires.
- Create Move Orders - Create move orders to expand out
into surronding orders, and create a balanced defence. Still very
simplistic.
This algorithm currently works only on ground units and tries to
balance the military might of the empire evenly across its shires.
It does this by utilising the military ranking associated with each
unit. The military ranking for a unit is equal to its offence +
defence + ranged offence + movement abilities, then multiplying
this total by the sum of its number of attacks + hits. Each shire
is analysed one at a time. The units there plus any to be recruited
that turn have their total military rank tallied. That score is
then divided by the number of exits from that shire plus 1, to give
the military ranking that we are perpared to transfer to an exit destination.
If this transfer ranking plus the miltary ranking at a desitation is less
than the total military ranking at this location, then it creates move orders
to transfer a proportion of the units
from this location to the destination equal to the number of units
at this location divided by the number of exits plus 1.
- Include Shire AI Information - Adds some comments to the
orders on what other processing the AI has taken within this shire
that is useful to understanding descisions made by AI.
Questions?
If there are any questions about the AI module please do not
hesitate to contact WoW Games Admin WoW Admin
Ideas
These are the current ideas and thoughts that have been
suggested we incorporate into the AI engine.
- The AI aim should be to push up the morale by TAV, then INN,
then CHR construction with Low tax until all three are built then
High tax (keeps it simple). Or, perhaps there are two or three AI
paths available (morale/military/magic) that are randomly selected
by the AI when activated and then this stays with that realm for
teh rest of the game?. The magic would be to get to research MBL as
the simple combat spell for the wizard and (maybe) any heroes
hired?. After all the basic morale buildings are up (population
growth and income) the next step would be to improve units, as the
militia/peasant mob can only go so far, so it would be BKS and then
BAR. I suggest that unit recruitment is random from the available
choice, to a budget of 33% of treasury - if the resources are not
there then the recruiting fails for that turn.
- For expansion, the rule might be that when the number of units
in a shire equals (10 x adjacent shires + 10) i.e. 50 in the set-up
position, then 10 are advanced into each adjacent shire - this
means that after the first expansion there might be a delay until
the conditions trigger moves and there will obviously be a bit of
to-and-fro'ing but it is a simple rule to follow, and the ripple
effect with impassable terrain (oceans) and no region exits could
be very effective.
- Will the AI hire heroes or trade with caravans?.
- Will AI submit news and or blurbs to gain extra money in
playtest games?
- For the AI to be effective it has to provide as much resistance
as possible to adjacent players particularly in the early expansion
phases. Although it would be more realistic for certain races to
play peacefully and research Druidic, from a programming point of
view I think we have to keep it simple. This probably means
researching Dark, expanding until a battle occurs and then
re-enforcing the out lying shires. There should also be a random
chance of massing an army for an attack on enemy shires. As far as
construction goes the early building types seem to be agreed
upon.
- Having said the above, I think the more predictable the AI is,
the easier it will be to defeat by an experienced player. I realise
there are limits with regards to programing but while trying to
stick to the strongest AI stratergy I think a number of random
variants (possibly based on race) should be built in.
- If we do get the AI working, I don't see any reason for it to
wait until Turn 4 to kick in. If a player intending to play misses
the first turn it can be devestating for the entire game. AI orders
could be issued automatically when a turn is run (with a copy
attached to the bottom of the turn report) and then superceded as
soon as the player issues their own orders. I'm not sure how much
system resources this would chew up but this could automatically
happen every turn with the player having a GLOBAL ORDER switch such
as AI YES/NO if they don't want it. This could also help with the
problem of the overuse of the DELAYGAME order as basic orders could
still come through when a player can't submit them. Anyway
- Other thoughts and comments from Darrell and Ragnar
Production
*************
# The MAJOR GLYTCH in the AI means that production is not maximised as
detailed below:
SHIRE Producing Total Population
637,5 All that can building and recruiting if not producing
637,1 95 508
637,2 95 503
637,3 All that can
637,4 50 513
226,1 93 497
226,2 90 477
309,3 All that can
752,1 All that can [taken this turn]
752,2 All that can [taken this turn]
752,3 101 537
752,4 95 502
752,5 All that can [taken this turn]
This deprives the realm of 2918 peasants' production.
Hopefully a relatively easy one to fix?.
As my last notes, might I suggest that the Two key parameters in the
resources are Food and Gold with others only required to build and to
maintain units beyond the basic ones.
So the algorithm should look to maximise food production [using PRODUCE FOD
only] and gold income to (say) cover outgoings plus a percentage to build
the stockpile [TAX levels discussed later] and then look to each shire not
already set, and produce 100% the primary resource just as it does on
controlling a shire. If two or more resources are equal (F:3 W:3) then
divide the population equally PRODUCE FOD (50%) PRODUCE WOD (50%). This
will maximise the available production.
Expansion
*************
# This turn was particularly good in that the AI killed a Giant Scorpion
and took control of 4 new shires, it looks like this was achieved because
the wandering monsters moved out of the way. The Move order remains a
stumbling block to active expansion as the presence of a lone unit will
stop the advance of a much larger force. Whether it would be right to set
all moves to ATTACK is debatable, but I would prefer it to the current MOVE
orders.
# AI (2) could actually break to the surface when turn 11 runs, since 752,1
has a link to 646,1 and the roll-out could go there. This is where the AI
improvements are such a fantastic step forward.
Feeding
**********
Possibly compromised by the glytch above, the AI set 6 of the 9 shires to
FEED 5 and effectively trashed the food stockpile. There were no
inbetweens, either FEED 1 or FEED 5. A valuable tool, it needs to be used
in a targetted fashion. In this game, I have used it extensively on the
Arctic region where starting populations are in the low 20's - the cost is
minimal until the population grows. In game 262, my Sand People are
benefitting because FEED 5 only costs 2.5 food units. Halflngs and
Icelanders benefit to a lesser extent. The use of FEED 5 (or 3/4) needs to
have a purpose within a strategy, and that is very hard to define in AI
terms. Because of the +0.9 morale, it is very useful to drive up morale,
especially when combined with TAX N, or it can facilitate TAX H before the
morale buildings are built.
Income
*********
There are shires with morale 4.35 that are moving from TAX L to TAX M when
the better step is to have TAX N and raise the morale to 5.00 ready for TAX
H next turn. This is a very subjective area and each player will have their
own views. There are shires with TAX N going to TAX L where the morale of
2.88 does not warrant this at all.
Maybe the algorithm could say "Condition A: All factors allowed for (FEED
rate, TAV etc) what Tax rate will increase the morale or maintain it at
5.00, start at TAX H and work down by level until condition A is true" -
then calculate the realm revenue. IF the realm stockpile rises after
expenditure (Condition B) then that is the tax rate to apply. IF it does
not, then repeat for each shire dropping the tax rate 1 level until
condition B is true." Relatively simple but recursive code can hog CPU and
take ages.
Recruitment
***************
The stream of recruiting is good for having a defencive capability and not
being a simple roll-up victim, BUT it damages the population and where
mecenaries are offered e.g. 15 HBO last turn. these are far preferable to
loss of population.
# Could there not be some self-limiting factor e.g. maximum units per shire
owned, to stop the crippling of the city population, but allowing for
reinforcing to the edges of the realm?.
Caravans
***********
A very difficult proposition because the how, what and why of caravan
trades will vary with every player. Simple ideas like "have loads of it -
SELL it" are obvious ones, and "Got none - BUY it" equally so, but the kind
of co-trade deals that players make would be frightful to code. No caravan
this turn so no problem there!.
# this report offers a caravan, it would be useful to see if any simple
trade algorithm could be applied, if the offer remains on the re-run?
Mercenaries & Heroes
***************************
This turn there are 36 DSO and 28 THU on offer but far too few funds to
hire both - I would go for the 28 THU personally, and forget any
recruitment but how does the AI work it out?. I have no clear idea really.
The heroes have been on offer aplenty, but which one and to what end?.
Since magic and hero spells is problematic, the only reason is for
leadership in battle?.
Previously said about no espionage heroes, but the Diplomat on offer is
less preferable to me than the THU, in this AI's case. In my playing style
I tend to hire anything that is offered, if I can afford it..
Building
**********
The concensus on the building list was fairly targetted and so the
buildings ar enot an issue, but the quantity of resources built is a real
topic of debate. With 569 peasants in the city, recruiting 113 is not
advisable, (see above) especially when there are already 411 in existence!.
To then only build 170 onto the CHR is a weakness as it will take over 4
turns to finish, when the benefit in morale i s needed asap to get morale
up across the realm and thereby maximise the revenue stream.
# Really approve of the fact that the AI orders for turn 11 included a
BUILD TOW in the central shire it took, an excellent improvement.
Magic
********
With 72 RP's the AI is wasting opportunity - if gems were aplenty, I would
go for Summoning and then summon Sprites to bolster the defences/attacks.
The other logic would be to go for Scorcery and Will to get MBL and then to
give it to wizard (SPELL 0 MBL 1 1) and any heroes that might be hired.