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]

Changes to the xconq firing code


I have just checked in a number of bug fixes, but also some more
substantial changes to the code that game module writers need to know about
(see below).

The player setup dialog size problem in the tcltk interface has been fixed,
at least for those cases that where due to Open Game being used instead of
New Game.

Xconq would crash if the maximal number of sides (15 + indepside) were
used. I have now fixed this. I presume that nobody ever played a 15
side-game, since there were no bug reports about this :-).

The most important changes, however, are to the firing code. This was
prompted by Lincoln's bug report a few days ago. The bug itself was easily
fixed - it was just a typo. However, while reviewing the firing code I
found several other problems. Most of them were due to the fact that the
firing code defaults to attack tables if there are no specific fire tables.
For example, hit-chance is used by firing units if there is no
fire-hit-chance. This can save some work for game designers, but it creates
problems when the same unit both can attack and fire. Thus, spaceships in
the galaxy2 game would be unable to fire their torpedoes if they ran out of
the antimatter needed for normal attacks. A related problem occurred with
the fire-into-cell command. Since the ammo-checking code was shared between
normal attacks and fire, the game did not check for ammo at all in this
case where no specific unit was attacked. You could therefore fire even if
you had no ammo left, and end up with a negative number of torpedoes.

After going through the code I came to the conclusion that these bugs can
be fixed for good only if the attack and fire code is separated more
clearly. I have therefore made the following changes in the GDL:

consumption-per-fire no longer defaults to consumption-per-attack. If you
want a unit to use up ammo while firing you must now include a
consumption-per-fire table.

material-to-fire no longer defaults to material-to-attack. If you want a
unit to be able to fire only if it has some specific material in its
possession, you must now use material-to-fire.

BTW, the material-to tables were misused in some games. They are not
intended to specify consumables (ammo) but rather more permanent equipment
such as guns that you may need to fire. It is not necessary to set
material-to-fire to a certain value if you have already set
consumption-per-fire to the same value. The pre-flight firing and attack
code always checks if you have enough ammo left.

These changes affected all games with units that can fire, and where
materials needed or consumed also are specificed. Fortunately, there were
not that many of them in the library, and I have fixed all of them. In the
process, I also fixed the ww2-div-pac based set of games so that airfields
and airbases would work.

Those of you who are working on games with units that can fire have to make
the necessary changes yourself, however.

Hans

P.S. I have not separated hit-chance and fire-hit-chance yet, but I am
looking into this option as well. I therefore encourage those of you who
are writing new modules to always use a separate fire-hit-chance table for
units that can fire.









Hans Ronne

hronne@pp.sbbs.se



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