Forthwind.AI (Version 1.71)

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
marathon
Waheguru
Posts: 1976
Joined: Fri May 14, 2010 2:30 pm

Re: Forthwind.AI (Version 1.51)

Post by marathon »

When updating your AI, it is good to drop an extra post because most people will otherwise not notice.

- REACTIVE-GATHERING is defconsted once, and then it is also defconsted inside the individual population-dependent constants. I commented out the first instance.

- #load-if-defined POPULATION-CAP-200 is true even for 225 pop cap!
For all those populations you can also add an extra line:
#load-if-defined POPULATION-CAP-EXTENDED

My personal advice is to replace this system with a goals system: up-get-fact resource-amount amount-unit-limit gl-pop-cap
and then do maths with it. You may want to not do this right now, but keep the idea in mind.

So, I added the ...EXTENDED line once, surrounding all pop caps > 200, and kept on debugging.

- In Gathering.per, line 1268 rule too long. I split it in two.

- Camps.per, line 98, town-center-foundation is not defconsted.
So, I took a load of constants from The General, and I also put a line to load UserPatchConst.per. This is included with Userpatch download, but it is basically in the folder of practically every UP AI.
Surprisingly, I discovered that you have defconsted Condottiero and Slinger. I recommend that you do not defconst already defconsted things (like Castle, Villager, Mill, and in the case of DE, Condottiero).
I commented out all those things. You could perhaps rename these constants, or simply let them be with their unitID. But it is a troublesome part of the code and you should have a look. Most of these constants are already defconsted units, but a bunch of them are not. For those, you need to come up with an idea to avoid possible interactions.
For example (defconst feudal-skirmishers elite-skirmisher).
Since this constant is used in strategy selection (I think), then all you need is it to not overlap with other constants in this area. elite-skirmisher is not a value of any other constant of this group ;)

I then discovered that you have condottiero and condottiero-placeholder defconsted again (this time with their true unit ID). I removed them since I believe they are not needed.

Then, I saw that in Gathering.per, line 1134, goal ARCHER shows ARCHER as invalid.
Well, guess what, a goal ID cannot be 0. Archer ID is 0.

I stopped at this point.

screamingkoos
Forumer
Posts: 16
Joined: Wed Feb 05, 2020 6:27 pm

Re: Forthwind.AI (Version 1.51)

Post by screamingkoos »

marathon wrote:
Mon Apr 19, 2021 6:17 pm
When updating your AI, it is good to drop an extra post because most people will otherwise not notice.

- REACTIVE-GATHERING is defconsted once, and then it is also defconsted inside the individual population-dependent constants. I commented out the first instance.

- #load-if-defined POPULATION-CAP-200 is true even for 225 pop cap!
For all those populations you can also add an extra line:
#load-if-defined POPULATION-CAP-EXTENDED
Hey Marathon,

Can I just say wow! Every time you comment on here it's like my eyes are getting more and more open :lol: This is some seriously helpful info, as I'm beginning to realize there's still so much I'm learning. I didn't realize about posting each update, but I'll be sure to do that now.
There are many things I seem to either be semi confused about or because DE seems to be more forgiving, I end up overlooking some of the errors.

