Jump to content

USA AI Script Development


Recommended Posts

In this thread I will post notes on my effort at improving the AI scripts for the USA.

First - To test these scripts I play with FOW off so that I can see what the AI is doing - what tech levels it has achieved and what it is purchasing.

1st USA Research Script

a. Created USA Research script for 1939-1940 that pours all MPPs into researching Industrial Tech and Intelligence and Production. I will experiment with changing the order of the tech research areas - I assume the techs listed first will execute first. So my first tech will be Intel, 2nd Industrial and 3rd Production with a maxiumum of 5 chits in each one. Am I correct? :confused:

b. At same time created Purchase and diplomacy scripts for USA in 1939-1940 to keep spending in these two areas at zero, so that all MPPs go into research.

[ April 15, 2006, 03:38 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

Possible AI Bug - RE: USA AI - TRANSPORTS

AI controlled transports do not move during the turn they created. Humans move transports during the turn they are created.

Scripting Tip - Use popups for Planning Scripts so you can see which scripts are being executed during the test bed phase.

Possible AI Bug - RE: USA AI - Transports

Transports ordered to the port of Manchester are offloading at Saint John's in Canada. Any idea why? I have a whole island full of US units now and 1 Canadian Air Unit.

[ April 15, 2006, 03:14 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

Hey Edwin,

Currently I'm working on the first patch but eventually (and hopefully relatively soon) going to put together a formal documentation on AI scripting and the whole AI process in general. This should hopefully help you with your script work and answer most of these questions as it can become, as you've seen, quite involved.

Link to comment
Share on other sites

Many thanks for the update. Looking forward to the documentation.

As you said the scripting can become quite involved and I am testing several ideas now and trying to understand better how amphibious invasions work - i.e. UK takes Trodheim if Norway is surrendered.

So far I spent some time on new research scripts - creating one for each year - and diplomacy scripts - i.e. UK purchases Diplomacy chits vs Spain - as this seems to be a favorite Axis strategy.

It would be helpful if you could play the game as a developer vs AI and see what scripts are triggering and what the AI is purchasing, has purchased - ie diplomatic chits, research chits, production.

[ April 16, 2006, 11:25 AM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

I expanded on the list of historical popup events included in Sc2 to include such items as Al Capone's release from prison, the expulsion of the Soviet Union from the League of Nations and the start of food rationing in the United Kingdom.

Each popup has a 25% of being triggered, thus each one will appear once in every four games on average.

Enhanced List of Popup Events for Sc2

I will be enhancing this list over time and noting the date of the current update.

For those leary of too many popups, I have set the trigger at 25% to show about 3 to 4 popups per game year. As my list grows I will reduce the trigger percentage; to 20% for example, to ensure that the popups remain events to be relished and are few and far between.

[ April 16, 2006, 10:51 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

HC, regarding first patch. I would appreciate it if you would consider adding a global variable script to the AI scripts - i.e. something that can be used to trigger mutually supporting diplomacy, planning, production and research scripts - that utilizes the standard activation and cancelation commands.

Question - which AI script runs first - Planning, Production, Diplomacy or Research? Can this order be changed or can scripts be assigned a priority?

Link to comment
Share on other sites

Here is a Unit Event Script to be activated when playing the Allied AI. With this script if the Axis controls Gibraltar on Dec 7, 1941 there is a 25% that the USA Pacific Fleet is transferred to the Atlantic.

Its a bonus to the AI, but an unpredictable one.

NOTE: If you want this event to always be activated then change flag to 1, otherwise you must select it in the script menu at game start.

{

#NAME= Peace With Japan

#POPUP= Empire of Japan to Withdraw from China, USA Lifts Trade Embargo

#FLAG= 0

#TYPE= 0

#COUNTRY_ID= 3

#TRIGGER= 25

#DATE= 1941/12/07

#DESTINATION_RESOURCE= 3,25

#DESTINATION_RESOURCE= 6,23

; Is Gibraltar Controlled by Axis?

#CONDITION_POSITION= 55,29 [1,1] [0,9] [1]

#UNIT= 9 [10] [0] [Arizona]

#UNIT= 9 [10] [0] [California]

#UNIT= 11 [10] [0] [Enterprise]

#UNIT= 11 [10] [0] [saratoga]

}

I have not figured out how to have the Pearl Harbor Popup not trigger if this event is triggered.

It would be better if the unit event could be limited to an AI Level (ie so it could only occur at Expert Level) and would only occur if the Allied Player is AI controlled (without having to manually activate or deactivate the script).

Of course, this is a temporary handicap until the Allied Naval AI is tweaked to deal with the Italian fleet arriving in the Atlantic.

[ April 16, 2006, 11:57 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

×
×
  • Create New...