User avatar
Clovis
Posts: 3222
Joined: Wed Nov 09, 2005 7:43 pm
Location: in a graveyard
Contact: Website

How to build a better AGE AI with events

Wed May 12, 2010 10:08 pm

Lesson 1: suppressing the deep raids AI behaviour


First, as introduction, have faith in AGE AI. Athena knows her work, opeartionnally and tactically. The glimpse of brilliance regularly mentioned by players aren't the fruit of imagination. Athena can deliver serious threaths.

unfortunatly, Athena doesn't know geography. athena is a generic AI, built on manifestly a big number of algorythms destined to produce good results on a very curious map, where distances aren't the real important factor. An human will think "this objective has a vey high value, but the distance is too long for my supply. Athena will conclude it has to take this objective now, then Athena will compute the distance to plot the move.


So, how may you hinder Athena to look so far away?

It's very simple.

Divide the WHOLE map in 3 sectors: the first where Athena should have no interest because of the distance, a middle one and the last where athena should make its first offensive.

Apply to ALL the region of the fist aera a very low interest value; for the middle one, a value between 50 to 70; for the last a value of 130 or higher.

Then play. it's done. of course, here and there, you will have raids sometimes, but not so much.

Of course, you may change regional values if Athena has conquered some objectives.

The trick is to adress all regions. adressing only a part will just lure Athena in a bad geography lesson and Athena will suddenly be attracted by a remote region you will have not adressed.

Example ( From rise Of Prussia, Austrian AI):


SelectFaction = $AUS
StartEvent = evt_nam_AI_AUS2innerzone|1|0|NULL|NULL|NULL|NULL

Conditions

CheckAILevel = 1
MinDate = 1756/09/01
MaxDate = 1762/01/01

Actions
AI.ChgLocalInterest = $Otterndorf;5;$Stade;5;$Winsen;5;$Weser;5;$Bremervorde;5;$Achim;5;$Scharnburg;5;$Rotenburg;5;$Syke;5;$Bremen;5;
AI.SetLocalInterest = $Wismar;5;$Bolenborg;5;$Hagenow;5;$Ludwiglust;5;$Schwerin;5;$Parchim;5;$Doberan;5;$Rostock;5;$Schwaan;5;$Gustrow;5;$Plau;5;$Waren;5;$Neustrelitz;5;
AI.SetLocalInterest = $Rotweil;5;$Fribourg;5;$Hochberg;5;$Zell;5;$Bade;5;$Tubingen;5;$Gemund;5;$Giesling;5;$Schaffhausen;5;$Waldshut;5;$Badenwiller;5;$Heiteren;5;$Donesching;5;
AI.SetLocalInterest = $Wejherevo;5;$Gdansk;5;$Tczew;5;$Koscierzyna;5;$Lauenburg;5;$Butow;5;$Stolpe;5;$Schlawe;5;$Rummelsburg;5;$Koslin;5;$Belgard;5;$Gollnow;5;$Cammin;5;
AI.SetLocalInterest = $Colberg;5;$Schivelbein;5;
AI.SetLocalInterest = $Regenwalde;5;$Naugard;5;$Massow;5;
AI.SetLocalInterest = $Oder1;5;$Oder2;5;$Oder3;5;$Oder4;5;$Wangerin;5;$Greifenhagen;5;$Stargard;5;$Arnswalde;5;$Schwedt;5;$Soldin;5;$Pyritz;5;$Woldenburg;5;$Friedeberg;5;$Landsberg;5;$Berlinchen;5;
AI.SetLocalInterest = $Kustrin;5;$Drossen;5;$Zielenzig;5;
AI.SetLocalInterest = $Kosteletz;5;$Wildenschwert;5;$Trubau;5;$Schonberg;5;$Freiwaldau;5;$Freudenthal;5;$Sternberg;5;$Troppau;5;$Ostrau;5;$Zwittau;5;$Boskowitz;5;$Kramsir;5;$Olmutz;5;$Danube8;5;
AI.SetLocalInterest = $Tischnowitz;5;$Crudin;5;$Saar;5;$Chotieborsch;5;$Deutschbrod;5;$Trebitsch;5;$Brunn;5;$Znaim;5;$Brumlo;5;$Krems;5;$Stain;5;$Iglau;5;$Teltsch;5;$Korneburg;5;
AI.SetLocalInterest = $Meppen;5;$Quakenbruck;5;$Cloppenburg;5;$Oldenburg;5;$Nordenham;5;$Wilhelmshaven;5;$Aurick;5;$Leer;5;$Papenburg;5;$Rhede;5;$Nienhus;5;
AI.SetLocalInterest = $Leemern;5;$Elbe1;5;$Elbe2;5;$Molln;5;$Heide;5;$Itzehoe;5;$Hamburg;5;$Oldesloe;5;$Lubeck;5;$Oldenborg;5;$Preetz;5;$Kiel;5;$Rendsburg;5;$Segeberg;5;$Eutin;5;$Neumunster;5;