I'm definitely looking to learn more, as now I'm starting to realize even some goals (like REACTIVE-GATHERING) I am confusing how they should be implemented in the constants. Again, in DE it appears to just activate the last defconst at the bottom of the constants file. So I'll try to further clean up the defconst's. I hope you don't mind answering a couple questions here below:
marathon wrote:
Mon Apr 19, 2021 6:17 pm
- #load-if-defined POPULATION-CAP-200 is true even for 225 pop cap!
For all those populations you can also add an extra line:
#load-if-defined POPULATION-CAP-EXTENDED
Oh, so in WK is the max-pop only 200? Maybe I'll check out your AI consts if this is implemented in it, I might be able to figure it out easier. :)
marathon wrote:
Mon Apr 19, 2021 6:17 pm
My personal advice is to replace this system with a goals system: up-get-fact resource-amount amount-unit-limit gl-pop-cap
and then do maths with it. You may want to not do this right now, but keep the idea in mind.
I recently discovered this type of system, and so have implemented it for only military so far, as found in this rule in my ai:
;MY MILITARY
(defrule
(timer-triggered military-timer) ;on a timer to prevent possible lag (30 seconds)
(up-get-fact military-population 0 gl-my-military)
=>
(up-chat-data-to-self "my-military-pop: %d" g: gl-my-military)
)
marathon wrote:
Mon Apr 19, 2021 6:17 pm
So, I took a load of constants from The General, and I also put a line to load UserPatchConst.per. This is included with Userpatch download, but it is basically in the folder of practically every UP AI.
Interesting! So I am able to load that defconst file without it overriding my current defconsts?
marathon wrote:
Mon Apr 19, 2021 6:17 pm
Surprisingly, I discovered that you have defconsted Condottiero and Slinger. I recommend that you do not defconst already defconsted things (like Castle, Villager, Mill, and in the case of DE, Condottiero).
Yes, so the reason for that was condottiero and slingers were not working until I put those defconsts in. They weren't getting trained in the proper conditions. So that was why I found these defconsts from the promi folder, and now they do work. So I can run some tests and see if it works again without them.
marathon wrote:
Mon Apr 19, 2021 6:17 pm
Most of these constants are already defconsted units, but a bunch of them are not. For those, you need to come up with an idea to avoid possible interactions.
I see. This'll take some work to redo.
marathon wrote:
Mon Apr 19, 2021 6:17 pm
For example (defconst feudal-skirmishers elite-skirmisher).
Since this constant is used in strategy selection (I think), then all you need is it to not overlap with other constants in this area. elite-skirmisher is not a value of any other constant of this group
This part got me a little confused. The (goal FEUDAL-SKIRMISHER yes) goal is like a strategy goal. So when it is set to "yes" from the civ-stratgy file, it means that Forthwind will train offensive skirmishers (rather defensive). It's only activated for the feudal-age as part of the feudal-age strategies, so there wouldn't be a time where it trains elite-skirmishers (why the SKIRMISHER, and FEUDAL-SKIRMISHER goals are separated).

example:
;feudal skirmishers
(defrule
(current-age == feudal-age)
(goal defend-feudal no)
(goal FEUDAL-SKIRMISHER yes)
(unit-type-count-total skirmisher-line < 8)
(can-train skirmisher-line)
=>
(train skirmisher-line))

Hope this makes sense!
marathon wrote:
Mon Apr 19, 2021 6:17 pm
Then, I saw that in Gathering.per, line 1134, goal ARCHER shows ARCHER as invalid.
Well, guess what, a goal ID cannot be 0. Archer ID is 0.
Yeah so the ARCHER is the same thing as the FEUDAL-SKIRMISHER, it's a strategy goal for when forthwind should train archers. I thought that by having it in uppercase letters it wouldn't interfere with the game. It's like the same idea in your ai, for example:
(strategic-number strategy == xbow-rush)
Should my strategy files be strategic numbers instead of goals? For the ARCHER when it is no then it is 0, and yes is 1.
marathon wrote:
Mon Apr 19, 2021 6:17 pm
I stopped at this point.
Huge thanks for taking the time to look this stuff over. I got some debugging to do, in the meantime I'll implement at least the easier fixes, and the tougher ones later when I know for sure I won't completely wreck my AI :lol: Right now Forthwind works wondrously in DE, but WK seems to be an entirely different ballpark altogether.
Thanks again! :D

User avatar
marathon
Waheguru
Posts: 1976
Joined: Fri May 14, 2010 2:30 pm

Re: Forthwind.AI (Version 1.51)

Post by marathon »

That part with strategy goals is indeed confusing. You should take your time to fix it.
(defconst gl-archer-strategy 300) is a very nice idea. The ID of the goal is 300. The value of the goal is 0 or 1 (no or yes) depending on your rules.
This section with these goalIDs is troublesome, both because it uses already defconsted things, and because it sends them at 700+ ID range.

You cannot train condottiero anymore because, guess what, when you check (can-train condottiero) it checks whether that 700+ unit can be trained. Is it an eagle warrior? Is it a tarkan? A mushroom? I dont know, and it doesn't matter. You should not defconst already defconsted things. Call it archers, archer-strategy, condottiero-strat, anything that is not defconsted already.
I bet you cant train archers as well for the same reason.
Once you fix that part with strategy goals then you will no longer need to put constants for Condottiero from Promi. Besides Promi uses them because it also plays WK.

My AI uses SNs for this because it is an evolution of my pre-UP AI and back then we did not have the ability to compare goals with < > or whatever. We could only check (goal 1 3) and it is true only when goal 1 has the value of 3.
But with SNs, I can check (strategic-number strategy < 200) which for my AI means that its focus is still in feudal. Very convenient. For fast castle, for example, if this SN is >= 300, then it should not train any feudal units and it should not attempt to research a faster feudal, but rather take its time for a good food surplus before pressing the feudal button. With one simple search, I follow a path that fits many strategies. This trick with SNs was very common back then. All serious AI scripters used it. UserPatch initially started merely as an attempt to find which SNs were useless (so that we can use them for extra "goals") and secondarily to find the effect of some SNs that caused confusion among us despite our tests. Noone foresaw that this simple investigation would evolve into a massive project successfull af.

