Leif Ericson AI

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
MuRRay Jnr
Waheguru
Posts: 1990
Joined: Mon Jul 27, 2009 3:03 am
Location: Queensland, Australia

Re: Leif Ericson AI

Post by MuRRay Jnr »

haha i use 28 through castle untill he's got about 5 mining camps then it goes to 40
cheers,
murrayj

my current attempt at scripting, avarice ai

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: Leif Ericson AI

Post by Leif Ericson »

I've worked a long time trying to solve the farming bug, but I've had no success. Leif Ericson 1.2 is the most advanced version but it has the farming bug. Please look at it to see if you all can find what's wrong.

Leif Ericson 1.11 seems to have fixed the farming bug, but because of all the experimenting and editing I did to find out the problem I half-ruined its castle age economy, so I went back to Leif Ericson 1.1 to make Leif Ericson 1.2. Maybe you all can find what it was inside 1.11 that solved the problem.

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: Leif Ericson AI

Post by Leif Ericson »

Hey all! I'm hoping to get some small updates on Leif Ericson during Christmas Break. Months ago I said I was quitting on this AI, but now I think I have enough scripting knowledge to go ahead and update my script.

To do list:

1. Streamline the script. It is very inefficient with many things, especially unit counters system, its strategy system, and its unit training system, research system and building system. It's extremely hard to adapt and change, and I got frustrated with it. Just look at this example: :lol:

Code: Select all

(defrule
	(or	(not	(goal g-castle-army counter-archer))
		(goal g-enemy-civ meso))
	;(not	(goal g-castle-army counter-horde))
	(not	(goal g-castle-army counter-cavalry))
	(current-age >= castle-age)
	(town-under-attack)
	(can-train militiaman-line)
	(or	(research-completed ri-long-swordsman)
		(building-type-count castle == 0))
	(unit-type-count-total militiaman-line < 7)
	(players-unit-type-count any-enemy knight-line <= 7)
	(players-unit-type-count any-enemy cataphract-line <= 5)
	;(goal g-enemy-monks-detected no)
=>
	(train militiaman-line)
)
2. Fix its attacking bug. After a while, a lot of soldiers start getting stuck and basically stand idle, and my number of attacking soldiers is drastically reduced. I'm guessing its either a problem of attack-now or a problem with strategic numbers.

3. Improve its economy. I think this is one of the reasons why Leif Ericson can't compete as well.

Comments from the Lade thread:
I watched the replay of last Ladder game. Lade was clearly ahead and pushing. Everything seemed fine, superb actually, but Leif's soldiers fight well. It's not that they were swordsmen against trash: they had neither numbers nor a good supporting eco. They simply fight well.
I ran a game between Leif Ericson and current Lade. I was almost sure that the outcome would have been different, although you are never sure against Leif. Anyway, Lade won easily by 55' with only 140 casualties. True, an early castle and 9 cataphracts helped, but it wasn't just that: lately, I have been using a mix of TSA, attack-groups and attack-now, with attack-groups firing only seldom. When that attack-now rule fired during the first clash, my pikes fought very well against enemy swordsmen, isolating and surrounding enemy units and switching targets very swiftly and intelligently. Later, some of them proceeded to eco, and Leif couldn't sustain that because it didn't have 100 villagers yet.

Then, I searched in Leif's script and I found out that he isn't actually using attack-groups, only attack-now with zero forming distance. I remember that he had said that he is using attack groups, but this isn't true. Only attack-now.
If you see his evaluation numbers, you'll be surprised: he had a target-evaluation-distance of zero! He also has moderate-large response distance (7 for land maps) but this doesn't cause any lag.

When his attack rules fire, attack-percent isn't set back to zero, and it remains 100. Same with minimum-attack-group-size, which remains to 1. But his number-attack-groups is always zero, so attack-groups are off.
attack-now with a group-size of zero (and percent attack soldiers 100) will result in one-man attack groups, irrespective of min and max group sizes.

The only issue I have with this is that with, say, 100 one-man attack groups, it gets extremely heavy on the game engine and can cause serious lag sometimes. It also "seems to" reduce the performance of the enemy because of the strain on the engine. Thats just my own opinion though, from watching it in action.

Disadvantage is that trebs try to attack units etc. Advantage is that the target evaluation numbers do seem to make a distinct difference. Overall its behaviour is fairly similar to a TSA, in that you have a gazillion individual units running around as opposed to soldiers being grouped to add punch to their collective power. Once again this is just my personal opinion based on watching many tests.
At the time I scripted Leif Ericson, I didn't even know what attack-groups was. I thought it was a 1-man group attack now. That was my method of replicating an attack-group attack, which it turns out isn't unique. It seems like BTGKrush at Nat Selection also use it. I'm thinking this might be leading to my idle attack soldiers. I think testing is required to fix it. Keeping percent-attack-soldiers at 100 might also be doing it.

About the evaluation numbers, I didn't really understand them and I didn't bother. Over time, I've gradually reduced the enemy-sighted-response-distance, although I don't know what kind of effect that will really have. Another test required. :)

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

Re: Leif Ericson AI

Post by Campeador »

Leif, in one test I've found a litte space to improve in your strong script. In late castle you stopped soldiers production to advance to Imperial Age. Well, it's a good idea, but you didn't spend neither resources in the blacksmith techs for infantry. IMO this idea is worse, because the reason to imperial is take more researches, so I suggest take every important castle age rech, even if it delays your imperial time.

I know you are very busy, so I suggest you to forget this advice until you have free time again. Then you'll find this post in your thread and you'll can remember it. This is the reason because I haven't waited to post this, because my memory is weak. Back to your studies and correct this problem (if you want) after exams.

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: Leif Ericson AI

Post by Leif Ericson »

Thanks Campeador for posting this. I'll gladly take any tips I can get, and it's great to have them recorded in a nice, tidy spot. I'll be redoing a lot of the script, but I'll make sure to fix this for update 1.4.

User avatar
offwo
Guru
Posts: 541
Joined: Mon Feb 21, 2011 9:31 am

Re: Leif Ericson AI

Post by offwo »

Leif Ericson wrote:Current Version: Leif Ericson 1.2, updated 20 February, 2010.



Strategy:

Leif Ericson advances to the Dark Age relatively fast
Yes, it does advance to the Dark Age relatively fast, it takes 0 seconds! :rofl
those hackers are just idiots, i spit on them :lol: - Mabuse

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: Leif Ericson AI

Post by Leif Ericson »

How? When? :P

User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: Leif Ericson AI

Post by Leif Ericson »

Here's a surprise update to my old AI for the Davis Cup. Very minor updates, mostly to prevent LAG from looping attack-now commands from when I was a scripting noob. :D

Version 1.32 - 10 March, 2022:

-fixed looping attack-now commands
-increased the max villagers to 130 from the old 1.0c limit of 100 and increased max trade carts from 15 to 30
-enabled sn-enable-patrol-attack to help TSA be more intelligent
-added Chieftains tech

User avatar
FireBall37
Swami
Posts: 175
Joined: Sat Aug 22, 2020 10:49 pm
Location: United States

Re: Leif Ericson AI

Post by FireBall37 »

i can’t wait to see him play! :)
author of the Shadow AI and Snippets

User avatar
MrElephant
Swami
Posts: 113
Joined: Sun Dec 20, 2020 6:28 am

Re: Leif Ericson AI

Post by MrElephant »

Go Leif AI, go! We are rooting for you!

Good luck in Davis Cup 6!
Author of Charon, Reactionary, Ahulane, and BlackKnight!

Post Reply