EndEvent

SelectFaction = $AUS
StartEvent = evt_nam_AI_AUS3middlezone|1|0|NULL|NULL|NULL|NULL

Conditions

CheckAILevel = 1
MinDate = 1756/09/01
MaxDate = 1762/01/01

Actions
AI.SetLocalInterest = $Frankfurt;5;$Elbe8;5;$Furstenwalde;5;$Beeskow;5;$Zossen;5;$Juterborg;5;$Treuenbrietzen;5;$Konigs Wusterhausen;5;$Luckenwalde;5;$Burg;5;$Genthin;5;$Brandenburg;5;$Herzberg;5;
AI.SetLocalInterest = $Templin;5;$Angermunde;5;$Bernau;5;$Neuruppin;5;$Pritzwalk;5;$Kyritz;5;$Spandau;5;$Berlin;5;$Freienwalde;5;$Neudamm;5;$Gross Neuendorf;5;$Munchenberg;5;$Eggersdorf;5;$Potsdam;5;$Tangermunde;5;
AI.SetLocalInterest = $Minden;5;$Bielefeld;5;$Weilburg;5;$Wetzlar;5;$Dillenburg;5;$Biedenkopf;5;$Siegen;5;$Iserlohn;5;$Meschede;5;$Lemgo;5;$Rinteln;5;$Dortmund;5;$Hamm;5;$Soest;5;$Munster;5;$Gutersloh;5;$Greven;5;$Osnabruck;5;$Bramsche;5;$Lingen;5;$Rheine;5;$Benthem;5;$Stenford;5;$Horstmar;5;$Oldensael;5;
AI.SetLocalInterest = $Wejherevo;5;$Gdansk;5;$Tczew;5;$Koscierzyna;5;$Lauenburg;5;$Butow;5;$Stolpe;5;$Schlawe;5;$Rummelsburg;5;$Koslin;5;$Belgard;5;$Gollnow;5;$Cammin;5;$Colberg;5;$Schivelbein;5;$Regenwalde;5;$Naugard;5;$Massow;5;
AI.SetLocalInterest = $Rawicz;5;$Konin;5;$Jarocin;5;$Krotoszyn;5;$Kepno;5;$Turek;5;$Kalisz;5;$Wieruszow;5;$Zgierz;5;$Warta;5;$Zloczew;5;$Zdunska Wola;5;$Belchatow;5;$Lodz;5;$Pjotrkow;5;
AI.SetLocalInterest = $Trzczianka;5;$Krzyz;5;$Miedzychod;5;$Skwierzyna;5;$Miedzyrzecz;5;$Wolsztyn;5;$Wschowa;5;$Leszno;5;$Chodziez;5;$Wapno;5;$Wronki;5;$Rogazno;5;$Eggersdorf;5;$Potsdam;5;$Tangermunde;5;
AI.SetLocalInterest = $Wagrowiec;5;$Solec;5;$Szamotuly;5;$Grodzisk;5;$Poznan;5;$Gniezno;5;$Mogilno;5;$Alexandrow;5;$Koscian;5;$Sroda;5;$Wrzesnia;5;$Vistule04;5;$Colberg;5;$Schivelbein;5;$Regenwalde;5;$Naugard;5;$Massow;5;
AI.SetLocalInterest = $Neuenburg;5;$Pelplin;5;$Swiecie;5;$Tuchola;5;$Czersk;5;$Chojnice;5;$Czluchow;5;$Zlotow;5;$Pila;5;$Walcz;5;$Bydgoszcz;5;$Vistule02;5;$Vistule03;5;$Neu Stettin;5;$Falkenberg;5;
AI.SetLocalInterest = $Elbe9;5;$Elbe10;5;$Eisleben;5;$Halle;5;$Querfurt;5;$Naumburg;5;$Zeitz;5;$Merseburg;5;$Leipzig;5;$Eilenburg;5;$Bitterfeld;5;$Zschornewitz;5;$Torgau;5;
AI.SetLocalInterest = $Wurzen;5;$Oschatz;5;$Chemnitz;5;$Dresden;5;$Pirna;5;$Dobeln;5;$Dippoldiswalde;5;$Marienberg;5;$Mitteweida;5;$Aue;5;$Oelsnitz;5;$Freiberg;5;$Zwickau;5;
AI.SetLocalInterest = $Elster;5;$Finsterwalde;5;$Dahme;5;$Luckau;5;$Lubben;5;$Furstenberg;5;$Guben;5;$Forst;5;$Sorau;5;$Muskau;5;$Cottbus;5;$Grossenhain;5;$Senftenberg;5;
AI.SetLocalInterest = $Hoyerswerda;5;$Windisch Kamnitz;5;$Radeberg;5;$Kamenz;5;$Bautzen;5;$Weisswasser;5;$Zittau;5;$Gorlitz;5;$Penzig;5;$Soest;5;$Munster;5;$Gutersloh;5;$Greven;5;$Osnabruck;5;$Bramsche;5;$Lingen;5;$Rheine;5;$Benthem;5;$Stenford;5;$Horstmar;5;$Oldensael;5;