In WK max pop is not 200. It is 1000. PCM is a mod that has 1500 pop cap.
But, how to make old AIs play at 250 pop? For some time, 250 was seen as a potential new standard. But eventually 200 prevailed again.
So, an old AI with such pop-cap-depending load-ifs, can play the 250 pop assuming it is 200 pop. Better than nothing (and in fact some AIs are better at 250 pop lol).
So, engulf all 200+ pop caps within a population-cap-extended load-if.
But, again, you still miss some pop caps (like 475 lol). Using a goal to get pop cap is safer (and it helps me a lot when scripting for some mods that have variable pop cap).

I was the one that recommended DE guys to make it so that you can defconst something and then re-defconst it and allow the new defconst replace the old one. I proposed to have 2 versions, the old defconst (which gives error) and the new repconst (replace const) that allows overwriting. They chose to simply allow defconst to overwrite things.
I had (and I still have) massive problems with mods. I wanted to make a single AI able to play a constellation of mods. But it is next to impossible. Like, elephant-archer. Nice unit. Present in FE, WK, Realms, AG3, PCM, and many other mods. So how on earth do I do it?
Ah I wish I was not absent for 3+ years during the development of the final UP 1.5 version.

I have to (again) tell you to fix that part of the code with ARCHER and CONDOTTIERO. It is awful and it makes your AI malfunction in many ways.

screamingkoos
Forumer
Posts: 16
Joined: Wed Feb 05, 2020 6:27 pm

Re: Forthwind.AI (Version 1.51)

Post by screamingkoos »

Version 1.6:
- Welcome to 1.6! 1.6 makes effective improvements to Forthwind's core areas such as game compatibility,
more efficient behaviours, as well as the very important updated boar hunting rules to be compatible with the May 3 patch of DE.
- As always, thank you for your continued interest in these updates. Enjoy!

Release #8 Notes:

;Patch Updates:
- Updated boar rules to be compatible with May 3 patch (new patch ruined my boar rules temporarily).
- Added new maps from May 3 patch into Forthwinds system (like michi, crossroads, crater map etc).
NOTE: Forthwind has no idea how to properly play a Michi map, this only means he knows its a land-map etc...

;Compatibility:
- Added more rules about stone availablity on the map. If no stone is available (and low stone reserves)
then Forthwind stops building stone walls and gates (switches to palisade if wall building is enabled).
This hugely helps in megarandom maps and allows to save precious stone reserves.
- When Forthwind is relocating after losing all town-centers, wall building should now be permanently disabled.
- Forthwind better recognizes when to pause feudal-age villager training and when to reactivate it (based on
fast-castle or flushing conditions).
- Janissaries now get proper armour upgrades.
- watch-tower-line was not working in regards to micro, so for now, Forthwind is more likely to micro from tower-fire
(only watch towers for now, not the -line). (Again, this isn't perfect, it is only from the first building in its list it will run from).

;Efficiencies:
- Further improved overall dark and feudal-age gathering rules. Forthwind should be more competitive from
this.
- Feudal gathering FLUSHING ONLY rules are now specific to unit-type rather than generic strategies. This means Forthwind
goes mostly wood and gold for archers, food and gold for m@a or eagles, and mostly food for scouts. This alone
GREATLY improves competitiveness in the feudal age when Forthwind goes aggressive!
- Further improved some research rules.
- Improved villager rules (for flushing) so that Forthwind is more likely to advance to next age with more appropriate
villager numbers Example: would sometimes go 27 pop scouts because of abundance of food meant "train more villagers" when
it shouldn't have!
- Improved town-center building rules to react better when under attack or not.
- Added 5 new resign chats (such as the famous T90 "AMAZING LEARN")
- Updated escrow rules (testing new techniques in this version 1.6).
- Lowered "scout-timer" from every 10 minutes -> every 8 minutes so enemies are scouted more often.
- Additional smaller quality of life updates and fixes.

screamingkoos
Forumer
Posts: 16
Joined: Wed Feb 05, 2020 6:27 pm

Re: Forthwind.AI (Version 1.7)

Post by screamingkoos »

Forthwind 1.7 Updates:

Release #9 Notes:

- FIXED: Scout micro rules have been cleaned up. Forthwind micros scout to starting sheep using proper filters.
Scout does not run to ally bases or to the edge of the map anymore!
- FIXED: Cleaned up a scout micro rule that was unintentionally causing town centers not to fire on enemy units
within range.
- FIXED: Sicilians are no longer bugged! They now operate as they should have long ago! Should play properly now.
- FIXED: FAST-IMPERIAL has been corrected to "BOOM". All rules for "fast imperial" were actually booming behaviour, not
actual fast imperials (which is done in special circumstances, like turks on arena).
- FIXED: Condottiero's are now working again!
- When chatted taunt "72", Forthwind will focus on eagles if it is a meso civ, if not it will pursue regular swordsmen units.
- Sheep micro rule cleaned up to be more consistent and less buggy.
- Improvements with feudal age flushing, with more proper villager numbers (hopefully no more 27 pop scout
rushes lol)
- Added new rules so Forthwind immediately counters common units such as knights or archers in Forthwind's town-size. This
helps Forthwind to generally respond quicker to enemy "pocket-player" attacks. (Unique units not supported for this yet).
- Trade unit rules have been completely improved, less of mass trade units in the early to mid-game, and are now more situated to the
late game.
- Tweaked town-center rules so Forthwind is less likely to build very far from the starting TC. TC's are
now much more efficient and not as much free vil picks for the enemy!
- Testing new mill rules (an effort to modernize them from over a year ago).
- Town-size rules start a few minutes later so Forthwind's town doesn't get so massive in the earlier game.
- Scout timer set to EVERY 8 MINUTES (must of not saved this change in last update... oops).
- RESET-STRATEGY goal now correctly resets ALL strategies.
- Cleaned up some DEFCONST values, which were overlapping with other ones.
- Small changes to important strategic numbers (like attacking sn's).
- Created new "micro" file. Pretty bare for now, may add more advanced tactics in here depending on time required.
- Updated many of Forthwind's chats or responses to taunts to be more humorous (meme-friendly).
- Lots of script clean-up and re-imagining of various rules. Forthwind is stronger than ever! ;)

Thanks for checking out Forthwind!

lolasik43
Forumer
Posts: 16
Joined: Sat Nov 25, 2017 4:05 am

Re: Forthwind.AI (Version 1.7)

Post by lolasik43 »

Thank you for the new version !

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

Re: Forthwind.AI (Version 1.7)

Post by Promiskuitiv »

Thanks for the continued updates! :)
Creator of Promi.
Feedback is greatly appreciated.

screamingkoos
Forumer
Posts: 16
Joined: Wed Feb 05, 2020 6:27 pm

Re: Forthwind.AI (Version 1.71)

Post by screamingkoos »

Forthwind Version 1.71 Updates:

- I soon after discovered some serious bugs in new rules I made for version 1.7! Mostly regarding
extreme trade unit production and town centers that were built sometimes in enemy bases and super
far out of Forthwind's base. This hotfix fixes those issues and touches up on a few smaller issues.
Forthwind is more consistent and in many ways stronger with these fixes (no more easy vill picks)
as well as a different play style!

-ScreamingKoos

;==========Release #10 Notes:

- I forgot to mention in previous builds that taunting "250" to any Forthwind ally or enemy will
display current Forthwind version you are playing with!

- FIXED: Trade unit rules were missing important goals in version 1.7, they have all been implemented
properly now, and have been tested. Forthwind now delays trade units, and builds less than previous versions allowed.

- Town center rules have been fully redone. The previous "experimental" rules made Forthwind do the opposite
of what was intended; Forthwind would build town centers SUPER far from his town, usually in enemy bases (even
in arabia games). Due to the seriousness of this unintended play style, Forthwind now builds default town centers
randomly in its town-size. This makes for a much more consistent Forthwind, and Forthwind no longer runs out of areas too quickly
for building new farms. This will remain the norm for Forthwind until I figure out some better, more stable rules for town centers.
- So far, these new town center rules have been very promising in tests, in many ways Forthwind has a way better eco just from building
farm town centers.

- Added new rules that enables Forthwind to build additional lumber and mining camps to increase efficiency.

- Brought back old mill rules that enable Forthwind to build deer or boar mills.

- Forthwind is now more aggressive early feudal-age when flushing.

- Touched up several eco upgrades so Forthwind (especially as burgundians) does not research them immediately anymore.

- Disabled some repeating "chat-to-self" commands in order to help limit excessive performance usage. These are used mainly
for testing purposes but will remain disabled in all future releases.

- Other minor touch-ups or fixes in general.

lolasik43
Forumer
Posts: 16
Joined: Sat Nov 25, 2017 4:05 am

Re: Forthwind.AI (Version 1.71)

Post by lolasik43 »

Thank you for update !!!

halcyon88
Forumer
Posts: 7
Joined: Mon Mar 16, 2015 2:43 pm

Re: Forthwind.AI (Version 1.71)

Post by halcyon88 »

Just dropping in to say I love this AI and its resign excuses are hilarious.

Post Reply