Does the AI know when you have naval supremacy?

Moderator: Hubert Cater

Post Reply
Argothair
Posts: 30
Joined: Sun Dec 18, 2022 11:10 pm

Does the AI know when you have naval supremacy?

Post by Argothair »

I recently finished a game where I played the Axis against an Allied AI running at normal difficulty. As Japan, I sunk most of the American Pacific Fleet over the course of 1942 -- I killed something like 3 American battleships, 3 cruisers, and 4 carriers with minimal losses on my end. I similarly wrecked the British Indian fleet and the Dutch East Indies fleet. I also purchased 2 new Japanese carriers (in addition to the preloaded ones that automatically get built). My naval and air techs were only slightly behind America's.

As a result, the Japanese Navy outnumbered the Allied Navies in the Pacific by something like 3:1. The smart thing to do in this situation for the Allies would be to send the American Atlantic Fleet through the Panama Canal, or divert production from armies to warships, or find a way to stage a battle with some land-based air support (e.g. operate some fighters and maritime bombers to the coast of India, and then use what few American carriers were left in the Pacific to support an overseas attack from India to Japanese-held Burma or Japanese-held Malaya. Do something, *anything* to even the odds a bit.

Instead, the AI just gathered 2 escort carriers, 2 light cruisers, and 10 amphibious transports and blithely sailed to the Japanese home islands in 1943 as if the AI expected to just sail through unopposed. This strategy might have made sense if the AI had *won* all the previous naval battles and smashed the bulk of the Japanese fleet, but the opposite was true, so his transports were sitting ducks and were promptly sent to the bottom. After the invasion utterly failed, the AI made exactly the same attack in 1944, and again in 1945. The AI supported the attack with whatever handful of heavy ships happened to be pre-built in the automatic American production queue, but I don't think America purchased a single additional capital ship beyond what comes pre-loaded at the start of the game. It wasn't for lack of cash, either -- when the game ended I saw that there were 40+ land units just sitting in North America, presumably waiting for more light cruisers and escort carriers to become available so they could get on doomed amphibious transports, too.

So is there any way to get the AI to evaluate who controls the seas in any given year and then make purchases and attacks accordingly? I feel like the game would have been much more interesting if America had responded to its early naval defeats by building more warships and concentrating its naval forces to make a heavier attack, rather than just sending its ships across the Pacific one and two at a time to be sunk as soon as each ship gets built.
User avatar
Platoonist
Posts: 3042
Joined: Sun May 11, 2003 4:53 am
Location: Yoyodyne Propulsion Systems

Re: Does the AI know when you have naval supremacy?

Post by Platoonist »

I own four Strategic Command Series Games. War in Europe, World at War, World War One and the American Civil War. In all of them I've noted that the AI-controlled navies always seem to charge across the sea at you blindly in the best banzai tradition and get their respective heads handed to them. Even if the AI has the larger navy they always seem to take heavy piecemeal losses in ambushes although they can afford them a little more. Of course, if they have the inferior navy their naval forces usually cease to exist at some point--save for the more durable submarines. One way to avoid this and get a longer game is to hide out in ports or in an enclosed sea like the Baltic, but that just seems like saving the AI from itself. Not to mention it goes against the grain. Human players seem to know when to cut their losses and husband their forces, but that still seems to be a WIP for the AI.
Image
User avatar
Elessar2
Posts: 1451
Joined: Wed Nov 30, 2016 12:35 am

Re: Does the AI know when you have naval supremacy?

Post by Elessar2 »

All AI long-distance naval movements are controlled by scripts, where when enough ships are near a given port and the date in the script comes along it will invariably gather them all up and head for the scripted target no matter what enemy forces might be there and no it has no ability to look at the reports like humans do and note when they are outnumbered (or scout out the area first and turn the invasion around if it sees lots of enemy ships). Some modding has been done in this area, most notably by Lothos, but there still remain inherent limitations. Builds same thing-and based on patterns that I have seen more expensive units get bought less often than they should-the AI may run out of money tho there is an option to let it buy things anyway despite being broke.
User avatar
BiteNibbleChomp
Posts: 595
Joined: Mon Sep 12, 2016 1:52 am
Location: Australia

Re: Does the AI know when you have naval supremacy?

Post by BiteNibbleChomp »

I can't speak for the other games seeing as I didn't have any part in developing them, however in the case of ACW I can say that the answer is "sometimes", and even then it is under very specific conditions.

In ACW, if there's no Europeans in the war, it is a fairly safe assumption that the Union will have control of the seas (if they don't, they likely have so few ships remaining that it doesn't matter for AI purposes anyway), and the Union has effectively two jobs: (1) blockade the various Confederate ports with enough gunboats to shut down CS trade, and (2) have enough ironclads near a port to prevent a Confederate sortie doing too much damage.

As Elessar2 noted, every naval action more than a couple hexes from a ship's current location requires a FLEET script (the AI can repair ships that are near a port, and attack ships it can see if they're close by, on its own). In these scripts we can set the size of the fleet, and what unit types are to be involved in the movement action, as well as conditions to begin and cancel the script. For instance, a typical blockade script might look something like:
:arrow: Use 1-2 Ironclads
:arrow: Start at Beaufort (an offshore port near Charleston SC), move to a location on the Charleston blockade route, sit there for 4 turns, then return to port.
:arrow: Activate if <2 ironclads already at Charleston (this to ensure that it doesn't stack up excessive ironclads at Charleston at the expense of other ports that also need blockading).
:arrow: Cancel if Charleston is captured by the Union.

Now what happens if the Confederates deploy 5 monitors in Charleston harbour? I do have a couple of ironclads set to just patrol the Confederate Atlantic coast more or less at random, which will ensure it has the forces on hand to deal with the sortie in time (this works primarily because ACW has fairly strict limitations meaning the Confederate navy is likely to be confined to the coastline just outside its big ports). It is also possible to set up a new script, say "send 4 ironclads to just outside Charleston if Confederate navy strength is greater than X in the immediate vicinity", and/or set a cancel condition so it sends the existing blockade ships to port.

When I was rewriting the naval AI for the 1.03 update, I tried out a few things utilising the activate and cancel conditions, and ended up finding that having too many such conditions actually led to a sub-optimal result, as the AI got confused and just blockaded Norfolk excessively at the near-total expense of everything else. So I scrapped that idea and based Union AI strategy on the Union's current strength, rather than Confederate strength. This works for ACW, as the Confederate strategy is reasonably predictable - at each port one of three cases is true: (1) Confederates have no ships nearby, (2) Confederates have a small fleet but too weak to truly break the blockade, and (3) Confederates have broken the blockade: in the cases (1) and (2) the appropriate response is the same - blockade as normal (and let the AI fight the Confederates off), in (3) there's not much an AI player can do beyond send more ships to contest the port (hopefully in enough strength to beat the fleet back).

Teaching the AI to predict a player's actions in something like WW2 Pacific is a considerably taller order than ACW's coastal blockade - the enemy might not be just outside a port... he can be anywhere. And more to the point, the enemy's fleet can move too. It's all good and well to write a script "cancel invasion of Guadalcanal if a Japanese ship within 10 hexes of Rabaul", but that doesn't account for the player moving their fleet via cruise mode from the DEI to the Solomons next turn. Expanding the cancel range to account for that doesn't address the possibility of the player's fleet taking two turns to arrive. Moreover, too many of these cancel conditions can result in the AI becoming paralysed with fear of what might happen, preventing it from taking advantage of what opportunities it can make a success of if attempted.

So what's the solution? At this stage, there isn't a complete solution - the best computers in the world haven't yet mastered relatively simple games (I think they're close with Chess), much less something orders of magnitude more complicated like SC. What we can do - and have been doing - is keep making improvements as we find issues. The best way to help us to do this is to let us know when you see it doing something sub-optimal, and the more detail you give us the better.

