This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Improved combat code


Steps 1 and 2 on my revised agenda for an improved combat code have been
completed. There are now two new tasks, TASK_ATTACK and TASK_FIRE, which
act as subtasks to TASK_HIT_UNIT. If the view of a targeted unit is bad,
these tasks will still schedule an attack or fire into the empty cell
(which the side should do, since it wrongly thinks that something is
sitting there). The attack against the empty cell is mediated by a new
action, ACTION_ATTACK_CELL, which works like ACTION_OVERRUN but without
moving into the cell. For firing into the empty cell, ACTION_FIRE_INTO is
used.

Importantly, the new tasks will clear the bogus view at a rate that can be
set by clear-unit-view-rate. This rate is 50% by default, so each shot at a
bogus view has a 50% chance of clearing it. This fixes the bug that would
cause the AI to cycle indefinitely under certain conditions, and which
prompted this entire overhaul of the combat code.

It should be noted that the AI code deals with attack and fire, but then
sets a hit-unit task at the end, without specifying how to hit. So the task
execution code has to partly redo the job, and figure out what the AI
wanted it to do. It is my intention to eventually get rid of this
duplication, and have the AI set TASK_ATTACK or TASK_FIRE directly.

Other changes and fixes:

1. Several other bugs that would cause buzzing in the AI code have been
fixed. See the ChangeLog for details.

2. The end-of-turn process has been speeded up significantly by reducing
pointless plan executions for units that cannot do anything.

3. Unit images are now updated correctly when a unit is wrecked or changes
type.

4. I have long been frustrated by the stupid behaviour of units within
transports, which act as sitting ducks in the presence of an enemy. I have
therefore added code that makes a unit disembark before a fight if its
fighting ability is significantly reduced as an occupant.

5. Finally, I have added a new table, hp-on-creation, which makes it
possible for a unit to get more than 1 hp on creation. This is useful in
games where units are created outside the creator, and therefore more
vulnerable to attack before they have been completed.

Hans



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]