Assertive Seawall AI

I made some more tests, and I think there are some inconsistencies with the behaviour.
In almost all games, AI still doesn’t look for a new place to put docks, and in fact, they try to build a ton of them in the same place. Also, outpost come up too late, at the 10 min mark at earliest, when my ships are already in their docks.
I have also noticed that the ai doesn’t build fishing ships, and I think its because the function to make a navy before economy. Thats ok, but the problem is their shipment order: My first shipment at age 2 is ships, but the ai sends sometimes musketeers or some upgrade to land units before sending ships. They also send villagers and crates, but I think they should always send ships first. The way I’m playing the map, My first dock produces fishing ships while my shipment of caravels is my main navy, at least at the start of the game. Having the ai rely solely on building ships and never getting a dock up, because they never look for other places or defend them, wrecks them economically. I’ve even seen AI building 2 docks before making any ship, when maube that wood could be use somewhere else if the ai doesn’t have any navy yet.
I made some tests with Portugal too, and I’ve noticed they don’t use the TC wagon, at least not on age 2, it stays there. With Incas, I’ve also noticed they won’t use their Stronghold travois, so it is less protection.
I would say a change in their deck logic would help them a lot, specifically two cards in age 2: The 2 ships every civ gets, and the 2 outpost wagons ot their equivalent in other civs, as it is 500 wood saved (for ships) and the wagons build them faster, so its a cheap and fast way to defend themselves, rather than build them one vill at a time.
As always, some recordings:
AssertiveWall AI Spanish vs Inca.age3Yrec (8.4 MB)
AssertiveWall AI Spanish vs Brits.age3Yrec (8.2 MB)
AssertiveWall AI Spanish vs Ports 3.age3Yrec (8.6 MB)
AssertiveWall AI Spanish vs Indians.age3Yrec (8.8 MB)
AssertiveWall AI Spanish vs Italians.age3Yrec (8.7 MB)

I do had one game tho, where portugal did spaced out their docks, they had like 3 places and they defended one with a tc; sadly, that recording was corrupted and cannot be seen. Such a bummer.

1 Like

And here I add 2 more Ports recording that I couldn’t attach in the previous message.
AssertiveWall AI Spanish vs Ports 1.age3Yrec (9.1 MB)
AssertiveWall AI Spanish vs Ports 2.age3Yrec (8.2 MB)

1 Like

Thanks for the replays! I think I fixed the issue with the docks. I had some confusing double negatives going on. I’m still banging my head against the tower issue. It’s like the AI just refuses to start building any towers until it sees military units. I’m even trying to directly force it to build a tower at the same time it builds a dock but it still won’t do it.

I think I know the issue with the Portuguese wagons. The TC building doesn’t start until age 3 and I haven’t seen any special call out for ports to build earlier. I’ll put it on the list of changes to work on.

If the dock placement finally works for both of us then maybe I’ll turn my effort toward the caravel shipment so they can have enough time to get their towers up.

Edit: I’ve also noticed an issue with how I find “random” dock placement. It selects a random fish… Well with the way the map is set up most of the fish are down one corridor so I’ll try to limit the search to get a more even distribution.

I also think I’ve got the AI shipping 2 caravels first and weighting all other boat shipments highly, so we should see more boats getting shipped.

Now, this is much, much better. The AI had me running all over the map to find docks so they stop producing ships. I could really feel the difference. I’ll play a couple more to gather more feedback and give a detailed post, but I think you’ve got dock placement just how it should be. Now it needs the outposts, maybe a change in decks and some economic tweaks, as it is falling behind a lot in resources past age 2.

1 Like

Good to hear! The AI should be shipping 2 caravels first in age 2, but when I tested it they immediately started exploring with them so it’s easy to pick them off.

I think there’s a strategic issue going on with the resources. In the beginning we’re fighting only on water, but the AI is building up a land army. That allows us to dominate the water while the AI is off exploring and building up their land forces. Then they start losing docks and it’s too much to overcome. I could try limiting/delaying their land army until a specific time, like 7 or 8 minutes, even tying it to the rush/boom dispositions.

Gave it a try against the extreme AI on Caribean, large map.
The AI I got was aztec.

The good:

  1. The AI did try to attack me early on
  2. The AI did amass a huge fleet
  3. The AI did target my dock, destroyed it, and went for the next dock when I rebuilt it
  4. The AI had ship shipments in its deck.

