Author Topic: Comparing Op2 Code Vs Aoec Code  (Read 1038 times)

Offline Lord Of Pain

  • Sr. Member
  • ****
  • Posts: 275
    • http://
Comparing Op2 Code Vs Aoec Code
« on: January 10, 2011, 04:57:19 AM »
So I stumbled upon one of my junk files and there it was; the aokedit utility that allows fans of ageo f empires II to create their own artifitial intellegence.
The code is very similar to out post 2 and has some sample code when you first unpack it, and lucky you all can see it too i have the zip file in my aok folder so i just thought people like hooman would enjoy a laugh at this when they say similar code....

Sample:

Code: [Select]
;Rules applying to Dark Age and/or all future ages

(defrule
   (game-time > 80)
   =>
   (chat-local-to-self "RegBuild selected.")
   (disable-self)
)

#load-if-not-defined VICTORY-CONQUEST

;Unfortunately, if you build a wonder you never build anything else.  Therefore
;exclude them on Hard and Hardest.  Also exclude them on Easiest.

#load-if-not-defined DIFFICULTY-EASIEST
#load-if-not-defined DIFFICULTY-HARD
#load-if-not-defined DIFFICULTY-HARDEST

(defrule
   (game-time > 900)
   (can-build-with-escrow wonder)
   (population > ninety-five-percent-pop)
   (building-type-count-total wonder < 1)
   (can-build-with-escrow wonder)
   =>
   (release-escrow wood)
   (release-escrow stone)
   (release-escrow gold)
   (build wonder)
   (chat-to-allies "Building Wonder.")
)

(defrule
   (building-type-count-total wonder > 0)
   =>
   (set-strategic-number sn-maximum-gold-drop-distance -1)
   (set-strategic-number sn-maximum-wood-drop-distance -1)
   (set-strategic-number sn-maximum-food-drop-distance -1)
   (set-strategic-number sn-maximum-stone-drop-distance -1)
   (set-strategic-number sn-maximum-hunt-drop-distance -1)
   (set-strategic-number sn-maximum-fish-boat-drop-distance -1)
)

#end-if
#end-if
#end-if

#end-if

(defrule                
   (building-type-count town-center == 0)
   (can-build-with-escrow town-center)
   =>
   (release-escrow wood)
   (release-escrow stone)
   (build town-center)
   (chat-to-allies "Building town center.")
)

;Housing Rules ****************************************************************

(defrule
   (housing-headroom < 4)
   (population-headroom > 3)
   (can-build house)
   =>
   (build house)
)

Thats just the tip of the iceberg, you can veiw or create your own code for age of kings 2 if you have the game or like it with the aokedit file in this zip folder.
you can find that zip Here
« Last Edit: January 10, 2011, 05:09:11 AM by Lord Of Pain »
*Your tourtured bodies lay wastefully in the cabinate of caligari, and yours truly will haunt everyone in this channel for the sake of giving you pain. thus his spirit be mine; you shall all wither in pain by the clutches of your maker. all whom defy the pain must be punished; all whom can't endure the pain must suffer more; all who are weak and unworthy must be put to unrestfully sleep in their forsakened graves. all who defy shall be cursed by thy wicked hands of death. all who dont beleive will perish befor the flames of painful sins. those who are mortal surely cannot survive the wrath of the LORD OF PAIN. it is a given golden rule that you cannot defeat the power of pain; you cannot even dream of having that much power.Im getting hungary for thanks giving. Well im getting Austria for halloween. Would you settle for turkey? Naw im haveing newzealand.

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1109
Comparing Op2 Code Vs Aoec Code
« Reply #1 on: January 10, 2011, 06:10:43 AM »
Quote
The code is very similar to out post 2 and has some sample code when you first unpack it, and lucky you all can see it too i have the zip file in my aok folder so i just thought people like hooman would enjoy a laugh at this when they say similar code....

Offline TH300

  • Hero Member
  • *****
  • Posts: 1425
    • http://op3game.net
Comparing Op2 Code Vs Aoec Code
« Reply #2 on: January 10, 2011, 10:02:38 AM »
I don't see how this is similar to op2 ai code. op2 is C++. This doesn't look in any way like C++. It seems to be some simpler, descriptive language that was specifically developed for AoK.

That said, there isn't much reason left for posting it here, except for people who have AoK. By coincidence I own a copy of AoK, so I may someday take a look at it, but currently I am more interested in op2.

Offline BlackBox

  • Administrator
  • Hero Member
  • *****
  • Posts: 3103
    • http://
Comparing Op2 Code Vs Aoec Code
« Reply #3 on: January 13, 2011, 06:31:49 PM »
Moved this to general game discussion.

And yes, OP2 is written in C++ and small portions of x86 assembler; this "language" resembles scheme or common Lisp but is probably not usable as a general purpose programming language.

Please do your research before posting.