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]

Re: CRT Combat Model (long)


>OK, I've reviewed 3rd-age.g and civ2.g and tried to make sense of model 1
>combat.  I should probably play these games to see how things work, but the
>xconq design notes should explicitly describe what's going on.  Both games
>indicate table damage u* u* 1 and table hit-chance u* u* 100, with defender
>value affected by table neighbor-affects-defense.  It's not clear if the
>attacker value vs defender value, as modified, affects the hit-chance,
>damage, or both.  Does a 2-1 attack mean a 200% hit-chance, double damage,
>or what?  Likewise, would a 1-2 attack mean a 50% hit-chance, half damage,
>or what?  This is not at all clear to me.  I assume only the unit-defined
>attack and defend values are used in the model, regardless of actual hit
>points.  So a unit with attack value 10, hp-max 10, but only 5 hp currently,
>would still attack with 10, not 5?

Yeah, the documentation is not up-to-date. The best way to figure things
out is usually to examine the code. In this case, look at model_1_combat:

    while (alive(unit) && alive(defender) && limit-- > 0) {
	att = real_attack_value(unit);
	def = real_defense_value(defender);
	winround = probability((att * 100) / (att + def));   <----
WIN/LOOSE PROB
	if (winround) {
	    dmg = roll_dice(uu_damage(u, d)); <---- DAMAGE DEALT
	    victim = defender;
	    defender->hp2 -= dmg;
	} else {
	    dmg = roll_dice(uu_damage(d, u)); <---- DAMAGE DEALT
	    victim = unit;
	    unit->hp2 -= dmg;
	}

As you can see, there is first a decision who wins each round, which is
based on the real attack and defense values. The latter are based on the
unit-defined attack and defend values, but with all the terrain, occupant,
transport and neighbour effects factored in (check out the functions for
setails). So in short, all these things only affect the probability that a
unit will win or loose one round.

Once the round has been decided, a dice is rolled to decide how much damage
is dealt to the looser. This is where the damage table comes into play. So
what about the hit-chance table? Does it have any effect at all in combat
model 1? The answer is no. It is there for another reason: to decide which
units can at all attack other units. if you examine 3rd-age.g you can see
that the hit-chance is 100 for most unit vs. unit combat, but 0 for unarmed
units vs. units, facilities vs. units and cities vs. units. This simply
reflects the fact that these units are unable to attack anything. The check
for ability to attack at all is in check_attack_action, long before we
reach model_1_attack.

With combat model 0, things are very different. The relevant code is in
maybe_hit_unit. First, the hit-chance table is used to decide the
probability that the attacker will hit its target. So it is very important,
unlike in combat model 1. Various terrain effects and protection by other
units also factor into the final hit chance. Note that these are determined
by other GDL tables (e.g. protection) than those used in combat model 1.
The reason for this is that I tried to avoid a situation where the same
table would be used in different ways, depending on the combat model. The
only exception to this principle is the hit-chance table.

The damage in combat model 0 works the same way as in combat model 1,
though a slightly more complicated formula is used which also factors in
unit experience. So the damage table is important in both models.

There are som further complications you should be aware of. One is that
while the protection table has no effect on combat in combat model 1, it
does affect capture chances. This is because there is incomplete code
separation between the two combat models (see my comments in 3rd-age.g for
more details and for how to handle city capture). Another confusing thing
is the fact that the definition of protection in combat model 0 is (I
think) counterintuitve: 0% protection is full protection (actually 0%
hit-chance), while 100% protection is no protection at all (actually 100%
hit-chance). Please note that I changed this in the new tables I wrote for
combat model 1, so they behave the way you would expect them to. For
example, occupant-affects-defense works like this:

100% means no effect at all (multiply defend value by 1)
200% means doubled protection (multiply defend value by 2)
50% means halved protection (multiply defend value by 0.5)

>Also, model 1 indicates combat continues until a participant is destroyed.
>Does each round require acp, thus permitting combat to be limited, or are
>units charged acp once at the start and then fight unlimited rounds to the
>death?

The fight itself does not consume acps in combat model 1, unlike combat
model 0. This is to ensure that it always will continue until one side
looses, which is the expected behaviour in civilization type games. Also
note that the combat model 1 attack is actually a specialized case of the
overrun action in combat model 0.

>I would like to limit units to only one attack per turn but allow
>defense/counter-attack against multiple attacks.  Can you define different
>acp limits or free-acp for movement, attack, defense and city capture?

This you can do in combat model 0, but not in combat model 1.

>Is it possible to define model 0 for some combat and model 1 for others,
>or are you locked into an either/or decision for all types of combat?

You can have only one combat model in a given game.

>Here's an simple example for AH Third Reich involving two 3-3 infantry units
>moving to attack a 1-3 infantry unit doubled on defense in a hex with a
>city ....

You can't emulate AH exactly with either combat model 0 and 1. First you
have to decide which model you prefer, relative hit-chances (model 0) or
absolute attack and defend values (model 1). I find the latter easier to
work with, but this is a matter of personal preference.

Next, you have to figure out how to best emulate your favourite game within
the given rules of a combat model. In the case of combat model 1, this is
pretty much the same problem as converting your game to a Civ2 scenario,
since this is how the model works. If you check out the Civ2 fan sites, you
will find that several other games have been recreated as Civ2 scenarios,
so it is not too difficult. Combat model 0 is supposedly derived from an
ancient game called "Empire" which I never played myself. So in that case
you should think of your task as converting your game to an Empire scenario.

There is one big advantage with using xconq for this kind of game
emulation, and that it the huge
number of customized options. If you look through gvar.def, mtype.def,
ttype.def, tables.def and utype.def you can find GDL support for almost any
kind of game option in the kernel. I recommend careful reading of these
files and the corresponding kernel code for any serious game designer.

Of course, an easy way is to copy a working module (e.g. standard.g,
advances.g, or 3rd-age.g) and tweak it until it resembles your favourite
game.

Hope this was clear,

Hans










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]