Würde mich wirklich freuen, wenn du die unveränderte KI mal posten könntest. Wäre ja wirklich ideal.
Habe leider gerade genug um die Ohren, als noch eine KI schreiben zu müssen...
Keine Sorge, dies wollte ich sowieso nicht
. Weil ich vielleicht sogar für jedes Szenario die Computerspieler (wie es das große ES gemacht hat
) selbst schreiben will.
Und vielleicht brauche ich bei irgendeinem Szenario doch eben mal die Standard-KI, aber die ist mir halt ein bisschen zu gesprächig und beeinflussbar. Weshalb ich die Original-Files bräuchte. Wenn du sie schickst, bitte mal irgendwo hochladen... und mir den Link per PM oder vielleicht als Beitrag hier schicken, bin mir nicht sicher in wie weit das wieder legal ist (es öffentlich zu posten). Ich lass mich überraschen.
___________________
Nochmal zum selbst-schreiben von KI's. Ich habe mal die KI von den ES-Kampagnen studiert. Und im grundegenommen sind die schön gegliedert, wovon ich mir einige Idee "klauen" möchte, also zumindest die Gliederung der Dateien.
Also wer die Files kennt, im Prinzip würden sie doch vom Syntax her ausreichen, oder? Also ich habe das jetzt so gemacht. @Janworks würde mich freuen, wenn du mal ein Auge drauf werfen würdest:
Code: Alles auswählen
;==============================================================================
; ** TOKUGAWA SCENARIO 1 / VILLAGE PLAYERS (YELLOW AND CYAN)
;------------------------------------------------------------------------------
; LAST UPDATE: 2009-11-13 (YYYY-MM-DD)
; VERSION: 1.0 (X.Y - X: CORE-CODE, Y: BUGFIXES)
;==============================================================================
;==============================================================================
; * GROUP SETTINGS
;==============================================================================
(defrule
(true)
=>
(set-strategic-number sn-maximum-food-drop-distance 7)
(set-strategic-number sn-maximum-wood-drop-distance 7)
(set-strategic-number sn-maximum-gold-drop-distance 7)
(set-strategic-number sn-maximum-hunt-drop-distance 7)
(set-strategic-number sn-maximum-stone-drop-distance 7)
(disable-self)
)
(defrule
(true)
=>
(set-strategic-number sn-food-gatherer-percentage 60)
(set-strategic-number sn-wood-gatherer-percentage 40)
(set-strategic-number sn-gold-gatherer-percentage 30)
(set-strategic-number sn-stone-gatherer-percentage 20)
(disable-self)
)
(defrule
(true)
=>
(set-strategic-number sn-percent-civilian-gatherers 70)
(set-strategic-number sn-percent-civilian-builders 30)
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-minimum-boar-hunt-group-size 201)
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-task-ungrouped-soldiers 0)
(disable-self)
)
;==============================================================================
; * PROVIDE WOOD
;==============================================================================
(defrule
(or
(or
(idle-farm-count < 1)
(building-type-count-total farm < 6)
)
(or
(dropsite-min-distance food > 4)
(building-type-count-total mill < 4)
)
)
(unit-type-count villager > 0)
(wood-amount < 100)
=>
(chat-local-to-self "provide wood")
(cc-add-resource wood 100)
)
;==============================================================================
; * TRAIN VILLAGER
;==============================================================================
(defrule
(unit-type-count-total villager < 6)
(can-train villager)
=>
(train villager)
(chat-local-to-self "train villager")
)
;==============================================================================
; * BUILD HOUSE
;==============================================================================
(defrule
(housing-headroom < 3)
(population-headroom > 0)
(can-build house)
=>
(build house)
(chat-local-to-self "build house")
)
;==============================================================================
; * BUILD FARMS
;==============================================================================
(defrule
(or
(idle-farm-count < 1)
(building-type-count-total farm < 6)
)
(can-build farm)
=>
(build farm)
(chat-local-to-self "build farm")
)
;==============================================================================
; * BUILD MINING-CAMP
;==============================================================================
(defrule
(resource-found gold)
(building-type-count-total mining-camp < 1)
(dropsite-min-distance gold > 7)
(can-build mining-camp)
=>
(build mining-camp)
(chat-local-to-self "build mining-camp")
)
(defrule
(resource-found stone)
(building-type-count-total mining-camp < 1)
(dropsite-min-distance stone > 7)
(can-build mining-camp)
=>
(build mining-camp)
(chat-local-to-self "build mining-camp")
)
;==============================================================================
; * BUILD MILL
;==============================================================================
(defrule
(dropsite-min-distance food > 4)
(building-type-count-total mill < 4)
(can-build mill)
=>
(build mill)
(chat-local-to-self "build mill")
)
Im Prinzip macht diese KI nichts anderes als Rohstoffe im gewissen Maß abzubauen und Felder anzulegen - gegebenenfalls auch neue nötige Gebäude errichtet.
___________
Nun zur einer angreifenden KI, die will ich erst heute schreiben, aber ich möchte mal hierzu ein Beispiel aus der ES-Kampagne zeigen.
Also vom Prinzip her könnte ich es doch so ähnlich machen, oder? Der Rest wird in den "scenario *"-Files erledigt, wie Technolgien, Marktplatz-Rules usw.
Ich muss demzufolge eigentlich nur das Erschaffen von Einheiten, das Bauen von Gebäuden und die Angriffe schreiben und regeln, oder? Auch hier würde ich mich über ein ja oder nein freuen
.
Code: Alles auswählen
;Conquerors scn 7 player 3
;Koyoto - green Japanese
(load "scenario market")
(load "scenario upgrades")
(load "scenario difficulty")
; GROUPS
(defrule
(true)
=>
(set-strategic-number sn-minimum-boar-hunt-group-size 4)
(set-strategic-number sn-maximum-town-size 18)
(set-strategic-number sn-camp-max-distance 30)
(set-strategic-number sn-mill-max-distance 30)
(set-strategic-number sn-percent-enemy-sighted-response 100)
(set-strategic-number sn-enemy-sighted-response-distance 25)
(set-strategic-number sn-blot-exploration-map 1)
(set-strategic-number sn-task-ungrouped-soldiers 1)
(set-strategic-number sn-number-explore-groups 1)
(set-strategic-number sn-number-boat-explore-groups 1)
(disable-self)
)
(defrule
(game-time > 600)
=>
(set-strategic-number sn-task-ungrouped-soldiers 0)
(disable-self)
)
(defrule
(true)
=>
(set-strategic-number sn-percent-civilian-explorers 0)
(set-strategic-number sn-percent-civilian-builders 15)
(set-strategic-number sn-percent-civilian-gatherers 85)
(set-strategic-number sn-cap-civilian-explorers 0)
(set-strategic-number sn-cap-civilian-gatherers 100)
(set-strategic-number sn-food-gatherer-percentage 33)
(set-strategic-number sn-gold-gatherer-percentage 33)
(set-strategic-number sn-stone-gatherer-percentage 0)
(set-strategic-number sn-wood-gatherer-percentage 34)
(set-strategic-number sn-maximum-gold-drop-distance 20)
(set-strategic-number sn-maximum-stone-drop-distance 20)
(set-strategic-number sn-maximum-food-drop-distance 20)
(disable-self)
)
(defrule
(true)
=>
(enable-timer 1 3500)
(enable-timer 2 2500)
(enable-timer 4 2500)
(disable-self)
)
(defrule
(difficulty <= moderate)
(timer-triggered 4)
=>
(chat-local-to-self "I think I need some resources")
(cc-add-resource food 300)
(cc-add-resource wood 300)
(cc-add-resource gold 200)
(cc-add-resource stone 200)
(disable-timer 4)
(enable-timer 4 2400)
)
(defrule
(event-detected trigger 35)
(difficulty <= moderate)
=>
(cc-add-resource food 1000)
(cc-add-resource wood 1000)
(cc-add-resource gold 1000)
(cc-add-resource stone 200)
(set-goal 3 1)
(disable-self)
)
(defrule
(timer-triggered 1)
(unit-type-count-total transport-ship > 1)
(defend-soldier-count >= 9)
=>
(set-strategic-number sn-percent-attack-soldiers 70)
(set-strategic-number sn-percent-attack-boats 0)
(attack-now)
(chat-local-to-self "attack")
(disable-timer 1)
(enable-timer 1 1020)
)
(defrule
(timer-triggered 2)
(defend-warboat-count >= 5)
=>
(set-strategic-number sn-percent-attack-soldiers 0)
(set-strategic-number sn-percent-attack-boats 100)
(attack-now)
(disable-timer 2)
(enable-timer 2 400)
)
(defrule
(difficulty <= moderate)
(unit-type-count-total villager less-than 18)
(can-train villager)
=>
(train villager)
(chat-local-to-self "villager")
)
(defrule
(difficulty == easy)
(unit-type-count-total villager less-than 8)
(can-train villager)
=>
(train villager)
(chat-local-to-self "villager")
)
(defrule
(unit-type-count-total fishing-ship < 8)
(can-train fishing-ship)
=>
(train fishing-ship)
(chat-local-to-self "fishing ship")
)
;maintain housing
(defrule
(housing-headroom less-than 4)
(population-headroom greater-than 0)
(can-build house)
=>
(build house)
(chat-local-to-self "house")
)
(defrule
(building-type-count-total market less-than 1)
(can-build market)
=>
(build market)
(chat-local-to-self "market")
)
;construct farms if food getting short.
(defrule
(game-time > 400)
(building-type-count-total farm less-than 10)
(can-build farm)
=>
(build farm)
)
(defrule
(resource-found wood)
(building-type-count-total lumber-camp < 5)
(dropsite-min-distance wood > 5)
(can-build lumber-camp)
=>
(build lumber-camp)
(chat-local-to-self "wood place")
)
(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")
)
(defrule
(dropsite-min-distance food greater-than 4)
(building-type-count-total mill less-than 4)
(can-build mill)
=>
(build mill)
(chat-local-to-self "mill")
)
; MILITARY UNITS
(defrule
(unit-type-count-total spearman-line < 6)
(can-train spearman-line)
=>
(train spearman-line)
(chat-local-to-self "spearman")
)
(defrule
(goal 3 1)
(unit-type-count-total militiaman-line < 10)
(can-train militiaman-line)
=>
(train militiaman-line)
(chat-local-to-self "swordsman")
)
(defrule
(goal 3 1)
(unit-type-count-total archer-line < 10)
(can-train archer-line)
=>
(train archer-line)
(chat-local-to-self "archer")
)
(defrule
(difficulty == easy)
(unit-type-count-total knight-line < 1)
(can-train knight-line)
=>
(train knight-line)
(chat-local-to-self "knight")
)
(defrule
(difficulty <= moderate)
(unit-type-count-total knight-line < 4)
(can-train knight-line)
=>
(train knight-line)
(chat-local-to-self "knight")
)
(defrule
(event-detected trigger 13)
(difficulty <= moderate)
(game-time > 1200)
(unit-type-count-total monk < 2)
(can-train monk)
=>
(train monk)
(chat-local-to-self "monk")
)
(defrule
(difficulty <= moderate)
(unit-type-count-total my-unique-unit-line < 6)
(can-train my-unique-unit-line)
=>
(train my-unique-unit-line)
(chat-local-to-self "samurai")
)
(defrule
(event-detected trigger 13)
(unit-type-count-total scorpion-line < 2)
(can-train scorpion-line)
=>
(train scorpion-line)
(chat-local-to-self "scorpion")
)
(defrule
(event-detected trigger 13)
(unit-type-count-total trebuchet < 1)
(can-train trebuchet)
=>
(train trebuchet)
(chat-local-to-self "trebuchet")
)
(defrule
(difficulty <= moderate)
(unit-type-count-total cannon-galleon-line < 3)
(can-train cannon-galleon-line)
=>
(train cannon-galleon-line)
(chat-local-to-self "cannon galleon")
)
(defrule
(difficulty <= moderate)
(unit-type-count-total galley-line < 3)
(can-train galley-line)
=>
(train galley-line)
(chat-local-to-self "war galley")
)
(defrule
(unit-type-count-total fire-ship-line < 3)
(can-train fire-ship-line)
=>
(train fire-ship-line)
(chat-local-to-self "fire ship")
)
(defrule
(unit-type-count-total transport-ship < 2)
(can-train transport-ship)
=>
(train transport-ship)
(chat-local-to-self "transport-ship")
)
Wenn das Veröffentlichen des letzten KI-Codes in irgendeiner Weise nicht legal sein sollte, dann bitte den Code entfernen oder zenzieren. Aber über ein Statement würde ich mich trotzdem freuen. Wobei ich denke es geht in Ordnung
.
~ Draygon