AI
The computer units plan their activities depending on what type
of object they are curretly holding. This comes in three
varieties: Ranged for objects with the ranged weapon set, armed
for units with the combat property set and unarmed for units
neither property set.
Ranged. If an enemy unit is in sight and there is a valid line of
sight, then open fire. Otherwise move towards the nearest square
which gives a line of sight.
Armed. If an enemy is in sight then attempt to move into the same
square.
Unarmed. Just keep moving along the path set by the unit's
waypoints.
This all works quite nicely. My problem comes when the computer
spots an enemy unit. Obviously it would make more sense if it
sent reinforcements, rather than the spotting unit fighting on
alone and all other units going about their business. The most
heavy handed and obvious solution would be to set all allied uits
to have their next waypoint as the spot where the enemy unit was
spotted.
However, this causes a problem when, say, in the Moonbase
scenario a unit is spotted in the northwest corner of the base.
All operative units would scramble up there, leaving the way for
the units in the bottom right corner to saunter through
unmolested. So I need some way to balance. My current thinking
would go something like this:
1) An enemy unit is spotted.
2) If the enemy has not been spotted before and has no
interceptors assigned then set some unassigned units onto it.
(How many? A fixed number? A percentage of those available? All
those in a certain distance, and what if no unit is available
that matches this criteria?)
3) If the enemy unit has been spotted then update those units
assigned to it with the latest position. But what if they have
been killed off? Are new units assigned?
Those assigned units will move to the last spotted position and
either move to attack or open fire, depending on their weapon.
The tactics needed to assign units might need to vary depending
on whether the computer is on the offence or defence. Remembering
that if the computer never knows how many units it is up against,
how does it decide? Oh, decisions, decisions!
And unlike someone suggested, 4 dimensional neural networks
are not an option. It will all be done using basic rules.