u/Justus_Pacificia

AI mods using pre-set hybrid naval card decks in SPC scenario games
▲ 3 r/aoe3

AI mods using pre-set hybrid naval card decks in SPC scenario games

I wanted to mention a little progress I had so far with the AI mods using custom scenario decks. I made a sort of naval treaty deck for Klaxon Superb AI and loaded them in a Carolina test map scenario. This is in relevance to the earlier post I made about custom AI scripts now being able to use full card decks in scenarios, as this shows a full naval hybrid card deck being used by the AI.

Here are some screenshots from showing the AI having a pre-set naval card deck in SPC scenario games:

Spanish Naval Treaty Deck

French Naval Treaty Deck

Portuguese Naval Treaty Deck

Dutch Naval Treaty Deck

Russian Naval Treaty Deck

German Naval Treaty Deck

Ottoman Naval Treaty Deck

British Naval Treaty Deck

Dutch AI sending 3 Infinite Privateers

Allies sending Privateers

Ottoman AI sending naval upgrade cards

These examples only show a speed always wins game, and the AI only has generic card shipment handling for the naval cards in the game, including the 1 Infinite Frigate card. That said the AI in the original game eventually sends everything, if it has maximum population count and maximum build limits of warships. It will then send naval upgrade cards if it has shipments available but nothing to spend them on. I made this as an example to show that even though these decks are still treaty decks, that technically anything can be done with the <defaultdeck> in custom scenarios with AI mods.

reddit.com
u/Justus_Pacificia — 2 days ago
▲ 11 r/aoe3

AI mods can build full card decks in custom scenarios starting with a blank deck, and also use hybrid decks in custom scenarios to override their normal deck for regular games

I found out something about homecity files when experimenting with AI mods in custom scenarios for Legacy AOE3.

HC Custom Campaign:

https://www.moddb.com/mods/bonus-expansion-pack/downloads/hc-custom-campaign

Three days ago I was testing one of my test map scenarios and I noticed that with the standard homecity file in original game, that the AI would start with a level 10 deck, and when I had loaded a level 131 homecity deck in the scenario editor for the human player, then the AI would be at level 131, but it would try to combine the 15 level 10 cards with 10 favorite cards in the AI mods. So I looked at it and guessed that 'My Deck' in the original Asian Dynasties works as an override for the homecity, so I duplicated the homecity files and then made 'My Deck' a blank deck for the AI players, copied it into Campaign folder, and then experimented from there. I got this part working two days ago.

What I found is that it was then able to construct from scratch a full 25 card deck as it would in a single player or multiplayer game, with all of it's favorite cards in there. I then yesterday experimented with using a card deck replacement in xml code, with a another duplicate homecity file copied into Campaign, and it worked to have 5 cards, 10 cards, 15 cards, 20 cards, 23 cards, 24 cards out of 25 cards, but not 25 out of 25 cards. The AI in the original game needs to 'build' the deck itself, so it needs room to fit in it's other favorite cards from it's card selection, unless the player has already chosen. This made me think that it is possible to get this feature to work to create custom Treaty Decks (which I then made for the 9 new civilizations in Bonus Expansion Pack), or Naval Decks, without changing cards in the AI code. I even experimented with new cards that I added in Bonus Expansion Pack 1.2, to see if the AI would fit them in the deck. It did!

What I found out was that for the AI to build a card deck in Legacy AOE3, it needs to be able to buy the cards during the game match based on the average homecity level of the human players. So in order to do this, I had to remove extraneous cards from the 9 new civilizations homecities (cards not enabled but in the homecity directory), in order for the AI to use full card decks. This wasn't a problem with the original civilizations, as all of their new cards started pre-purchased. So with this improvement I was able to choose 24 out of 25 cards for the new civilizations without needing to modify the AI script.

The current AI scripts that can use card decks in custom scenarios for Legacy AOE3 are Klaxon Classic, Klaxon Superb, Freestyle Gold, N3O Better AI Gold. So if you want to use this feature of blank card decks in custom scenarios and getting the AI to use them then download one of them and use it in your custom scenario.

The benefit of this feature with the AI is that it is possible outside of the game to give the AI an alternative card deck to match a scenario where you would want an optimal card deck instead of the AI pre-built deck (which in my mods is a hybrid deck with many late game shipments). Just to mention, AI players will use new cards added, even if they don't have card shipment handling for them. So it's 300 card weight value for Discovery Age cards, 600 for Colonial Age cards, 900 for Fortress Age cards, and 1300 for Industrial Age cards.