The bad:

  1. The AI did not migrate to the TP island for resources, just took the trade posts. It did not try to contest once I took them over.
  2. The AI did not attempt to harass my canoes finishing whales. In fact, it seems to have completely ignored them
  3. The AI massed a large amount of units on land but did not ferry them across. Its attacks consisted of mostly 10 units
  4. The AI lost well over 200 units to ship fire, didn’t make any arrow knights to counter my ships from the shore
  5. The AI did not take water ceremony in its deck.
  6. The AI used its large fleet only when his army was destroyed, and only to suicide run against my forts, not to counter my ships.

I realize maybe some of these things are related to the aztec AI in particular, but I thought I’d share the findings.

1 Like

Thanks for the feedback!

I’m planning on throttling the AI army production to allow it to be more competitive on the water. I was thinking of limiting to 10-15 military pop before 8 mins and 15-20 military pop until 10 mins.

I haven’t started working on this yet. Eventually I want the AI to work on Ceylon and Archipelago, but that’s going to be a ways in the future.

Yep, the AI right now only builds attack plans against docks and warships. This is a good point though, I should make it attack all types of boats.

This has been an ongoing issue. I thought it was related to how the AI calculates whether or not to attack, but there may be more to it.

At some point in the future I want the AI to attack ships with artillery, but I haven’t gotten that far yet.

I think it’s fairly easy to get it in the deck, but getting them to use it may be more complicated.

I should be able to make a separate attack just against forts. The other issue though is the AI sends scouts - scouts that used to be single ships. I increased that so the AI will send scouting parties of several ships which is good when they encounter a tower, but bad when they encounter a fort. I might have to dig a bit into the retreating logic to get them to run away from forts if this is what’s causing it.

I have some more feedback, hope it helps. I’m going to breakdown some games I had with different enemies and give my thoughts on what can be improved. As it would be too long for one post, I will put one civ per post, but I’ll get round to all of them.
This is Spanish (me) vs US on hardest in the latest build of the AI:
AssertiveWall AI Spanish vs US 2.age3Yrec (8.9 MB)
Some notes on this game:

  • Ai builds second dock next to their fist dock before making fishing ships or navy.
  • Ai doesn’t choose a sea based federal state.
  • US commerce age navy shipment is Recruit Manilamen, which cost 300 food and 300 wood, so it doesn’t send it first, sending 8 Militia and 5 Regulars first.
  • Ai spends wood in barracks and militiamen instead of fishing ships and navy.
  • Ai spends wood in stable instead of fishing ships or navy
  • First ship (Sloop) gets trapped between docks because its built on narrow strip of sea. It needs to build the docks at the front or the side, not the back (maaaaaybe its 5th/6th dock, just to have one in reserve? but not at first).
  • Because it doesnt have fishing ships, the villager count by the minute 10:18 is 49 for me and 23 for the AI. At this point I’ve been producing fishing ships from my two docks and no navy, relying only in my 2 Caravel shipment for now.
  • Ai needs more navy shipments, as I can send a Galleon in Commere age, but the ai in general doesn’t equip more than the 2 Caravels and equivalent in that age.
  • Ai starts building fishing ships at minute 12, extremely late in the game. By this point, the vill difference is 53 for me and 27 for Ai.
  • Ai builds another dock in another place, but doesn’t protect it with an outpost, even having the wood for it. A shipment of 2 outpost wagon could work well too after the first fishing shipment, if the Ai keeps refusing to build them by its own. It also starts building another dock in a third place, which is good. I don’t know why their first two docks are always together, but after you destroy them, it seems they start to build them in different places.
  • Never mind, after destroying the second dock, the ai starts building all their docks in the third place, next to one another.
  • Form some reason, here the Ai starts a loop and starts trying to build all their outpost in the same place.
  • Lastly, the ai never reaches Fortress age, as it lacks economy without fishing ships.

Now, the US deck is detrimental to them is this kind of maps. Here is the deck it chooses:


Being a island map, it only has 2 navy shipments and one upgrade on Fortress age. On top of that, the only navy shipment in commerce has a cost of 300 wood and food. Here is what a full water deck for us could look:


