Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] Re: old/bad code in autoattack.c (PR#351)
Home

[Freeciv-Dev] Re: old/bad code in autoattack.c (PR#351)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: thue@xxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: old/bad code in autoattack.c (PR#351)
From: Nicolas BRUNEL <brunel@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 29 Apr 2000 21:39:42 +0000 (GMT)

> In server/autoattack.c a simple comparison of the unit types' defence values 
> is
> used. This is far too crude. It does not take in to accound terrain and 
> special
> bonuses like pikemen vs horses

It's really too crude. I'm afraid the same formula is used when a town is
defending itself. I saw many warriors wasted in an attemp to destroy a
phalanx on a mountain. It would be better to build a more powerfull
attacking unit. One day someone will have to rewrite the code responsible
for that.

I propose :
   - (1) to build enough defending units to survive the attack.
   - (2) build attacking units to destroy the units close to the town.

Instead of using asses_defense and assess_defense_quadratic, we can calculate
 the number of turns the town will survive. Now, AI spends too much money
building units in a hurry to defend itself. Any improvement in this code
will speed up AI science developpement. 

I don't know how AI selects the city to attack. I suggest
 
    - (1) Try to destroy enemy capitals.
    - (2) Try to take usefull wonder. ( A republic without JC cathedral is 
    less powerfull )
    - (3) Try to capture cities which produce many shields. They will be
easier to defend and will produce soon new units.
    - (4) Try to build easy to defend zone. It's better to take five
cities on one island than one city on five islands.

   To sum up, AI can be improved. :-)

> Also, why does it use
>       if (debug) freelog(LOG_DEBUG, ..);
> instead of just 
>       freelog(LOG_DEBUG, ...);

freelog is itself a macro which do the same test as above.
So, yes, it's useless.

Bye,





[Prev in Thread] Current Thread [Next in Thread]