I don't know how well this feature works in Definitive Edition as I haven't tried it, but this feature definitely works for Legacy AOE3.

Here are some screenshots of AI card decks in scenarios:

British AI building it's standard deck in SPC games

French AI standard deck in SPC games

Portuguese AI Deck

Dutch AI Deck

Russian AI Deck

German AI Deck

Ottoman AI Deck

Swedish AI Hybrid Treaty deck made with xml

Maltese AI Hybrid Treaty Deck

Native Americans Hybrid Treaty Deck

United States Hybrid Treaty Deck

Black's Mercenaries Hybrid Treaty Deck

Pirates Hybrid Treaty Deck

The Circle Hybrid Treaty Deck

East India Company Hybrid Treaty Deck

Italians Hybrid Treaty Deck

Enjoy making your custom campaigns!

reddit.com
u/Justus_Pacificia — 3 days ago
▲ 6 r/aoe3

Equal work distribution in making AI mods

What I'm proposing here is instead of everyone creating their own AI mod, there could be an AI mod base used for many AI mods, such as the way that Draugur AI was used in Legacy. So if you use Assertive AI or Proper Gentleman AI as base AI script, and the work on something like homecity cards, then you can make your own personal version that uses the base AI script as a working version, plus all the improvements you want to add. For this of course you would need permission from the designer to use their AI script as a base AI script. But what I want to say about this is that if someone wants Treaty card decks for an AI, it would be better to use Proper Gentleman AI v1.5 as a base AI script, and then to have 4 or 5 amateur coders just work on experimenting with AI card decks and card weight for when to send them in the game. So instead of having one monster AI coder for each AI mod, have those who work on an AI mod rubric, those who work on forward bases, and those who work on specialties for their custom AI script.

My point here is that one coder doing all the code work with dozens of testers burns out the coder, instead of the coder actually getting to enjoy his work creation. I experienced this when I coded the AI for N3O Fan Patch back in 2013, and I didn't get enough rest so I had to take a break from getting sick with mind fog from 2013-2017, and then in 2018 and 2019 I came up with my new own AI scripts, The Helot Major AI and The Big Daddy AI (which was the forerunner to Klaxon AI). And then in the blame game many others blamed me for not doing well with code, or that I didn't have all the answers in coding, and I was still an inexperienced amateur in all of this code world work. So I know what it to be exhausted and framed for not being competent enough. And I also think that many young people thought that what American equals is top notch culture and winners only. I didn't want that with my AI mod creations, and my first AI mods in 2013-2014 era were too aggressive (0.6 btOffenseDefense and +0.4 aggressive bonus for attacking and +0.73 aggressive bonus for defensive roll) and incomplete.

So for me it's not that I can't do a good job, but that I feel that many players who ask for AI mods to include new features act very entitled and expect there to be AI mod improvements, without themselves ever delving in to changing a single code notch. I think that this has to change if someone liked an AI mod, but just wanted Treaty card decks. From what I know from the new AI code is that the AI rolls for it's favorite cards on Hard, Hardest and Extreme Difficulty, with some variation every time, and when you see an AI send cards you usually have to play a match versus them or record the game and watch the replay to see if they send it. If you could just use the AI script as a base, and then make your own custom playing version of it, even if you don't publish it, then it would be very good if you could save all the time not doing the basic AI work, and then just focusing on the fine refinements.

It's puzzling to me how so much has been expected from single coders, and people wanting to be avid playtesters, but then they don't want to voluntarily contribute by looking at the code and then saying 'what does this do in the game code?', rather than expecting some miracle coder to come along and give them their happy birthday cake for free. So with all due respect, it's good when an AI modder can do 90% of the code work for free; but what I'm saying is to get a really good script, you need to have other people finish the work of completing what an AI card deck should look like.

That said there should be no reason why AI mods become more important than living your life on planet earth. Because life deals with 100s of things; AI mods are cool things to make, but there has to be equal work distribution in order for them to actually improve long-term.

God bless you all!

reddit.com
u/Justus_Pacificia — 9 days ago
▲ 6 r/aoe3

Creating a B-tier Culture with AI mods supporting online players

What I want from this Proper Gentleman AI mod is to create a B-tier Culture, and then to let players replicate strategies for fair and kind play. So instead of shipping 3 Villagers in a rush game, have a game where you send Ironmonger instead. Or instead of going for the Whales on a water map, send Ironmonger instead and let the other player take the Whales. And then when you have this B-tier culture, you can then use the AI as an additional player for both sides to even out the challenge.