EndEvent

SelectFaction = $AUS
StartEvent = evt_nam_AI_AUS4outerzone|1|0|NULL|NULL|NULL|NULL

Conditions

CheckAILevel = 1
MinDate = 1756/09/01
MaxDate = 1762/01/01

Actions
AI.SetLocalInterest = $Bergen;150;$Schwine;150;$Wolgast;150;$Greifswald;150;$Grimmen;150;$Stralsund;150;$Malchin;150;$Anklam;150;$Stettin;150;$Zegenort;150;$Gartz;150;
AI.SetLocalInterest = $Prenzlau;150;$Zechelin;150;$Neubrandenburg;150;$Treptow;150;
AI.SetLocalInterest = $Minden;5;$Bielefeld;5;$Weilburg;5;$Wetzlar;5;$Dillenburg;5;$Biedenkopf;5;$Siegen;5;$Iserlohn;5;$Meschede;5;$Lemgo;5;$Rinteln;5;$Dortmund;5;$Hamm;5;$Soest;5;$Munster;5;$Gutersloh;5;$Greven;5;$Osnabruck;5;$Bramsche;5;$Lingen;5;$Rheine;5;$Benthem;5;$Stenford;5;$Horstmar;5;$Oldensael;5;
AI.SetLocalInterest = $Rhein3;150;$Rhein4;150;$Rhein5;150;$Rhien6;150;$Rhein7;150;$Speyer;150;$Worms;150;$Mainz;150;$Oppenheim;150;$Koblenz;150;$Bingen;150;$Andernach;150;
AI.SetLocalInterest = $Mayen;150;$Koln;150;$Nuys;150;$Rhinberg;150;$Karlsruhe;150;$Stuttgart;150;
AI.SetLocalInterest = $Hunfeld;150;$Fulda;150;$Lauterbach;150;$Bruckenau;150;$Kissingen;150;$Alsfeld;150;$Schluchtern;150;$Schweinfurt;150;$Gemunden;150;$Wurzburg;150;
AI.SetLocalInterest = $Neuenburg;5;$Pelplin;5;$Swiecie;5;$Tuchola;5;$Czersk;5;$Chojnice;5;$Czluchow;5;$Zlotow;5;$Pila;5;$Walcz;5;$Bydgoszcz;5;$Vistule02;5;$Vistule03;5;$Neu Stettin;5;$Falkenberg;5;
AI.SetLocalInterest = $Lohr;150;$Wertheim;150;$Mergenthenn;150;$Erbach;150;$Bensheim;150;$Aschaffenburg;150;$Heidelberg;150;$Hanau;150;$Gelnhausen;150;$Nauheim;150;
AI.SetLocalInterest = $Brunn;150;$Znaim;150;$Brumlo;150;$Krems;150;$Stain;150;$Iglau;150;$Teltsch;150;$Korneburg;150;
AI.SetLocalInterest = $Karlsbad;150;$Falkenau;150;$Kralowitz;150;$Rokitzan;150;$Pilsen;150;$Mies;150;$Taus;150;$Marienbad;150;$Tachau;150;$Prachatitz;150;$Zwiesel;150;
AI.SetLocalInterest = $Elbe11;150;$Elbe12;150;$Reichenberg;150;$Hohenelbe;150;$Trautenau;150;$Koeniginhof;150;$Turnau;150;$Nimburg;150;$Warnsdorf;150;$Tetschen;150;
AI.SetLocalInterest = $Leipa;150;$Jungbunzlau;150;$Leitmeritz;150;$Schlan;150;$Budin;150;$Ritschan;150;$Prag;175;$Sasau;150;$Kolin;150;$Pardubitz;150;$Tschaslau;150;
AI.SetLocalInterest = $Chlumetz;150;$Koeniggratz;175;$Nachod;150;$Lobositz;150;$Laun;150;$Brux;150;$Boehmisch Brod;150;$Jitschin;150;

