MFI (beta)

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
dead_kniight
Forumer
Posts: 10
Joined: Thu Jan 23, 2014 10:55 pm

MFI (beta)

Post by dead_kniight »

This is my first AI , so all suggestions and feedback is welcome. MFI will not rush and usually won't attack until castle age if it detects you are too weak, normally it attacks mostly in late castle \ early imperial age.

I am pretty sure this version is not even in working condition, uploading it because I need help in the mining camp part. AI won't build any more mining camp unless mines near the previous one have finished i.e. if there is even one gold mine left near my first gold mining camp it won't build another until the mines have been exhausted. Tried a lot of different things but nothing seems to work. Any help would be appreciated.

strategy : none so far
civ : any(except goths, code still in progress for goths)
map : any land map (no docks or Scandinavia)
mode : conquest
population cap : 200
user patch compatible only

Note: This AI as I mentioned above is my first AI, hence it may contain quite a few peculiarities/bugs. If you notice any please tell me.
Attachments
MFI_1.44(b).rar
(76.44 KiB) Downloaded 312 times
MFI_1.43(b).zip
(28.76 KiB) Downloaded 313 times
Last edited by dead_kniight on Tue Apr 07, 2015 2:34 am, edited 2 times in total.

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

Re: MFI (beta)

Post by scripter64 »

Welcome to the forum! I tried the file (renamed training-units-faulty.per to training-units.per to make it load) and the AI started without any errors. Is the problem related to some specific improper behavior or script loading?

User avatar
dead_kniight
Forumer
Posts: 10
Joined: Thu Jan 23, 2014 10:55 pm

Re: MFI (beta)

Post by dead_kniight »

scripter64 wrote:Welcome to the forum! I tried the file (renamed training-units-faulty.per to training-units.per to make it load) and the AI started without any errors. Is the problem related to some specific improper behavior or script loading?
Actually the script is without any syntax error. The problem is that MFI would not train any military units if that file is loaded. :(

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

Re: MFI (beta)

Post by scripter64 »

It looks like the goal names are defined to 0 in constants.per, which is an invalid goal id.
For UP, the goal ids span from 1 to 512. For v1.0c, it's 1 to 40.

The following goals must be changed, so they refer to unique goal ids. For example:

Code: Select all

(defconst g-can-use-escrow 10)

(defconst g-can-train-villager 20)
(defconst g-can-train-sword 21)
(defconst g-can-train-spear 22)
(defconst g-can-train-skirm 23)
(defconst g-can-train-scout 24)
(defconst g-can-train-arrow 25)
(defconst g-can-train-knight 26)
(defconst g-can-train-cav-arrow 27)
(defconst g-can-train-unq-unit 28)
(defconst g-can-train-hnd-can 29)
(defconst g-can-train-treb 30)
(defconst g-can-train-bmb-can 31)
(defconst g-can-train-ram 32)
After adjusting these defconsts, these names can be used to refer to the associated goals at those id numbers.
All goals default to -1, so if you would like them to start as 0, you would need a rule like this:

Code: Select all

(defrule
	(true)
	=>
	(set-goal g-can-use-escrow 0)
	(set-goal g-can-train-villager 0)
	(set-goal g-can-train-sword 0)
	(set-goal g-can-train-spear 0)
	(set-goal g-can-train-skirm 0)
	(set-goal g-can-train-scout 0)
	(set-goal g-can-train-arrow 0)
	(set-goal g-can-train-knight 0)
	(set-goal g-can-train-cav-arrow 0)
	(set-goal g-can-train-unq-unit 0)
	(set-goal g-can-train-hnd-can 0)
	(set-goal g-can-train-treb 0)
	(set-goal g-can-train-bmb-can 0)
	(set-goal g-can-train-ram 0)
	(disable-self)
)
Essentially, defconst is just giving a name to a number. The set-goal command is what actually changes a goal's value.
In other words, these 2 lines will both set goal #20 to 5, after defconst'ing the text "g-can-train-villager" as 20:
- (set-goal g-can-train-villager 5)
- (set-goal 20 5)

Here's the adjusted constants.per: http://pastebin.com/c7Y5NHaR
Two other notes:
1. your AI seems stronger when escrow is disabled
- maybe leave g-can-use-escrow defconst'ed to 0 (effectively disabling it) until it's optimized
2. be careful when building the lumber camp too early
- it sometimes gets stuck at 10/10 population, all food gatherers, with no wood for a house
- a temporary fix might be to add a (game-time > 150) condition for building the first camp

Other than that, it seems to work well and was able to win against the built-in AI :devil

User avatar
dead_kniight
Forumer
Posts: 10
Joined: Thu Jan 23, 2014 10:55 pm

Re: MFI (beta)

Post by dead_kniight »

@scripter64

Thank you very much. I wanted to use goals so as to train units as required i.e. training scouts when monks detected instead of knights. This will make it so much easier.
Thank you again. :D :D

User avatar
Promiskuitiv
Waheguru
Posts: 1364
Joined: Thu Nov 10, 2011 1:07 pm

Re: MFI (beta)

Post by Promiskuitiv »

Welcome to the forum dead knight! :)

User avatar
dead_kniight
Forumer
Posts: 10
Joined: Thu Jan 23, 2014 10:55 pm

Re: MFI (beta)

Post by dead_kniight »

@Promiskuitiv
Hi there, thanks for the welcome. People here are really helpful. Seeing the quality of AIs you guys make, I never thought mine would even be noticed.
By the way, I just love your AI. Barbarian and Promi are my favorite allies in 4v4 games against Nightmare, UnfairSteel and other two mayan standard AIs

User avatar
jdstankosky
Guru
Posts: 911
Joined: Thu Nov 25, 2010 12:30 pm
Location: Florida, USA
Contact:

Re: MFI (beta)

Post by jdstankosky »

I have been away from the forums for a year or longer! :o I'm glad to see that people are still finding their way onto the site! :D

I find it interesting that your first script is UP only! You will have a totally different mindset to scripting than those of us who went through the school of hard knocks on 1.0c!

I still have yet to find what I did with my game installation CDs, but once I do I'm going to check this out!
Do not try to script a counter for everything. That is reactionary, and always slower than taking the initiative in battle. Decide from the start what you are going to do, and do not waiver from it. Own it.

User avatar
dead_kniight
Forumer
Posts: 10
Joined: Thu Jan 23, 2014 10:55 pm

Re: MFI (beta)

Post by dead_kniight »

Typed a bloody big comment asking for some advice on the ai and lost all as soon as i tried uploading the new file. :lol: :lol: :lol:
btw why can't i upload a newer version.

@jdstankosky
Hey thanks man and i guess :unsure: ...... Welcome back :D :D :D :D

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

Re: MFI (beta)

Post by Campeador »

Hi dead_kniight!

It is not so strange that we notice your AI. Even the strongest AIs started being weak. For example, UnfairestEel was a newcomer in the scripting world a couple of years ago and currently one of his AI is the number one inthe Ladder.

I'll test your AI after to judge The Horde vsa Barbarian match, to give you a few comments or suggestions. B)

Welcome to the world of :head .


:P

Post Reply