I selected a few AI that I made, most of them are tests and notes for me to learn ai scripting.
rynnogift, mygift, arrowSuit and maru are not that bad
The reason rynno does not hunt boars is because rynno does not like to hunt his brothers
this video is fake ! ->https://www.youtube.com/watch?v=gheevrZ8mg8
__________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________
here is the script for the FE ai
My long term goal for this AI is to make him go up to imp and have a decent-fun game. I don't intend to make him A GOOD PLAYER. I would want to focus more on the fun/chating/wierd strategy part.
Code: Select all
; exploring with scout , not villagers
(defrule
(true) ; Facts go here
=>
(set-strategic-number sn-initial-exploration-required 0) ; Actions after here.
(set-strategic-number sn-percent-civilian-builders 50)
(set-strategic-number sn-percent-civilian-gatherers 20)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-cap-civilian-builders 250)
(set-strategic-number sn-cap-civilian-gatherers 0)
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-number-explore-groups 1)
(set-strategic-number sn-total-number-explorers 1)
(chat-to-all " Hi ")
(disable-self)
)
;building houses
(defrule
(can-build house)
(housing-headroom < 4)
(population-headroom > 3)
(population-headroom != 0)
=>
(build house)
)
;training vills dark age
(defrule
(current-age == dark-age)
(unit-type-count-total villager < 30)
(can-train villager)
=>
(train villager)
)
;get loom
(defrule
(can-research ri-loom)
=>
(research ri-loom)
)
;research wheel barrow
(defrule
(research-available ri-wheel-barrow)
=>
(research ri-wheel-barrow)
)
;advance to feudal
(defrule
(can-research feudal-age)
=>
(research feudal-age)
)
;advance to castle
(defrule
(can-research castle-age)
=>
(research castle-age)
)
;advance to imp
(defrule
(can-research imperial-age)
=>
(research imperial-age)
)
;training vills feudal age
(defrule
(current-age == feudal-age)
(unit-type-count-total villager > 40)
(unit-type-count-total villager < 50)
(can-train villager)
=>
(train villager)
)
;build lumbercamp
(defrule
(can-build lumber-camp)
(unit-type-count villager > 10)
=>
(build lumber-camp)
(set-strategic-number sn-maximum-wood-drop-distance 3)
(up-modify-sn sn-camp-max-distance c:+ 3)
)
;build mill
(defrule
(can-build mill)
(resource-found food)
(building-type-count-total mill >= 0)
(building-type-count-total mill < 2)
=>
(build mill)
(set-strategic-number sn-maximum-food-drop-distance 5)
(set-strategic-number sn-maximum-hunt-drop-distance 8)
)
;mill deer
;(defrule
;(resource-found deer)
;=>
;(build mlll)
;)
;build farms
(defrule
(current-age == dark-age)
;(building-type-count-total lumber-camp > 0) ; We want a lumber camp before farms
(unit-type-count-total villager > 8)
(building-type-count-total farm < 15)
;(idle-farm-count < 4) ; Only build farms if there are less than 4 idle farms
=>
(build farm)
)
(defrule
(game-time greater-than 45)
(building-type-count town-center less-than 1)
(can-build town-center)
=>
(build town-center)
)
(defrule
(building-type-count-total blacksmith less-than 1)
(can-build blacksmith)
=>
(build blacksmith)
)
(defrule
(building-type-count-total university less-than 1)
(can-build university)
=>
(build university)
)
(defrule
(building-type-count-total market less-than 1)
(can-build market)
=>
(build market)
)
(defrule
(building-type-count-total monastery < 1)
(can-build monastery)
=>
(build monastery)
)
(defrule
(can-research ri-redemption)
=>
(research ri-redemption)
)
(defrule
(can-research ri-sanctity)
=>
(research ri-sanctity)
)
(defrule
(can-research ri-illumination)
=>
(research ri-illumination)
)
(defrule
(building-type-count-total castle < 1)
(can-build castle)
=>
(build castle)
)
(defrule
(building-type-count-total siege-workshop < 1)
(can-build siege-workshop)
=>
(build siege-workshop)
)
(defrule
(resource-found gold)
(building-type-count-total mining-camp < 5)
(dropsite-min-distance gold > 7)
(can-build mining-camp)
=>
(build mining-camp)
(chat-local-to-self "gold place")
)
(defrule
(resource-found stone)
(building-type-count-total mining-camp < 5)
(dropsite-min-distance stone > 7)
(can-build mining-camp)
=>
(build mining-camp)
(chat-local-to-self "rock place")
)
;;;;;;;;;;TRAIN FISHING-SHIP
(defrule
(current-age == dark-age)
(unit-type-count fishing-ship < 2)
=>
(train fishing-ship)
)
;;;;;;;;;;TRAIN MILITIAMAN
(defrule
(current-age == dark-age)
(food-amount > 600)
(unit-type-count villager > 100)
(unit-type-count militiaman < 10)
(can-train militiaman)
=>
(train militiaman)
)
;drop resources distance
(defrule
(true)
=>
(set-strategic-number sn-maximum-food-drop-distance 5)
(set-strategic-number sn-maximum-wood-drop-distance 4)
(set-strategic-number sn-maximum-gold-drop-distance 1)
(set-strategic-number sn-maximum-stone-drop-distance 1)
(set-strategic-number sn-maximum-town-size 8)
(set-strategic-number sn-mill-max-distance 15)
(set-strategic-number sn-camp-max-distance 4)
(set-strategic-number sn-enable-boar-hunting 1)
)
(defrule
(current-age == dark-age)
(unit-type-count-total villager > 15)
=>
(set-strategic-number sn-initial-exploration-required 1) ; Actions after here.
(set-strategic-number sn-percent-civilian-builders 50)
(set-strategic-number sn-percent-civilian-gatherers 20)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-cap-civilian-builders 250)
(set-strategic-number sn-cap-civilian-gatherers 20)
)
;
;stable spam
(defrule
(can-build stable)
(building-type-count-total stable < 6)
=>
(build stable)
)
;scout spam
(defrule
(can-train scout-cavalry-line)
(unit-type-count-total scout-cavalry < 30)
=>
(train scout-cavalry-line)
)
(defrule
(can-research ri-husbandry)
=>
(research ri-husbandry)
)
(defrule
(can-research ri-bloodlines)
=>
(research ri-bloodlines)
)
(defrule
(can-research ri-forging)
=>
(research ri-forging)
)
;watch-tower
(defrule
(can-build watch-tower)
(building-type-count-total stable < 6)
=>
(build watch-tower)
)
;(defrule
;(resource-found fish)
;=>
;(chat-to-all "Now I'm gonna make some Docks!")
; Adjust Stance
;------------------------------
(defrule
(players-stance any-enemy ally)
=>
(chat-to-player this-any-enemy "41It is good to have you as a friend.")
(set-stance this-any-enemy neutral)
)
(defrule
(or
(or
(players-stance any-ally neutral)
(players-stance any-ally enemy)
)
(or
(players-stance any-neutral neutral)
(players-stance any-neutral enemy)
)
)
=>
(chat-to-player this-any-ally "40I have been betrayed.")
(chat-to-player this-any-neutral "40I have been betrayed.")
(set-stance this-any-ally enemy)
(set-stance this-any-neutral enemy)
)
(defrule
(true)
(cheats-enabled)
=>
(chat-to-all "Let the cheating begin!" )
(disable-self)
)
(defrule
(current-age == feudal-age)
(can-build barracks)
(building-type-count-total barracks <= 1)
=>
(build barracks) )
(defrule
(can-build archery-range)
(building-type-count-total archery-range <= 1)
=>
(build archery-range) )
;attack
(defrule
(military-population > 10)
(not(town-under-attack)
)
=>
(attack-now)
)
(load "myGift/resign")
(defconst sn-military-level 190)
(defconst sn-infantry-threat 53)
(defconst sn-archer-threat 64)
(defconst sn-cavalry-threat 65)
(defconst sn-military-superiority 192)
(defconst sn-food-modifier-percentage 156)
(defconst sn-wood-modifier-percentage 157)
(defconst sn-stone-modifier-percentage 158)
(defconst sn-gold-modifier-percentage 159)
(defconst sn-target-player-number 249)
(defconst sn-focus-player-number 251)
;(defconst sn-target-point-adjustment 292)
(defconst sn-allow-sheep-exploration 147)
(defrule (true) =>
(up-assign-builders c: house c: 1)
(up-assign-builders c: town-center c: 3)
(up-assign-builders c: castle c: 15)
(up-assign-builders c: monastery c: 15)
(up-assign-builders c: watch-tower c: 8)
(up-assign-builders c: stable c: 2)
(disable-self) )
;;;;;;;;;;TRAIN MONKS
(defrule
(unit-type-count monk < 3)
(can-train monk)
=>
(train monk)
)
;;;;;;;;;;train rams
(defrule
(current-age >= imperial-age)
(can-train battering-ram)
=>
(train battering-ram)
)
so whatever I see and read on internet, I put there the script to see how it's working.
FIRST PROBLEM: the AI doesn't make lumbercamp anymore
SECOND PROBLEM: the AI has too many idles
I did not use goals and defconst because I didn't learn them yet and I don't know how and what they do