[Freeciv-Dev] Re: new version of ai evaluation of defense buildings patc
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> wrote:
> CHANGES
> - fixed off-by-one bug spotted by Markus L
> - fixed fake cacheing spotted by Greg B
> - renamed lots of stuff to better conform with impr. gen.
> - added evaluation of non-nuclear missile threat (low threat estimate)
> - doesn't get worried about invasions from non-transporting ships anymore
The patch looks good. It should go into CVS. A few minor quibbles that can be
implemented in your sequel. NOTE: Per does not have to do this. Just some nice
optional extras.
> FIXME (can wait until after cvs inclusion)
> - should try to estimate how strong enemy needs to be to be a threat to
> our defending units (now anything over 1 attack power is a threat)
> - also increase threat potential if above a certain % higher att power
> than our average defense power
> - not capable of realizing grave danger from sea. when starting an ai
> only game at techlevel 50 this shows clearly. (still, better than
> unpatched ai.) see point above (need to recognize superior threat
> from battleships earlier).
> - despeartely need a concept of oceans to properly evaluate sea threats
> (stop building those STUPID coastals right next to a freaking 1x1
> pond!)
There is an ocean implementation available today. Corecleanups 13.
> + FIXME: We should try to find the lowest common defence strength of our
> + defending units, and ignore enemy units that are incapable of harming
> + us, instead of just checking attack strength > 1.
> +**************************************************************************/
Should consider hps as well, not just attack strength. Greg's approx would
be good here.
> +void ai_eval_threat_init(struct player *pplayer) {
> + int i, nuke_units = num_role_units(F_NUCLEAR);
> + bool got_nukes = FALSE;
I have to admit the nuke units are the only change I can spot that is impr-gen
friendly.
> + if (pplayers_allied(pplayer, aplayer)) {
> + /* Just allies, we don't trust peace treaties _that_ much */
> + continue;
> + }
> +
> + city_list_iterate(aplayer->cities, acity) {
> + /* The idea is that if there aren't any hostile cities on
> + our continent, the danger of land attacks is not big
> + enough to warrant city walls. Concentrate instead on
> + coastal fortresses and hunting down enemy transports. */
> + int continent = map_get_continent(acity->x, acity->y);
> + pplayer->ai.eval_threat.continent[continent] = TRUE;
> + } city_list_iterate_end;
> +
> + unit_list_iterate(aplayer->units, punit) {
> + /* If the enemy has not started sailing yet, or we have total
> + control over the seas, don't worry, keep attacking. */
> + if (is_sailing_unit(punit) && is_ground_units_transport(punit)) {
> + pplayer->ai.eval_threat.invasions = TRUE;
> + }
> +
> + /* The idea is that while our enemies don't have any offensive
> + seaborne units, we don't have to worry. Go on the offensive! */
> + if (unit_type(punit)->attack_strength > 1 && is_sailing_unit(punit)) {
> + pplayer->ai.eval_threat.sea = TRUE;
> + }
> +
> + /* The next idea is that if our enemies don't have any offensive
> + airborne units, we don't have to worry. Go on the offensive! */
> + if ((is_air_unit(punit) || is_heli_unit(punit))
> + && unit_type(punit)->attack_strength > 1) {
> + pplayer->ai.eval_threat.air = TRUE;
> + }
> +
> + /* If our enemy builds missiles, worry about missile defence. */
> + if (unit_type(punit)->attack_strength > 1
> + && unit_flag(punit, F_MISSILE)) {
> + pplayer->ai.eval_threat.missile = TRUE;
> + }
You might want to consider making diplomats/spies defensively as a result of
if unit_flag(punit, F_DIPLOMAT) {
pplayer->ai.eval_threat.spy = TRUE;
}
But that's strictly optional. You might even make them as a result of
if (is_sailing_unit(punit) && is_ground_units_transport(punit)) {
pplayer->ai.eval_threat.invasions = TRUE;
pplayer->ai.eval_threat.spy = TRUE;
}
To prevent the typical sneak in spies off transport trick.
__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com
|
|