My main point with this is that in a Treaty game before AI mods came out, you had to play cards correctly, first economic cards, the military upgrade cards, then training speed cards, and then infinite cards. In in that time, it was the only acceptable culture for online play, an the AI wasn't good enough years ago to be a challenge in a LAN match. So when I developed my first AI mods for the original game, I improved their card decks significantly so that they could compete on Treaty games.

With the new project I feel that still the hope is that people want an A-tier AI script, but what I think is the problem is that we still have an A+ to S tier Culture. So there is no room for losing a match intentionally or letting someone else win the match against if, if you have the resources to beat them in an online match. I personally do not like this culture, and I see no reason why it shouldn't change. There is a fundamental problem with winners only culture, mainly because it is not sustainable in the long run. It sabotages the society from within.

What I think is the issue with online games such as AOE3 DE is that since the ceiling of expectations is so high, then players only want the biggest and the best AI mod to complement their online strategy. But I think again that it is the flashy attitude that we have in our community culture that is the problem; it isn't AI mods that are the real problem.

In our priorities to win everything, we try to win at work, at school, in life, and in games. And if Age of Empires 3 is to have a real change, a real revolution, this begins in our hearts; it begins by letting someone else win. And if you want to win together with an AI mod, then Proper Gentleman AI can help you have a good time together.

In treaty games the issue is for me that every game was played like a doom match, instead of a polite chess match where it didn't matter who won the game 20 minutes later. And in our personal lives, winning should be second to friendship. Playing to win is okay with me, but wanting to win 24/7? There should be a change to someone's attitude after winning for the 407th time with the same civilization, instead of promoting themselves as a champion moral libertine.

reddit.com
u/Justus_Pacificia — 15 days ago
▲ 19 r/aoe3

For me years back, when I first started creating AI mods, it was not the issue of the game, it was the issue of how other young people could be so unkind in the online game match. With the original AI mods, I made them beat meta strategies because they were made to push the limit of what AI could do. They were made to beat winners only culture at their own game, and were extensively tested for this. I have a different idea with my new AI mod. The goal I have with the new AI mod, Proper Gentleman AI, is to make a kind AI intelligence that plays all skill levels, not a winners only AI intelligence for the best only. Therefore I do not wish to rush the development of the AI script, because I do not want to see it exploited by modifying it to become too aggressive too fast, if for instance, I make it super-efficient at playing the game. So therefore my aim is to limit AI development and curtail it, and add general improvements to it over time.

My main pet peeve with AI is that it can go uphill very quickly or downhill if it is miscoded to do something morally wrong. It's ultimately not the game I'm thinking about, but how a young person would hijack an AI mod with basic code additions, by making it super aggressive or super competitive, and then using this AI mod online in order to win online games against other people. Whereas it may be fun to advance AI development very far in a short amount of time, I also feel like it is better to create a basic improvement over the original product, and rather wait for the game company to make new expansions or new additions, and use the AI mod as an interim product for patching up the weak side of the base AI script, and then wait for official development to fully fix it, even if it takes a few years for that to happen.

Altogether I realize that it takes time to well-test AI scripts, and it is important that whatever is released actually works as it is intended to work as, instead of rushing the development and having many mod errors or unusual bugs that pop up in the normal gameplay. My dream though with creating AI mods is to encourage more young designers to experiment with AI code, not just have three or four AI designers making premier AI mods. That said, I realize that the development of AI mods is a high demand thing, but the AI mod revolution that we actually need is that of having 20-30 AI mods available, even if they are low quality, rather than having only a few people coding masterpieces for AOE3.

When I looked at heavengames.com at Age of Mythology Heaven they had over 25 AI mods for the original version and new version of the game, and on Age of Empires 2 Heaven they had over 50 AI scripts for different versions of the game, whereas in AOE3 we have under 10 AI mods for Legacy and 3-4 AI mods for AOE3 DE. My point here is that to get a true explosion of AI mod content there has to be more than just five elite AI designers making AI mods. There has to be encouragement for young people to create more AI mods and to create their own custom AI projects.

reddit.com
u/Justus_Pacificia — 17 days ago
▲ 15 r/aoe3

There are several things I discovered while looking through the AI code. What I discovered mostly was in aiSetup.xs and aiBuildings.xs. In aiSetup the AI is told to have array numbers for the amount of military building types it is allowed to have, such as a Barracks, Stable, Artillery Foundry, Church, Tavern, etc. This allows the AI to blindly roll on which military building it wants to build. Then it has a placement randomization between 1 and 4 to tell where it wants to build it in it's main base. And in aiBuildings it is told to maintain a number according to what it is 'allowed' to build from the list of military buildings available for that faction.

