Cruzada

Upload your latest creations here.
Please note that by posting comments to posts in this forum you forfeit your personal copyright on whatever you post. AI Scripters reserves the right to re-use objective comments in script reviews without requiring the posting author's permission. Credit, where appropriate will be given in such cases.
Post Reply
Archon
Waheguru
Posts: 1905
Joined: Sat Nov 08, 2003 9:22 am

Re: Cruzada

Post by Archon »

I guess this is related to the fact players-unit-type-count does not work with unit classes either.

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Cruzada

Post by Campeador »

New version of Cruzada uploaded.

Quite stronger. It could even compete in the Ladder with a decent performance. I've said decent, not a top AI... yet. :devil

I've changed the Threat file, so now it counts several types of units to add them to know what dangers we have to counter. But it still doesn't work. I've included a debug rule in Threat.per to know what values have the g-threat-xxx goals, and they are always zero but the g-threat-tower. Even when my AI sees enemy units.

So now Cruzada makes always archers and eagles. Nice for most situations, but not 100% adaptable.

Despite to that, to be still incomplete, a few more bugs here and there, etc, it can face and sometimes even win, a few of the Ladder AIs. So you can use it even to test your AIs against an archer/eagle script.

Another thing that I need is a file which includes the gathering rates of villagers, with several techs, the training times of several units, etc. I had one when I was an active scripter but I don't find it in my PC. Could anyone upload or link it? It should be useful to calculate how many military buildings should I do depending of the number of my villagers.

Emperor Justinian
Forumer
Posts: 28
Joined: Sat Sep 22, 2012 12:32 am

Re: Cruzada

Post by Emperor Justinian »

Campeador wrote:Another thing that I need is a file which includes the gathering rates of villagers, with several techs, the training times of several units, etc. I had one when I was an active scripter but I don't find it in my PC. Could anyone upload or link it? It should be useful to calculate how many military buildings should I do depending of the number of my villagers.
From the main AIScripters page, go to "Age of Empires Scripting" => "Resources" => "Reference Library" => "Other potentially useless info garnered over time". I think those are the files you are talking about. The unit table spreadsheet is for 1.0b, so you may want to look for more up to date information if possible.

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Cruzada

Post by Campeador »

Thanks Justinian.

I was sure that i had found those files by myself a few years ago, but currently I am too rusty in a few aspects. I'll use that info to have a correct number of military buildings in castle and imperial age. For example, in my last test vs Nosferatu it didn't dare to trush me because after my dark age improvements Cruzada prepares a feudal army quite fast. So it towered its own base instead. But later Cruzada trained to many eagles and xbows without enough upgrades because too many buildings. So it smashed in late castle.


About the other problem.

Here there is a line which should detect enemy eagles:
(up-get-focus-fact unit-type-count-total eagle-warrior-line g-threat-eagle)

Here there is a line in the code of The Horde which detects enemy galleys:
(up-get-focus-fact unit-type-count galley-line math-goal3)

The ony difference that I see is among unit-type-count and unit-type-count-total. Could it be the reason? Other things that could be are:

a- My AI doesn't focus well an enemy. But I find it too strange, because it should be always the closest enemy with this rule:

Code: Select all

(defrule
	(up-get-fact military-population 0 g-math-1)
=>
	(up-find-player enemy find-closest g-math-2)
	(up-modify-sn sn-focus-player-number g:= g-math-2)
	(up-get-focus-fact military-population 0 g-math-3)
	(up-modify-goal g-math-3 c:+ 5)
)
b- Bugs in my Threat file, but I dobut it.

c- I have initialited a few goals to zero in my Start file, but not most of them. But it should affect just in the first seconds. I give them values always in every rule pass later.

Archon
Waheguru
Posts: 1905
Joined: Sat Nov 08, 2003 9:22 am

Re: Cruzada

Post by Archon »

Did you test (up-get-focus-fact unit-type-count eagle-warrior g-threat-eagle)? Same guess as last time, unit-type-count-total works only on yourself (e.g. up-get-fact unit-type-count-total ...), similar to the old command.

(up-get-fact military-population 0 g-math-1) is listed as an action is the scripting reference guide that comes with the UP. So the rule should be:

Code: Select all

(defrule
   (players-building-count any-enemy > 0)
=>
   (up-get-fact military-population 0 g-math-1)
   (up-find-player enemy find-closest g-math-2)
   (up-modify-sn sn-focus-player-number g:= g-math-2)
   (up-get-focus-fact military-population 0 g-math-3)
   (up-modify-goal g-math-3 c:+ 5)
)

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Cruzada

Post by Campeador »

Thanks.

Next weekend I'll try changing those xxx-total from the enemy by xxx without -total. And adding that buildings-etc > 0. I forgot that you have to be sure that you can compare before to do it. :lol:

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Cruzada

Post by Campeador »

Uploaded again.

Now my threat detection works sometimes with archers. Sometimes not. And it's always a fail against other menaces.

Cruzada uses now two different files for the goal-threat-xxx. One is used when no enemy buildings detected, the other when they are.

I don't understand why a few goals like g-threat-monk and g-threat-cavalry-archer give even negative values.

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Cruzada

Post by scripter64 »

I was just checking Threat 2.per and (players-building-count any-enemy == 0) in these rules should be "every-enemy", I think, to ensure it only works when no enemy buildings are sighted. For the negatives, enemy monk-with-relic cannot be counted separately without DUC (game doesn't account for dynamically switched units without a train/build location in the enemy sighted unit counts) and the elephant archers are invalid for aoc, so they will each be -1 (per counted player for the sum, too, so 2 enemies would be -2).

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Cruzada

Post by Campeador »

I've changed again my detection rules, to make different rules depending of FE or not (#load-if-defined UP-GAME-AGE2-X2, #else, etc)

But still problems. :head

For example, in the start of the game this rule sets these goals to -1

Code: Select all

(defrule
	(players-building-count every-enemy == 0)
=>
	(up-get-fact-sum every-enemy unit-type-count monk g-threat-monk)
	(up-get-fact-sum every-enemy unit-type-count huskarl-line g-threat-huskarl)
	(up-get-fact-sum every-enemy unit-type-count mameluke-line g-threat-mameluke)
	(up-get-fact-sum every-enemy unit-type-count spearman-line g-threat-spear)
)
In any case thanks for your efforts. B)
Any idea? :blink:

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Cruzada

Post by scripter64 »

Oh, get-fact-sum needs any-* instead of every-*

Post Reply