- BNC
Ryan O'Shea - Strategic Command Designer
Argothair
Posts: 30
Joined: Sun Dec 18, 2022 11:10 pm

Re: Does the AI know when you have naval supremacy?

Post by Argothair »

Thank you for that thorough and fascinating explanation! I agree that your scripts probably work quite well for ACW; I haven't tried that one yet.

I hear you that having the AI cancel invasions when there are enemy ships nearby would lead to paranoia and paralysis. I'm not even that upset about failed invasions; a real military commander will try things that don't work sometimes. What bothers me more is that the AI doesn't ever seem to try to fix the problem where they've lost control of the seas. I think what's most urgently missing is some kind of purchasing script: if X battleships or X carriers get sunk, then build 1.5X battleships or 1.5X carriers and cancel production of enough special forces to pay for them. Or, alternatively, if you see 4+ Japanese carriers on the same turn, then have America build 4 carriers and 4 battleships and then attack with them as a group when they're all ready -- to paraphrase your logic from ACW, America shouldn't be seeing that many Japanese carriers at once if America is doing a proper job sinking the Japanese Navy, so if they see large numbers of Japanese carriers then the AI should execute scripts designed to sink them, as a higher priority than invading *any* island.

Conversely, some island-invasion scripts could be triggered based on not seeing Japanese carriers or based on sinking Japanese carriers, rather than being based on a specific date.

I'm only slightly familiar with the AI scriptwriting language, so some of these suggestions might be impractical, but hopefully they are at least useful as inspiration for anyone planning to tweak the campaign.
Post Reply

Return to “Strategic Command WWII: World at War”