Idea for extremely reactive AI

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
billking
Posts: 6
Joined: Sun May 18, 2008 9:44 pm

Idea for extremely reactive AI

Postby billking » Sun May 18, 2008 10:02 pm

Hi. I have never done any AI mod work for StarCraft before, and to be honest I don't play very much. However, I watch professional matches with great interest on YouTube, etc.

The concept of a good computer AI is naturally intriguing to me and I'm interested in working on a script, although I haven't even started.

My concept is an extremely reactive AI. It should be any AI that actually looks at what the opponent is doing and reacts accordingly. Our tools to that end are limited to: enemyowns_jump, enemyresources_jump, and notowns_jump. Also, since micro is the computer's weakness, I intend to have it compensate with macro. It should expand whenever it has the opportunity to do so, hopefully crushing opponents with hordes of (poorly micro'd) units. Therefore, early game strategy would be to expand and defend, possibly with harassment of enemy expansions in the process. Although this is hard to do, I think some can be done with the tools we have, particularly in the early game.

Quick noob question: Does enemyowns_jump count partially built units? For example, if it's run against a player who is currently building a Spawning Pool, does it come back positive or negative?

Got to go. More questions, etc. later.
User avatar
ashara
Posts: 170
Joined: Wed Feb 06, 2008 11:12 pm

Postby ashara » Sun May 18, 2008 10:13 pm

Hi,

Using these commands is quite a good idea to make appropriate counters, I haven't had the time to put that in my Vshuman AI but I plan to add it.
I don't know what kind of AI you want to do but don't expect miracles, without good micro the AI won't have a chance against a decent human player in a normal 1V1.

Does enemyowns_jump count partially built units? For example, if it's run against a player who is currently building a Spawning Pool, does it come back positive or negative?

Yes it counts partially build buildings, I didn't test for units though.

Good luck for your AI.
billking
Posts: 6
Joined: Sun May 18, 2008 9:44 pm

Postby billking » Mon May 19, 2008 12:58 am

Oops, this probably isn't the right forum for this; I meant to post in Discussion but I must have messed it up somehow.

This would be a non-cheating AI. And although I understand that any AI 1v1 would be unlikely to beat a good player, I am still building it geared primarily towards to play against one human. The idea is to make the AI a basic skill test, capable of defeating weak human opponents. For example, I would like it to be able to sense when a player quick-expands early game (probably with a specifically timed enemyowns_jump on something like barracks or breeding_pool to determine if one is under construction), then if the computer didn't fast-expand itself (which would be a random_jump), it should be able to execute a rush and hopefully stand a chance of destroying the expansion. That might sometimes defeat a human opponent, although I understand that with poor attack micro a decent player would probably fend it off.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Mon May 19, 2008 7:06 am

The reason I always chose never to make an extremely reactive build order for any kind of AI is quite simple - it can be exploited extremely easily by the player to make a rather effortless game.
billking
Posts: 6
Joined: Sun May 18, 2008 9:44 pm

Postby billking » Mon May 19, 2008 7:58 am

