Jump to content

Scripted AI Strategies for Scenarios


Recommended Posts

One feature that i think SC2 needs is scripted strategies for the AI in scenarios.

For example in the Fall Blau Scenario:

1. The Axis units pound endlessly against the Brits in Egypt.

Why not a chance for the AI to withdraw excess units from North Africa to Greece so they can be used in Russia or France.

2. Axis Units do not withdraw to form a defensible line in Russia, they maintain a forward line where they are easily outflanked. Why not a 50% for the Axis to withdraw to a defensible line and a 50% for a forward defense.

3. The Allies should sometimesr mount an attack against Italy, sending forth the Navy followed by Armies and Corps.

[ June 14, 2005, 08:32 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

I am assuming the generic SC2 AI will be similar to what we had before, as Hubert described:

Generally I tried to use Fuzzy Logic and broke it down into a few levels along the lines of what the AI has to do at the basic combat level, an immediate objective level where it has to think about defending or seeking out resources/cities etc., and then the strategic level, who do I declare war on etc.
The AI scripts will be new, and I would assume there will be different types to address the different AI levels. Obviously, we're not there yet in the playtesting so I really can't say. I would caution folks not to expect miracles with the new scripts. We may be able to trigger more "historical" behavior here and there, but the risk will always be how the AI handles ahistorical gameplay with scripted constraints to do something historical when such action may be totally wrong for the new situation.

We can hope for the best. As I've said before, with the event scripts combined with the AI scripts, we should be able to craft a very decent and challenging game. smile.gif

Link to comment
Share on other sites

Thanks for the update.

Ideally, what I would like to see is some general purpose AI scripts that affect the deployment of units in country or ocean regions of the map.

For example:

1. Minimal Defense - excess units in region are withdrawn to other areas.

Example: Axis - Minimal Defense (Libya) means that excesss units are withdrawn to the continent. In the Fall Blau scenario this would cause the AI to withdraw all units except for 1 corps in each city from Libya.

2. Strong Defense - sufficient strength kept in area to prevent enemy conquest.

This in the Fall Blau Scenario you might have:

Libya - 50% Minimal Defense (German Armor, German HQ, Italian HQ and Italian Corps withdrawn to continent), 30% Strong Defense (Only Italian Corps kept in Libya), Strong Offense

[ June 17, 2005, 06:16 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

I dont think the difficulty is to define what a minimal Libya defense is, or what a "Garrison the Italy heel" is eg, the difficulty is too choose which set of script should apply to a given situation, as some are antagonists, or just very difficult to understand (what are the sign telling an England AI that Sealion can happen for example?).

Link to comment
Share on other sites

Good question,

Telling an England AI that Sealion can happen?

I would handle it in this manner.

A forumula that takes into account:

1. Naval Intelligence reports large increase in number of Naval Vessels - on reports screen - number of German Naval units increases a lot.

2. Axis Land Units are not engaged elsewhere is a sign that something is up.

3. Once Russian or US War Readiness is above 70% the chance for a Sea Lion is practically non-existant.

4. Destruction of the UK fleet increases the chance for a German Sea Lion.

5. Strong AD reduces the chance for a successful Axis SeaLion as air power attacks on London are negated.

6. Advances in Axis Long Range Tech and large number of air units increases chance for Sea Lion. (remember that the range of Air units in SC2 is reduced).

7. The biggest change in Sc2 is the ability of Amphibious units to move to a costal hex and land in one turn. This means that all coastl cities or the approaches to them must be guarded.

8. Intel tech (new tech in Sc2 that tells you if enemy units occupy a city tile and/or its surrounding tiles). Tells you that Axis units are crowded around ports of Brest, Antwerp, etc.

[ June 18, 2005, 08:24 AM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

good definition, now if you look at what it asks for scripting, then you see that there is much work to do in the code:

1. increase in naval vessels. To be generalized with an algorithm that can give you the total number of units of several types. Memorize this variable within the script (so the script should allow the declaration of variable). Then each turn check the % increase between the new computing and the preceding variable. If above a thresold then give x points to the response: yes there is sealion at hand.

2. axis land unit not (significatively) engaged somewhere. Again should have a function that return you the number of unengaged enemies of a given nation, compared to the total they have.

4. destruction of the UK fleet. Compared to what? Do you mean compared to an absolute ideal count (that can be very variable depending of many factors) or a big % loss between 2 turns?

and so on. Can be done, but it asks for much more than one month of developer works just to program the new functions. And I suppose that if you want to script enough operations to be precise, you have to code dozen of new utilities functions so that the script can deduce correctly what is happening.

Its feasible. Thats would be a very interesting part in developing a strategy game whats more. I wonder how Paradox coded its AI...

Link to comment
Share on other sites

Sea Lion Defensive AI activates if following evaluates to > 100%.

a. Russian War Readiness < 70% = +33%

b. Allied Naval Fleets in North Atlantic <= 4 = +33%

c. Axis Units Crowded Around Antwerp + Brest = +33%

d. German Naval Units Jump by 100% from one turn to the next = +33%

e. 2- Axis Amphibious Units sighted within range of UK = +33%.

f. 3+ Axis Amphibious Units sighted within range of UK = +100%.

Thus if any 3 of the conditions are met then Sea Lion Defensive AI activated.

What does this AI Routine Do:

1. Recalls UK Navy to UK

2. Garrisons all Cities

3. Build Land Units

4. May Recover Research to Build Land Units.

[ June 18, 2005, 11:23 AM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

The Allied AI also has to consider if it should adopt a Control the Atlantic Strategy. In Sc1 if the Axis player deployed a large fleet in the Atlantic the AI did not know how to respond, it just kept sending forth transports to be sunk by waiting Axis subs.

In most games this strategy will not be needed, but if the Human player decides to control the Atlantic then the AI should have a preprogrammed response that it can use to guide its actions.

Example:

Control the Atlantic Script Activated if Axis Fleets in the Atlantic > Allied Fleets in the Atlantic.

I assume that the AI will know how many Axis fleets are in the Baltic, Black Sea, Atlantic and Mediterrean. This information will help to guide its actions.

For example:

IF Axis Fleets in Med >= 3 x allied Fleets in Med = Aggressive Strategy in Med.

IF Axis Fleets in Med < Allied Fleets in Med = Defensive Strategy in Med.

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

[ June 18, 2005, 01:29 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

Here are a few simple ideas for the AI:

1. Let the AI know how many combat naval units are in each theater; Baltic, Atlantic, Med, Black Sea, Red Sea but not where they are.

2. Let the AI know how many combat ships that each side has so it can use this to alter its own production and research strategy.

3. Let the AI know how many enemy ground and air combat units are in each region: North Africa, Nordic Countries, Iberia, Western Europe, Eastern Europe, UK, North America, Russia, Middle East, - but not where these units are.

At higher AI levels the AI would be more likely to use this information to help plan its actions.

Beginner AI - 0%

Intermediate AI - 50%

Expert AI - 80%

Genius AI - 100%

EXAMPLE: At Expert level the Italian AI has a 80% to Know how many Combat Ships are in the Med.

Based on this it will alter its tactical strategy to:

Italy has 4:1 or better Advantage = Naval: Reckless Offense (if Italy has 4+ ships and UK has 1 ship in Mediterrean)

Italy has 3:1 Advantage = Naval: Aggresive Offense (if Italy has 6 ships and UK 2 ships in theater)

Italy has 2:1 Advantage = Naval: Cautious Offense. (AI uses Corps Transport to scout area ahead before advancing fleet).

Italy has 1:1 Parity = Naval: Defensive Strategy.

Now, if it does not know the strength of Allied units in the Med. it will use its default strategy or select among the other strategies randomly.

===========================================

[ June 18, 2005, 11:15 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

Dude, your a nice guy & all that crap...but face it, the A.I. is a joke, it's not worth the time to program in a game like this, too many things going on. If you script the moves, the players will figure them out too. Play TCP/IP!

We'd rather have Hubert work on player to player stuff than some A.I. Far as I'm concerned, he remove the A.I.!!!!!!!!

Link to comment
Share on other sites

The idea is NOT to script the tactical AI moves Jon, but to let her (him, it?) recognize in which situation he is (forces distribution only), the tactical AI making the effective moves.

Making a good AI is feasible, but it asks time. Now should this time be invested in new features for MP for example? I dont think so, because you have to remember that MP players (and I belong to MP players) are by essence the more voicy, and the vast majority (SP players) are silencious (well its less true for a online distributed game, but still true).

For me your rules are ok Edwin, for the counter Sealion 'posture'. (well there is loopoholes to consider, if for example a German player pay attention to not increase its fleet each turn above the % threshold).

Now you have to solve how postures are prioritized between each other.

for example the 'Egypt threathened' script is also valid. What the AI should do? Split his forces between the resolution of the 2 scripts, the problem could be that there is not enough forces to achieve correctly any one of the script.

Or give absolute priority to a script, according to a hard-coded (well "script-coded", but absolute) value. Defend against Sea Lion having highest priority compared to Defend Egypt? The problem could be that a German player can try to "freeze" some of the English units (because they are devoted to Defend against Sealion) just so that he is free to act in Egypt.

There is also something to consider. We took an example of 2 scripts pertaining to differing physical locations (England & Egypt). I suppose it would be far more difficult to identify several scripts for the Eastern Front which is in essence a continuous line of units, and then "blend" them so that some forces be allocated to each script... as some scripts can "overlap" between each other (support)?: Defend Stalingrad & Defend Caucasus.

Hubert is taking the "hierarchical AI" approach, which is by far the most common scheme used. It has several advantages (the ability to split the problem into smaller parts, thus reducing computing time) and the big drawback of having the AI loose the 'Grand view'.

What I dont know is if he has splited its AI by agent: offensive, defensive, garrison, air, naval (or amphibious, naval superiority, ...). Thats would be interesting to know smile.gif

Link to comment
Share on other sites

for example the 'Egypt threathened' script is also valid. What the AI should do? Split his forces between the resolution of the 2 scripts, the problem could be that there is not enough forces to achieve correctly any one of the script.

And Fuzzy Logic to the rescue - where the AI will select Strategy A 75% of the time and Strategy B 25% of the time.

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

Furthermore, you could add two variables that would track the likliehood of the human player launching a sealion.

Variable 1: Number of Games Played as Allied AI

Variable 2: Number of Times Human Axis attempted Sea Lion before Russia DOW.

The more often that the human launches a sealion the more likly that the AI selects Strategy A over Strategy B. If the human player does not select sealion the AI "learns" to select strategy B over strategy A.

Example:

Should the AI select Strategy A(Sealion) or B(Defend Egypt)

Axis Human Launches SeaLion:

0 of 0 games: Select Strategy A 50% for game 1

1 of 1 games: select Strategy A 100% for game 2

1 of 2 games: select strategy A 50% for game 3

1 of 4 games: select Strategy A 25% in game 5

2 of 5 games: select Strategy A 40% in game 6

2 of 20 games: select Strategy A 10% in game 21

2 of 40 games: select Strategy A 5% in game 41

Thus the AI adjusts its actions based on the actions of the Human player when it has to decide between the two strategies in question.

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

I do agree that the Heirarchical Structure is best, but I do see areas where it can be improved to give a more interesting and varied game. In SC1 the Heirarchical approach used was quite simple, the AI would always follow the same strategy for defending France. What if it slected among a group of varied strategies for defending France?

For example:

Step 1: Decide on Overall Strategy and select supporting strategies.

A1. Defend France (60%)

A1.1 Corps Defense

A1.2 Massive Defense

A1.3 Armor Defense

A1.4 Standard Defense

Related Naval Strategies to Select From

-------A1.4.1 Sink Italian Fleet

-------A1.4.2 Preserve the Fleet (move egyptian fleet to Atlantic)

-------A1.4.3 Control Atlantic

-------A1.4.4 Sink German Fleet

-------A1.4.5 Navy aids in Defense of France

-------A1.4.6 Egyptian Ambush (send addtional fleets to Egyt and hide in Red Sea)

A2. Egypt First (reinforce Egypt) (20%)

-------A2.1 Control Atlantic (50%)

-------A2.2 Egyptian Ambush (50%)

A3. Run Away (20%)

Related Naval Strategies

-------A3.1 Preserve the Fleet (80%)

-------A3.2 Sink German Fleet (20%)

A4. Conquer Spain (5%)

-------A4.1 Support Spanish Evasion (100%)

A5. Conquer Norway (5%)

-------A5.1 Sink German Fleet (100%)

[ June 19, 2005, 01:16 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

One of my pet peeves in Sc1 was that the AI never reclaimed Tech chits like a human does to reinforce the line or lend needed support to a D-Day Invasion.

Example:

The Italian AI has Jets 3 (I don't know why but the Italian AI always seems to get more tech advances than the German AI).

When the Allies invade Italy it should consider (Beginner AI - 0%; Intermediate 50%; Expert 95%)reclaiming those tech chits as it can never afford to build/reinforce new air units.

Simarily, the Germans should reclaim its Tech Chits to stop/delay an Allied or Soviet advance into Germany. Yet it never does so.

What rules would I use to guide this action of last resort?

Perhaps:

UK: If Axis Controls London = Reclaim Tech Chits and purchase Corps to delay Axis advance until American reinforcements arrive + Do not invest in Tech until London is liberated (to prevent AI from using MPPs from reclaimed chits to invest in new tech).

Italy: If Allies control 2 Italian Cities = Reclaim Tech Chits to reinforce a last ditch defense + Do not invest in Tech until Allies driven from Italy.

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

More importantly is that the Axis AI does not know how to employ the cookie cutter conquer the world strategy that will give it the production base that it needs to seriously contest the Human Allied Player.

As for the Allied AI, it does not know how to mount a proper invasion of France. Without a HQ unit the Allied invasion is going nowhere.

[ June 20, 2005, 12:20 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

×
×
  • Create New...