You can see how the US has a lo of water shipments that the AI should use. Two sloop for free in commerce, infinite sloop too, upgrades to attacks of ships, Steamer and Frigate in third age along the upgrade it already had, and Ironclads in fourth age to siege enemy coastal defences and buildings, along with an upgrade for them and their mercenary manilamen ships. Along with them, fishing upgrades, docks upgrades, the irish and french immigrants to help the economy and outposts shipments in second and third age, which upgrades them automatically and coastal defences. Of course, you can always swap any immigrant or outpost shipment for wood/coin shipment, or maybe a fort, although an age up option gives you a fort too (more on that later), and the US General can build Forts too. A deck like this could really help the Ai contest the seas and prevent the player to gain a free passage through the islands.

Now, I wanted to talk about the choices it made with Federal States. For the second age, the ai chose Delaware, which gives it nothing to work on water. Instead, for the second age, the US ai should pick Rhode Island, which gives:


Corlis steam engine
Slater textile mill

Slater Textile Mill specially is importat to help them economically, but it is important that they start making fishings ships faster. Maybe this could be sen t after the first two ships? sending it before might make it prone to attacks early. Corliss Steam allows them to have Steamers in second age and Ironclads in third, which might help them siege. It also makes their upgrades to the route free, so having them be more leaned to contest them could help them, as more xp means more ships for them.

In my tests the AI never reached third age because of the fishing ship issue, but for third age, I would recommend Maryland, which gives:


Annapolis naval academy
Chesapeake Oyster Pirates
One for attack, one for booming. It may be tricky to balance the Sloops and Steamers between fishing and fighting, but a good ability nonetheless.

For the fourth age, there is not a specific water option, so it can choose any of them, although Ohio, which gives artillery, a fort and gives xp trickle to native sites; or Vermont, which gives interesting bonuses to Mills and States, and the Ai will eventually build them anyway.

For the fifth age. I’d say the best one is Connecticut:
Connecticut
Connecticut shipwrights
Bushnell's sapper corps

And that’s basically it. Keep in mind this was with US ai, some other ais do some things a bit different based on their own particularities and decks, but still it has a lot that can be applied to all Ais in general. Hope it helps you! Next one will be Japan, maybe in an hour or two when I finish some work first. Can’t wait to try a new update!

1 Like

Now Japan.
AssertiveWall AI Spanish vs Japan.age3Yrec (8.6 MB)
First, the game notes:

  • Here again AI builds its first two docks together, but doesnt use it to build fishing ships
  • This time the ai do sends its navy shipment, 2 Funes. However, it never sent it’s 1 Atabukane shipment, even when that can be send 2 times. It’s a good card for water maps but it’s never used.
  • The ai continues to builds calvary and infantry instead of building fishing ships or navy.
  • On this match, the ai tried to rebuilt their docks in the same place they built them before, making it easy for me to destroy them before they are up. They rebuilt their docks in the same time for the rest of the game.
  • At the 13 minutes mark, the Ai builds another dock in another location, but only the one, and nowhere else. Is from this one that it will start building its fishing fleet at minte 14 or so.
  • At minute 17 they tried to build a castle, but my navy were already on their shore, so it never went up. ALso, it still tried to rebuiold their docks in the first location.
  • On this one, the AI didn’t reach Fortress either, and I had double the vills that the AI because it didn’t had a fishing ships.

As for Age ups, I would say maybe to make it age up with the Great Buddha, as it helps it with exploration.

Now onto the deck, which again, is not the best, but it’s better than the US one:


And again, it only used the 2 Funes, not the 1 Atabukane. It never reached age 3, so I can’t comment there.
A deck for japanes on this map has to consider these cards:

Japan has a lot of good water cards. In the first age, after the two villagers one, that can be sent twice, an important one is East Indiamen, that gives you a free dock wagon and reduces fishing ships costs. This, again, after the ai starts building fishing ships again. It also can send 6 fishing ships in age 1 and 10 in age 2, as their respective cards can be sent twice. It can also send Fish Market twice in the first age, which gives an important boost to fishing rates, and in the third age Peacetime Fishing gives their warships a 125% on gather rates. Like with the US, it may be tricky to balance fishing and fighting with the same ships. With it, I have picked the 3 Castle cards, for cheap coastal defences and free upgrades for them. Still, you can change some age 2 card to put 4 villagers or 600 wood there, both can be sent twice. In third age you can pick 7 villagers or 100 wood, but I wouldn’t recommend the vills as fishing ships should be priority with so many upgrades. Also, there is this card that gives attack to fishing ships, I don’t know if they can be coded to attack, but having them raid my fishing ships with theirs would be amazing.