[quote name='IskatuMesk' post='4106' date='May 19 2008, 02:06 AM']The reason I always chose never to make an extremely reactive build order for any kind of AI is quite simple - it can be exploited extremely easily by the player to make a rather effortless game.[/quote]
I've considered that. However, let's consider computer Terran vs human Zerg. I design the AI to check if the human went 12hatch or 9pool (I might integrate more choices, but let's imagine just these two for now). If the human deliberately holds off on his pool to signal to FE to the computer, how would that change the computer's strategy? I'd random-seed it of course, but the computer would either be doing its own fast-expand, or sending a Marine rush timed to hit a 12hatch build when it's weakest, or maybe just a quick tech to mnm. No matter which the computer picks, it should benefit from the fact that the human wasted time hoarding minerals as a feint.

The computer has only one edge over the human as far as I can see: free scouting. (Macro should be about even, and micro is the huge weakness.) I think it's important to use that strength somehow. In a way, that is like cheating ? how does the computer know you went fast-expand over 9-pool, when it didn't send a scout? I guess the computer at least gets the black sheep wall cheat going for it.

The key here, I think, is reacting to build orders with build orders, not reacting to units with units. Most of the checks would be for buildings like Spawning Pool or for 250 minerals stashed in the early game, etc. I imagine that in the late-game enemyowns_jump and enemyresource_jump commands would either be very ornate (to cover all eventualities) or, if that proved ineffective, replaced with random seeds, or some mixture of the two.
Endelite
Posts: 2
Joined: Sun Aug 31, 2008 11:56 pm

Postby Endelite » Mon Sep 01, 2008 12:31 am

Unfortunately, the computer can only check whether you have 1 of something or not, right?
Meaning that it cannot tell the difference between you having 1 gateway and 8.
Can the AI scripts even check whether or not a human has expanded?

Also, people argue that give_money isn't any worse than the computer knowing all that you build, but
1 - if I am correct in thinking that AI cannot check for numbers of buildings, it has a disadvantage of sorts, as actual scouting would reveal not only technology (or at least the buildings required for units and upgrades), but the results of their progression (numbers of units, buildings).
How many units is the human hording in defence? Are they only keeping defensive structures/units in one area, such as the main entrance or in the back of their base as well?
Anyway, computer sight reveals most of what would have been revealed a little later by scouting (as soon as it wants information it gets it; no delay, but scouting may still be able to retrieve the same information, albeit later.
give_money just gives it a sudden whack of resources.
Even worse, had it somehow mined all of the minerals and gas in its area, it would never have gained those resources.
It not only immediately adds resources, but increses the meximum bumber it could have on the map.

Imagine strong AI that took you into a stalemate after 45 minutes, started playing coy with you (barely any force left, barely any resources left on the map, a few workers and both computer and human with spare resources but neither with enough for an expansion. Whatever resources where left may once have had an expo, but it was destroyed. Now both players struggle to dwindle the number of buildings each has while avoiding static defenses and hoping to outlast the other (or hoping they'll slip up).
You could both try to use workers to slowly gather from the remaining resources and back to you expansion, but it may be risky (small number of workers remaining after the long war).
It could be close...
UNTIL enough time passes for it to get a new 2000 minerals and gas.
Even with few military buildings, suddenly producing a unit from each could double its force.
So it'll suddenly quintuple its force, expand safely with its force, produce more workers once the expo is up...
Epic stalemate to invasion from a hacker. It's like the computer saying "Don't mind me while I just inject this DLL into this process..."

Other notes/queries (of consideration to a highly reactive AI)
Is there a way of convincing AI to guard particular areas (where no expansion is to be found)?
Only I had the thought that AI which attempts to foil your scouting attempts could be entertaining.
Terran AI that attempts to block off the entrance with supply depots/barracks or intercept your scouting probe with one or two workers of its own.

If it misses out on slightly more minerals over that time (due to less workers actually working), it will have been worth it.
Imagine AI capable of quickly implementing counter-strategies to your own build but capable of recognising feints (send a few attackers if you seem to be hording resources instead of spending to hit you BEFORE you pump; judge whether or not is has a suitable force or whether it should wait for any more particular units in its build order before launching an attack).
Assuming it likes to make occasional decisions on its own and not everything is based on the human's actions (in case it can be tricked), preventing scouting could prevent a human from having a clue.
In the case of zerg, they could be building hydralisk den, going to a lair quickly or have 4 hatcheries in their main base, starting a spawning pool, undefended but readying itself to suddenly build 20+ zerglings.

It's be nice if AI could also analyse whether it was starting on higher ground with a ramp, normal ground etc.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Mon Sep 01, 2008 4:11 am

#6. If the player does not expand there are no scripted attacks for around 40 minutes. After that the player will get attacked whether they have expanded or not.


Uhh... what? Sorry, not the case for sure.

#5. They attack when they see the player has expanded to a new base. They try, if they can, to target expansions to prevent the player from getting out of where they started -- "starving" the player while the AI expands, eventually building enough troops to take over the player's starting base.


Attacks are completely random. I do believe the targeting code might have some kind of algorithm on it but there's nothing stopping a comp from targeting someone's main across the entire distance of a 256x256 map and ignoring a hundred expansions along the way. I've seen it way too many times.
a_of_s_t
Posts: 51
Joined: Sun Mar 23, 2008 5:39 am

Postby a_of_s_t » Wed Sep 03, 2008 5:34 am

[quote name='IskatuMesk' post='5161' date='Aug 31 2008, 08:11 PM']Attacks are completely random. I do believe the targeting code might have some kind of algorithm on it but there's nothing stopping a comp from targeting someone's main across the entire distance of a 256x256 map and ignoring a hundred expansions along the way. I've seen it way too many times.[/quote]

We could have the comp attack expansions by having a plugin center a location on a player's closest expansion to the computer and ordering attacks to that location. However, determining where these expansions are ( by measuring how many buildings are in an area) , if they are just make to distract the AI, or if they arent even really expansions would be the difficult part in writing a plugin like this.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Wed Sep 03, 2008 9:55 am

There's nothing wrong with the current method really besides the fact it doesn't take distance at all into account.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest