Crusade AI Project
- Alevo1
- Guru
- Posts: 835
- Joined: Thu Aug 04, 2011 10:10 am
- Location: England
Re: Crusade AI Project
For that I set food-timer1 to 48 and food-timer2 to 23 every time I press the villager button
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
Thanks for the info. I'll try to add it.
One thing. I have an error in the line
(up-modify-goal G-MAX-FARMS s:* sn-food-gatherer-percentage)
of this rule
The constant for the goal G-MAX-FARMS is defined.
One thing. I have an error in the line
(up-modify-goal G-MAX-FARMS s:* sn-food-gatherer-percentage)
of this rule
Code: Select all
; Farm Building
(defrule
(up-get-fact unit-type-count villager G-MAX-FARMS)
(up-modify-goal G-MAX-FARMS s:* sn-food-gatherer-percentage)
(up-modify-goal G-MAX-FARMS c:/ 100)
(up-get-fact unit-type-count villager-fisherman G-MATH-1)
(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
(up-get-fact unit-type-count villager-forager G-MATH-1)
(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
(up-get-fact unit-type-count villager-hunter G-MATH-1)
(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
(up-get-fact unit-type-count villager-shepherd G-MATH-1)
(up-modify-goal G-MAX-FARMS g:- G-MATH-1)
(building-type-count-total farm g:< G-MAX-FARMS)
=>
(build farm)
)
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
Apart from the previous error, I have anotehr quite similar in this line:
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-1)
The whole rule is:
Does anyone have an answer? The idea of that line is just to substract the number of units who are being trained (goal G-MATH-1) to real goal who stores the housing headroom.
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-1)
The whole rule is:
Code: Select all
(defrule
(population-headroom < 5)
(up-get-player-fact my-player-number housing-headroom 0 G-REAL-HOUSING-HEADROOM)
(up-get-player-fact my-player-number up-resource-amount amount-queued-count G-MATH-1)
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-1)
(up-get-player-fact my-player-number building-type-count-total house G-MATH-2)
(up-get-player-fact my-player-number building-type-count-total town-center G-MATH-3)
(up-modify-goal G-MATH-2 g:+ G-MATH-3)
(up-modify-goal G-MATH-2 c:* 5)
(up-get-player-fact my-player-number building-type-count-total castle G-MATH-3)
(up-modify-goal G-MATH-3 c:* 20)
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-2)
(up-modify-goal G-REAL-HOUSING-HEADROOM g:- G-MATH-3)
(up-compare-goal G-REAL-HOUSING-HEADROOM < 5)
(up-pending-objects c: house == 0)
(up-can-build 0 c: house)
=>
(up-build house)
)
-
- Waheguru
- Posts: 5891
- Joined: Fri Jan 16, 2009 8:36 pm
Re: Crusade AI Project
The up-modify-goal/sn can only be in the Action part of the rule. It can't be used as a Fact, unfortunately.
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
So my last two doubts were because a confunsion between facts and actions. What silly mistakes.
Errors resolved. I'll continue making my AI, at a slow rate , and adding force drop and any other interesting suggestions that you make me.
P.D: The new power of the UP makes me feel like a newbie.
Errors resolved. I'll continue making my AI, at a slow rate , and adding force drop and any other interesting suggestions that you make me.
P.D: The new power of the UP makes me feel like a newbie.
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
Next request. I need a table with EVERY UP constants that I could need for my AI. I've copied some of them from The Horde and Barbarian, but I have them disorganized.
One consequence of it is that I had a bug because I used:
(defconst idle-type-villager 0)
and later the condition:
(unit-type-count-total idle-type-villager < 5)
That problem has been resolved, so don't worry for that. But a file with a complete collection of UP constants should make my scripting much easier, avoiding possible future problems.
One consequence of it is that I had a bug because I used:
(defconst idle-type-villager 0)
and later the condition:
(unit-type-count-total idle-type-villager < 5)
That problem has been resolved, so don't worry for that. But a file with a complete collection of UP constants should make my scripting much easier, avoiding possible future problems.
-
- Waheguru
- Posts: 1905
- Joined: Sat Nov 08, 2003 9:22 am
Re: Crusade AI Project
With UP there come a file called UserPatchConst.per that is exactly that.Campeador wrote:But a file with a complete collection of UP constants should make my scripting much easier, avoiding possible future problems.
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
Hahaha. Thanks for the info, I didn't remember that small thing.
Just for curiosity. What use has idle-type-villager got? I can count idle villagers without it, but I have curiosity.
Just for curiosity. What use has idle-type-villager got? I can count idle villagers without it, but I have curiosity.
- Campeador
- Waheguru
- Posts: 1340
- Joined: Mon Nov 01, 2010 8:11 am
- Location: Spain
Re: Crusade AI Project
Crusade has the same power, but I've updated it to 4.42b.
Difference? It is 1.c compatible again. None difference for UP and FE.
Difference? It is 1.c compatible again. None difference for UP and FE.
-
- Waheguru
- Posts: 5891
- Joined: Fri Jan 16, 2009 8:36 pm
Re: Crusade AI Project
Campeador! Great to see you!