EndEvent
[LEFT]Disabled
[CENTER][LEFT]
[/LEFT]
[LEFT]SVF news: http://struggleformodding.wordpress.com/

[/LEFT]
[/CENTER]



[/LEFT]

User avatar
Gray_Lensman
Posts: 497
Joined: Mon Jun 18, 2007 4:04 am
Location: Who is John Galt?

Thu May 13, 2010 2:30 pm

Interesting...

Have you applied this same technique to any custom events in your AACW SVF Mod?

edit> If so, (the reason I ask), is this could be considered "outside" the definition of the "modable" Historical Database files and might possibly be allowed to be part of the upcoming AACW code patch depending on Pocus' opinion. :)

My own opinion is that such work wouldn't interfere with player/gamer Modding efforts, especially if these events were to be placed in an altogether separate event file to be linked into the campaign scenarios. This would eliminate modifying the various scenario specific event files. Improving the AI would surely enhance the overall replayability of AACW with or without Mods.

User avatar
Clovis
Posts: 3222
Joined: Wed Nov 09, 2005 7:43 pm
Location: in a graveyard
Contact: Website

Thu May 13, 2010 2:59 pm

Gray_Lensman wrote:Interesting...

Have you applied this same technique to any custom events in your AACW SVF Mod?

edit> If so, the reason I ask, is this could be considered "outside" the definition of the "modable" Historical Database files and might possibly be allowed to be part of the upcoming AACW code patch depending on Pocus' opinion. :)

