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

Offline Zardox Xheonov

  • Sr. Member
  • ****
  • Posts: 274
Comparing Op2 Code Vs Aoec Code
« on: January 10, 2011, 05: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, 06:09:11 AM by Lord Of Pain »
Hit me up on discord, if I am online, you know I'll be gaming.

(Lord Of Pain is no more, I am currently now "Zardox" and have been for awhile on other platforms.)

Offline Arklon

  • Administrator
  • Hero Member
  • *****
  • Posts: 1269
Comparing Op2 Code Vs Aoec Code
« Reply #1 on: January 10, 2011, 07: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: 1404
    • http://op3game.net
Comparing Op2 Code Vs Aoec Code
« Reply #2 on: January 10, 2011, 11: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: 3093
Comparing Op2 Code Vs Aoec Code
« Reply #3 on: January 13, 2011, 07: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.