Jump to content

Great Idea for AI Decision trees


Recommended Posts

OK, so everyone saw my scripts on AI decision garrisons, where if a certain tile was occupied by a garrison, a certain set of scripts would trigger.

Well, the limitations with this are that there are only so many remote map locations where this can work, interference from the enemy and plans grabbing units, having to use a corps, etc.

I think I have the solution, at least until global variables get here.

Here's what you do:

1. Take the vanilla map and add a new map portion, either extending south or east. Make it so that the original borders remain and the border is impassible, like a depression. Make it deep enough that nothing can penetrate the border.

2. Create islands, or land, or whatever you want, past that border with AI corps (The build limit will have to be increased to accomodate them). These corps are STRICTLY for decision trees, they will never see action. make them minors so the AI doesnt try to upgrade them. An alternative is to create unit scripts that pop the corps into existance.

3. Viola! You have as many decision garrisons and tiles as you need to make a flexible and large decision tree!

You can all expect version 1.01 of my Axis AI Mod to be fielding this, will the resulting MUCH enhanced variability. :D

Link to comment
Share on other sites

While this is an ingenious idea, I think it also goes to show once again how desperately you modders do need these global variables.

SO I REALLY HOPE HUBERT IS READING ALL THIS AND DOES GIVE IT HIGHEST PRIORITY FOR THE NEXT PATCH!

There is much talk about that the AI has to be improved. One of the most efficient ways to do this seems to me to give the scripters (like Edwin and Normal Dude) more degrees of freedom ...

Link to comment
Share on other sites

For HC it would mean one big time of work, and then waiting for you modders to make the other patches tongue.gif

I entered this thread when ND opened it, and I was sure it was a total good idea and highly interesting, but I just did not know what he was speaking of.

Really, although till now I did not test any of your works (I make my own map at the moment and try to learn the simple basics of scripting for myself), I have to admit that I'm looking forward to play the game with your modded scripts.

Please keep going. ;)

Link to comment
Share on other sites

Basically, a Global Variable is a common value that can be used to trigger AI scripts for Planning, Research, Production and Diplomacy.

With a GV you can tell the AI to research Subs and Build subs at the same time. This is better than having the AI build subs without researching Submarine Warfare or having the AI research rockets when it does not build any.

Link to comment
Share on other sites

Uhm... let me repeat. You can script research and building plans. Something like:

Research Rockets: Chance of 20%

Research Submarines: Chance of 30%.

And in another script:

Building rockets: Chance of 20%

Submarines: Chance of 30%

Right? If that is true, you have the problem, that the 20% Chance to research rockets may come true, but also the 30% chance to build submarines.

Then the Germans could build superrockets, but in fact they build lousy submarines.

I don't know for sure if you meant this, but at least it's the thing I can imagine by now (as I said, I try to learn the basics, and the AI is nothing I was busy with, yet).

But if that is true, how can you solve that problem with impassable units at the end of the world?

Link to comment
Share on other sites

Correct,

With A GV you can activate a build script where the chance to Build Subs is 100% and a research script where the Change to Research Subs is 100%.

Since SC2 does not have GVs modders are using the Activation_Conidtion.

Where a specific Scipt (i.e. the Build Subs 100% and Research Subs 100%) activate is a specific tile is occupied by.

Thus you;

1. Write a script to garrison (occupy a tile).

Example: 20% Garrison Tile X,Y

Example: 30% Garrison Title A,B

2. Then check to see if the tile is occupied. If so then activate these scripts (Research Subs 100%, Build Subs 100%, Conquer Norway 100%).

Link to comment
Share on other sites

Your take is correct, the problem with that approach is that much of the time, the AI will decide to research great subs, and then buy lvl 0 rockets.

As for the impassable units at the end of the world, they work like this:

1. A set of random event triggers are made. Each one tells the AI to garrison a specific x,y tile. Cancels are set up so that either only the first even triggered actually happens, or combinations are allowed or what not.

2. Now that one event has triggered and one certain x,y tile is occupied (permanently), there is another set of scripts (Say, a full line of scripts directing Germany to attack Scandinavia) that trigger IF AND ONLY IF that specific x,y tile is occupied. Plan scripts, research scripts, purchase scripts, and diplomacy scripts can be triggered this way; only if a certain x,y tile is occupied.

3. If that event does not trigger and that tile is never occupied, then those scripts never happen.

4. Another set of random triggers for x,y tiles can be set up after the first one, so using the scandinavia example: the first x,y tile triggers the scandinavia scripts. A second set of events could trigger more x,y tiles, which trigger a sub-set of scripts telling the AI to attack Norway then Sweden, and another possible set could tell the AI to attack Sweden then Norway.

Link to comment
Share on other sites

Lol... NOW I understand. You are thinking around corners. I know that kind of modding from my time with civilization2 where you must use what you have and that is not much. As long as HC does not implement GVs, you have to work that way.

It's a great idea. Thanks for explaining. ;)

Link to comment
Share on other sites

But in context, the AI can only buy two Rockets. And most scripts, including the defaults and the new and improved NG scripts never research rockets or purchase rockets anyway. So its no real issue. The scripts I've written for each country go by date. USA concentrates on Ind/Prod in early years. Switches over to Inf/Infas/ASW in mid '40. Then has a higher weighted % chance of researching tanks/AF/Bombers if London is held...and ASW/Gunnery if London is not held. If London is not held then more Naval action is likely. Also the Purchase scripts will buy Naval assets is London is not held, otherwise it focuses on air assets (and also more weighting toward tanks). The only issue I had at first was with Purchases and HQ's. But again, script weighting by date...and better inclusion of a few HQs into each production track solved the immediate issue of the AI having ho HQ and no supply. Other than that, the random purchase que works fine. If you want to emphasise tanks, put it first in the purchase script list. Once the max allocation is purchased the AI will skip it and have the money for the next unit type. By placing the lesser number (of available) unit types first the basic problem is eliminated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...