My own opinion is that such work wouldn't interfere with player/gamer Modding efforts, especially if these events were to be placed in an altogether separate event file to be linked into the campaign scenarios. This would eliminate modifying the various scenario specific event files.


Exactly :)
[LEFT]Disabled

[CENTER][LEFT]

[/LEFT]

[LEFT]SVF news: http://struggleformodding.wordpress.com/



[/LEFT]

[/CENTER]







[/LEFT]

User avatar
Clovis
Posts: 3222
Joined: Wed Nov 09, 2005 7:43 pm
Location: in a graveyard
Contact: Website

Thu May 13, 2010 4:07 pm

Lesson 2: forts, depots and heavy guns


In this one will be examined the only AI cheating events I feel mandatory to get a better AI.

to say it bluntly, Athena is totally helpless fro depot or fort building. She doesn't know where and when to build them. Unfortunatly, suppy depots and in a less important measure, forts, are highly needed for good play.

You will have to help AI by events creating depots and forts. You will have too to create by events the heavy artillery needed for forts. you will have to use autogarrison to help Athena to get garrison for forts and depots.

Is it cheating? Of course. is it annoying? No. Players will never notice such a cheat, and the ressources spared for building will be wasted by Athena in some other fruitless aeras.


Examples:





SelectFaction = $AUS
StartEvent = evt_nam_AUSautogarrison|999|0|NULL|NULL|NULL|NULL

Conditions

CheckAILevel = 1
MinDate = 1756/10/16
MaxDate = 1762/12/01

Actions
AddGarrison = $Area_Memel;-1;$uni_RUS_Gar0;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Mazurien;-1;$uni_RUS_Gar0;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Ost_Preussen;-1;$uni_RUS_Gar0;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Mazowia;-1;$uni_RUS_Gar0;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_West_Pommern;-1;$uni_SWE_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Neumark;-1;$uni_RUS_Gar0;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Nieder_Schlesien;-1;$uni_AUS_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Nieder_Lausitz;-1;$uni_AUS_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Hannover;-1;$uni_FRA_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Hannover;-1;$uni_FRA_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Anhalt;-1;$uni_AUS_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Sachsen;-1;$uni_AUS_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Prag;-1;$uni_AUS_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Bremen;-1;$uni_FRA_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Westfalen;-1;$uni_FRA_Gar2;25;NULL;NULL;NULL;NULL;
AddGarrison = $Area_Hessen;-1;$uni_FRA_Gar2;25;NULL;NULL;NULL;NULL;

EndEvent



SelectFaction = $CSA
SelectRegion = $Dinwiddie, VA
StartEvent = evt_nam_CSA_Petersburgfort|1|0|NULL|NULL|$Dinwiddie, VA|NULL


Conditions
MinDate = 1862/01/01
MaxDate = 1862/02/01
CheckAILevel = 1


Actions
DescEvent = evt_desc_CSA_Petersburgfort
SelectRegion = $Dinwiddie, VA
CreateStruc
SetType = $Fort
SetLevel = 8
SetName = Petersburg fortification
Apply

EndEvent
[LEFT]Disabled

[CENTER][LEFT]

[/LEFT]

[LEFT]SVF news: http://struggleformodding.wordpress.com/



[/LEFT]

[/CENTER]







[/LEFT]

User avatar
lodilefty
Posts: 7613
Joined: Sat Aug 11, 2007 3:27 pm
Location: Finger Lakes, NY GMT -5 US Eastern

Thu May 13, 2010 4:50 pm

