[UP]Miniman

Upload your latest creations here.
Please note that by posting comments to posts in this forum you forfeit your personal copyright on whatever you post. AI Scripters reserves the right to re-use objective comments in script reviews without requiring the posting author's permission. Credit, where appropriate will be given in such cases.
User avatar
Lazarus
Guru
Posts: 555
Joined: Sun Jan 22, 2012 12:02 pm
Location: Someplace in the United States

Re: Miniman AI(UP)

Post by Lazarus »

One little improvment that I made: I changed the defconst pro to 1 instead of three. I'll update the version soon.(Soon meaning when I feel less lazy)
Time to learn all the new things is too much so probably not scripting

mollsomg
Forumer
Posts: 71
Joined: Wed Mar 17, 2010 5:44 am

Re: Miniman AI(UP)

Post by mollsomg »

I'd like to highjack your thread for a minute.
You know what, this is a good opportunity to ask about a certain thing that has always bugged me. I've learned a great deal the last weeks and my AI is coming along nicely, yet there is one thing I dont understand when looking at other scripts. Let's take yours for example:

Most people start of by making the defconst list. Now the normal use of defconsts is clear to me, something like (defconst darkagevillagernumbertofeudalage 28).
I just dont understand what THIS is, where I get this from and how it works: (taken from your ai)

;--------------------------------------
; Define ProjectileType Constants
;--------------------------------------
(defconst projectile-town-center 0)
(defconst projectile-castle 1)
(defconst projectile-watch-tower 2)
(defconst projectile-bombard-tower 3)
(defconst projectile-ship 4)
(defconst projectile-siege 5)
(defconst projectile-fortification 6)
(defconst projectile-any 7)

;--------------------------------------
; Define EscrowState Constants
;--------------------------------------
(defconst escrow-included 0)
(defconst escrow-deducted 1)

;--------------------------------------
; Define PlacementType Constants
;--------------------------------------
(defconst place-normal 0)
(defconst place-forward 1)

;--------------------------------------
; Define TargetPriority Constants
;--------------------------------------
(defconst priority-offense 0)
(defconst priority-defense 1)

;--------------------------------------
; Define FindPlayerMethod Constants
;--------------------------------------
(defconst find-attacker 0)
(defconst find-random 1)
(defconst find-closest 2)



Where do people get these kind of defconsts from? I take it they are actual ingame functionalities, not made up substitutes for numbers. I mean I've read through a lot of stuff by now, but I never came across ingame constants like find-closest. It doesn't matter what they are defconsted as; do I understand that right? They just have to be defconsted as anything to be used in the script?

I just thought that defconsts were always words made up by the scripter, that serve as substitute for another thing. That's what puzzles me... Also does this stuff come from AoC or UP?

User avatar
Finaldeath
Guru
Posts: 961
Joined: Tue Mar 27, 2012 6:02 am

Re: Miniman AI(UP)

Post by Finaldeath »

That is from User Patch: http://forums.aiscripters.com/viewtopic.php?f=3&t=2318

Download it and in the compressed file you'll find a UserPatchConst.per - this is it, copied into his file. Basically it is the numbers the game (Currently at least - I'd hope they get added eventually, some have!) doesn't recognise internally for the UP functions.

For instace place-normal and place-forward are just 0 and 1, and the input into (up-build inConstPlacementType inGoalEscrowState typeOp inOpBuildingId). There are more examples of the functions here: http://forums.aiscripters.com/viewtopic.php?f=3&t=2591
Finaldeath

Writing a set of tutorials - My own AI is super secret development!

User avatar
Lazarus
Guru
Posts: 555
Joined: Sun Jan 22, 2012 12:02 pm
Location: Someplace in the United States

Re: Miniman AI(UP)

Post by Lazarus »

Which is how for (up-get-player-fact my-player-number unit-type-count villager g-some-goal) I used defconsts to turn it into
(up-get-player-fact bopbeepboop blahblahblah noobs gg)
:D
bopbeepbop is defconst my player number,
blahblahblah is the same as the value of the defconst unit-type-count-villager(NOT DEFCONSTED AS THE COMMAND)
noobs is villager
gg is just the goal name.
Time to learn all the new things is too much so probably not scripting

User avatar
Lazarus
Guru
Posts: 555
Joined: Sun Jan 22, 2012 12:02 pm
Location: Someplace in the United States

Re: Miniman AI(UP)

Post by Lazarus »

Ok, uploaded version with changed constant.
Time to learn all the new things is too much so probably not scripting

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Miniman AI(UP)

Post by scripter64 »

lol that's quite an edit! You can probably shrink it even more by eliminating UP defconsts that you don't need :devil

cakemaphoneige
Guru
Posts: 811
Joined: Wed Feb 13, 2008 6:50 pm

Re: Miniman AI(UP)

Post by cakemaphoneige »

LOL :rofl

User avatar
Lazarus
Guru
Posts: 555
Joined: Sun Jan 22, 2012 12:02 pm
Location: Someplace in the United States

Re: Miniman AI(UP)

Post by Lazarus »

I could, but they make it more unreadable :D
Time to learn all the new things is too much so probably not scripting

User avatar
Finaldeath
Guru
Posts: 961
Joined: Tue Mar 27, 2012 6:02 am

Re: Miniman AI(UP)

Post by Finaldeath »

Still too readable :P

Perhaps also do a true minified version; remove all whitespace, rename all constants and so forth as single-letters.

Code: Select all

(defconst a 1)(defrule(true)=>(build-unit a))...etc
Would be a nice variation? :)

Also the first version you did (or fixed version of it?) couldn't win against the default AI when I tried it - it managed to only rush when the petersen AI was in castle age, hehe. Was quite funny watching it though, it did destroy the TC then had it's TC destroyed by 3 swordsmen in return.
Finaldeath

Writing a set of tutorials - My own AI is super secret development!

User avatar
Campeador
Waheguru
Posts: 1340
Joined: Mon Nov 01, 2010 8:11 am
Location: Spain

Re: Miniman AI(UP)

Post by Campeador »

I think that Lazarus only want to make a script with the least number of rules, not space.

The record for the smallest and shortest AI submitted in a tournament is the Chicken AI. Two rules one line:

Code: Select all

(defrule(true)=>(build stable)(set-strategic-number sn-number-explore-groups 1))(defrule(game-time > 7)=>(train knight-line)(train hussar)(attack-now))
I made after to read it other PIDM Hun AI with a single rule and a single line which sometimes beated the Standard AI, but Chicken uses even less characters.

Chiiiicken!

Post Reply