And that’s it with Japan. Next one is Ottomans.

1 Like

Thank you for the replays! I’ve been able to implement a handful of things. The biggest change is I’ve throttled the AI’s land military production for the first 12 minutes. This prevents it from dumping resources into units it doesn’t use. I noticed both you and I make little to no military until 10 minutes in, so I set the throttle around there. They can still make a little defense force, but we shouldn’t be seeing them build up massive armies under their TC right in the beginning.

I set the USA age ups, but I may switch the Age 3 option to Tennessee/New Hampshire since I don’t think the AI will make much use out of the Maryland option.

The dock placement on the back side of the island has always bugged me, but I’m not sure what’s going on there. The AI is supposed to start building docks at their naval HC point and only change as they see enemy ships.

I’ll add the fishing boat attack to the list of future changes, but it’s probably something for further down the road.


Change List:

  • USA age up choices adjusted for island maps
  • Dock build radius grows if it can’t find more spots to build
  • second dock placement delayed (by time)
  • enabled wagon monitor during age up to age 2
  • add warships, fishing boats, and forts to attack plan options. includes varied warship minimums to attack
  • throttle military production for first 9-12 minutes on island maps

Great, I will be testing today. I was also thinking, if it’s in any way possible, I can help you with making decks for the different AIs to use on island maps, as their decks right now are not the best for that situation. Updating right now.

1 Like

Deck building is somewhat tricky and randomized. The AI generates a deck based off of some conditions and exclusions. I would rather look for inefficiencies and ways to improve their behavior and decision making. Choosing age ups happens to be easy, so that’s a better place to start.

One thing I noticed is Japan stopped training settlers during their age up even though I’m fairly certain the Asian civs can continue training.

I’m also curious if I fixed the issue where tower wagons and TC wagons weren’t building in Age 2.

This is my idea list:

  • Set a big radius to try and build a seawall (also add walling back in for the AI)
  • Defend docks with artillery
  • Complex warship prioritization
    • Galleons & Monitors if there are enemy towers/forts
    • Frigates if there are enemy warships
    • Caravels if there are mostly just fishing boats
  • Garrison fishing boats
  • Varied fishing strategies
  • Return units from ancillary islands
  • PressTheAttack if winning
  • Portugal TC
  • Japanese fishing boat attacking
  • priority of fishing boat raids
  • USA age 3 age up options maybe change to tennessee/new hampshire
  • Allow for even more docks under certain conditions

So, fun fact, the devs already put this in and you can load up the unmodded game and play Nomad start on Ceylon. The AI will do what you described and instantly move their TC to the mainland.

Yeah I noticed it just after posting that :see_no_evil: :see_no_evil:

I must say, I’m still firmly convinced that the devs are still actively maintaining the AI, so I really appreciate that you’re doing this mod for us in the meantime. But if the devs don’t care about the AI anymore (which would make me so sad and disappointed), I might use your mod as a reference for future stuff… if you’re okay with that : D

2 Likes

Interesting! Is there anything in that code that you can implement for migration?

1 Like

Maybe I’m just impatient, but I’m not anticipating any major overhauls, especially to naval combat and AI behavior on the water. Besides, the most important things I’m writing are more like additions than edits.

Of course! Copy it all if you want. We’ll see how far I get.

I’m already working on it! I need to see if the transport code works and then work out the conditions. I’m basically trying to make a monitor that checks for idle villagers on the home island and ferries them to the main island (or maybe any island with resources and without an enemy base…) Then the hope is that they’ll start building things there but I’ll cross that bridge when I get there.

Some more feedback on this:

When playing empire wars, the AI does not transport its empire wars wagons.

When should they be transported? Ceylon? I’ll try to include wagons in the transport plan.

Also, check it out:


Defensive artillery staged by the docks

It’s slowly coming together!


Villagers just got transported! They immediately got on the boat and went back lol

3 Likes

If you’ve been following this with any interest, I highly recommend you give 3v3 on Amazon a try. This is the coastline my AI teammates built up with the latest update:

This is one of our opponents:

2 Likes

Amazing. I’m booting a game now and give you my thoughts.

1 Like