Not that "AddGarrison is actually quite a complex command
(actually, it's the execution of garrison placement that is complex) :blink:

http://www.ageod.net/agewiki/AddGarrison

For Athena, I'd be tempted to increase the ChancePerRPL parameter to a very high level to be sure she takes advantage of this.... :)
Always ask yourself: "Am I part of the Solution?" If you aren't, then you are part of the Problem!
[CENTER][/CENTER]
[CENTER]Visit AGEWiki - your increasingly comprehensive source for information about AGE games[/CENTER]

[CENTER]Rules for new members[/CENTER]
[CENTER]Forum Rules[/CENTER]

[CENTER]Help desk: support@slitherine.co.uk[/CENTER]

User avatar
Clovis
Posts: 3222
Joined: Wed Nov 09, 2005 7:43 pm
Location: in a graveyard
Contact: Website

Thu May 13, 2010 5:00 pm

lodilefty wrote:Not that "AddGarrison is actually quite a complex command
(actually, it's the execution of garrison placement that is complex) :blink:

http://www.ageod.net/agewiki/AddGarrison

For Athena, I'd be tempted to increase the ChancePerRPL parameter to a very high level to be sure she takes advantage of this.... :)


We're between seasoned evnts writers, no? ;)

A 25% seems sufficient.
[LEFT]Disabled

[CENTER][LEFT]

[/LEFT]

[LEFT]SVF news: http://struggleformodding.wordpress.com/



[/LEFT]

[/CENTER]







[/LEFT]

User avatar
Spharv2
Posts: 1540
Joined: Sat Feb 25, 2006 5:39 am
Location: Tallahassee, FL

Thu May 13, 2010 6:28 pm

Question I have, not having learned enough of the modding stuff is...Does the AI recognize any of the geographic or political divisions in the game? FOr instance, can the AI be "taught" to tell the difference between the different grand regions, or states, or anything like that? I kind of doubt it, but it would be a nice feature to add at some point, since it would seem to make things more diversified when assigning objectives and their progression.
Official Queen's Ambassador to the South
[SIGPIC][/SIGPIC]

User avatar
Clovis
Posts: 3222
Joined: Wed Nov 09, 2005 7:43 pm
Location: in a graveyard
Contact: Website

Thu May 13, 2010 9:40 pm

Spharv2 wrote:Question I have, not having learned enough of the modding stuff is...Does the AI recognize any of the geographic or political divisions in the game? FOr instance, can the AI be "taught" to tell the difference between the different grand regions, or states, or anything like that? I kind of doubt it, but it would be a nice feature to add at some point, since it would seem to make things more diversified when assigning objectives and their progression.


AI recognizes theaters, ie large aeras defined in the aera file and moddable. Athena is planning for each such theaters.

There are no direct event command for theaters, but Ai aggro level among other factors seems to play a role in the prioritization of some theaters.
[LEFT]Disabled

[CENTER][LEFT]

[/LEFT]

[LEFT]SVF news: http://struggleformodding.wordpress.com/



[/LEFT]

[/CENTER]







[/LEFT]

User avatar
Pocus
Posts: 25659
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Mon May 17, 2010 9:07 am

AddGarrison is not really a cheat, as the AutoGarrison feature is more an helper with a cost, removing the need for the player/AI (in some cases) to manually move units to a fort ... instead replacements will be paid. Not a cheat for me. :)

As for the AI wants for too deep raids/offensives, this can be tempered with some variables I exported lately ... but if you change them to much, the AI will be blind, only checking its surrounding ... Here the modifications by Clovis achieve a kind of 'compartment' effect that the AI don't do otherwise.

// Fitness calculation
aiGGF_LandGroupTimePen = 35 // Penalty to the fitness of a group toward a given objective, per turn needed to reach it, i.e (with 30%) if 2 turns away, then the fitness would be 0.7 of 0.7 = 0.49 of the normal one

aiGGF_FitDiscardAtk = 55 // Minimum fitness needed by a group to attack a region we don't own
aiGGF_FitDiscardDef = 30 // Same, but we own the region

aiMSG_CounterGroupMaxDistanceInPercTurn = 100 // Max distance in hundredth of turn
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

Return to “VIP Modding & AGE Engine Novelties forum”

Who is online

Users browsing this forum: No registered users and 3 guests