In the base AOE3 DE AI code, there is a code snippet that has the AI military building values for how many it wants to build. In the original code part the AI is told to build 10 military buildings for Chinese (with Banner Armies), 5 for other factions, and only 1 military building until 10 minute before treaty period is up (so 10 minutes into a 20 minute treaty it will build military buildings). This results in the AI doing a Artillery unit spam (because it often builds Artillery Foundries first for some reason), Mercenaries (because it often builds a Tavern early), and less Infantry and Cavalry units than it should.

https://www.moddb.com/games/age-of-empires-iii-definitive-edition/downloads/definitive-edition-ai-with-walls

What I have changed is to increase military buildings from 5 to 8 for other factions, and up from 1 military building to 3 military buildings 10 minutes before treaty period is up.

Code except from aiBuildings.xs:

-------------

Where I put ignore lines of code:

/*

// How many buildings do we want?
puid = kbUnitPickGetResult(gLandUnitPicker, j);

if (kbUnitIsType(puid, cUnitTypeAbstractBannerArmy) == false)
{
numberBuildingsWanted = 10 * kbGetProtoUnitPopCount(puid);
}
else // Need more buildings for banner army because only 1 can be queued at a time.
{
numberBuildingsWanted = 5 * kbGetProtoUnitPopCount(puid);
}
numberBuildingsWanted = aiPlanGetVariableInt(maintainPlanID, cTrainPlanNumberToMaintain, 0) / numberBuildingsWanted;
if ((numberBuildingsWanted < 1) &&
((aiTreatyGetEnd() <= time + 10 * 60 * 1000) || ((gExcessResources == true) && (age >= cvMaxAge))))
{
numberBuildingsWanted = 1;
}
numberTotalBuildingsWanted = numberTotalBuildingsWanted + numberBuildingsWanted;
}

*/

And what I edited it to:

// How many buildings do we want?
puid = kbUnitPickGetResult(gLandUnitPicker, j);

if (kbUnitIsType(puid, cUnitTypeAbstractBannerArmy) == false)
{
numberBuildingsWanted = 10 * kbGetProtoUnitPopCount(puid);
}
else // Need more buildings for banner army because only 1 can be queued at a time.
{
numberBuildingsWanted = 8 * kbGetProtoUnitPopCount(puid);
}
numberBuildingsWanted = aiPlanGetVariableInt(maintainPlanID, cTrainPlanNumberToMaintain, 0) / numberBuildingsWanted;
if ((numberBuildingsWanted < 3) &&
((aiTreatyGetEnd() <= time + 10 * 60 * 1000) || ((gExcessResources == true) && (age >= cvMaxAge))))
{
numberBuildingsWanted = 3;
}
numberTotalBuildingsWanted = numberTotalBuildingsWanted + numberBuildingsWanted;
}

-------------

So basically what this does is that it increases the maximum number of military buildings wanted in the main base for the AI. It also increases the number of military buildings allowed to be built early on in the treaty period. This change is especially useful in High Resource starts, where the AI should build more buildings to save build-up time in the treaty.

My dad who plays comp stomps with me said he would give the new version of Proper Gentleman AI v1.5 an 8 out of 10, because it was more persistent and took longer to beat in the comp stomp (at least 10 more minutes on High Resources with 20 minute treaty than previous versions). That's an improvement over v1.3 which people gave a 7 out of 10 rating.

I have a few screenshots of some example games with this new military building update:

Example game showing American AI building more diverse military buildings

Swedish AI building more variety of mililtary buildings

American AI after Treaty period creating diverse armies because of more military buildings types built

Swedish AI having more diversity in unit compositions because of more types of military buildings built

A game from today showing AI tenacity where it took my dad and I eventually 47 minutes to win the game match versus the AI players. Our AI ally did well too, and he built 7 Blockhouses and 4 Artillery Foundries although this game the Russian AI did not roll build any Stables, so it's random what they choose from game to game.

Altogether I have solved the most important part of Treaty AI in AOE3 DE, and that is that they will now in Proper Gentleman AI v1.5 build the right amount of military buildings, something that Legacy AOE3 AI mods have done for years.

Anyways I hope you enjoy the creation and if you like a Treaty bot, this is beginning to go in the right direction, even though it can also be effective in Rush games to some degree as a boomer AI.

reddit.com
u/Justus_Pacificia — 26 days ago