public inbox for xconq7@sourceware.org
 help / color / mirror / Atom feed
From: Hans Ronne <hronne@comhem.se>
To: xconq7@sources.redhat.com
Subject: Improved combat code
Date: Sun, 22 Aug 2004 02:46:00 -0000	[thread overview]
Message-ID: <l03130300bd4d9d8171d1@[212.181.162.155]> (raw)

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


             reply	other threads:[~2004-08-22  1:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-22  2:46 Hans Ronne [this message]
2004-08-22  4:21 ` Eric McDonald
2004-08-22  5:54   ` Hans Ronne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='l03130300bd4d9d8171d1@[212.181.162.155]' \
    --to=hronne@comhem.se \
    --cc=xconq7@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).