Idea for extremely reactive AI

Help - Resources - AI Scripting - Grafting - Plugins - Modding Projects
a_of_s_t
Posts: 51
Joined: Sun Mar 23, 2008 5:39 am

Postby a_of_s_t » Sat Sep 06, 2008 12:11 am

But should the AI attack the cloasest, most dangerous expansion, or just the closest expansion?
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Sat Sep 06, 2008 12:13 am

Personally, I'd do what I planned for RequiemX.

Which was to have the AI attack the closest, most vulnerable expansions first, then weigh distances and threats accordingly, and either target additional nearby expansions or the main base depending on what enemy units are present.
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Wed Dec 24, 2008 10:30 am

[quote name='IskatuMesk' post='4106' date='May 18 2008, 11:06 PM']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 read this topic a couple weeks ago and just signed up here today, and wanted to say something, because your comment seems to discourage further exploration of this idea.

Hate to dash in here as Captain Obvious, but the AI already is easily exploited. You can cripple his economy seconds into the game simply by poking his base with a worker and running around for awhile. You can create a walled fortress he'll suicide units into time and time again without ever trying to go around it. You can get them to storm their own units. Some of the scripts on this website can be frozen simply by building on their main Geyser before they do. There's all kinds of ways you can abuse the AI.

Quite frankly, I doubt anyone here wrote these AI scripts specifically with the intention of pleasing people who'll exploit them instead of play fair matches. I'd rather have an AI that doesn't keep using Vultures and Tanks the whole game against a Zerg opponent that's built a Spire than be punished with opponents that leave glaring holes in their strategies just because some punk somewhere in the world might get a rise out of "beating by cheating."

That said, it's not like one couldn't use a randomjump command to determine whether to respond to something or not, if one was really worried about abuse. If the AI doesn't always respond to the enemy player having something every game, once more the AI opponent has been enhanced simply by avoiding acting like a piece of clockwork.

I heartily encourage further development of this idea. It may be of limited use, but to expand on the above example, why should a Zerg player beat half to death by Terran ground forces suddenly win just by building a handful of Mutalisks? If the Terran AI had reacted to the Spire construction, it could have had Wraiths or Valkyries ready to deal with the new threat in short order. Instead it could be vaporized now no matter how good it's doing simply because it doesn't have any mobile units to deal with air threats. Game over, and if the Terran AI was really putting up a good fight, I'd say that match was a bit anti-climatic. Especially if it takes another 25 minutes for the Zerg player to recover and destroy all the Terran buildings when he/she would have been dead in about 3. That little change could make a world of difference.
User avatar
Archon_Wing
Posts: 903
Joined: Wed Jul 25, 2007 11:22 pm

Postby Archon_Wing » Thu Dec 25, 2008 10:18 pm

This is probaly also why bwai gold and entropy have a mix of scripts that get randomly selected to prevent too much predictability. The latest version of gold doesn't report what script it's using like the old ones did so it does a better job of keeping you guessing (And what i mean is, scout!) so one isn't gonna know that the script is always gonna attack at 6:00 or have a certain amount of forces at a certain time.
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Thu Dec 25, 2008 11:01 pm

That's what has made Entropy II particularly attractive for me. The combination of randomly selected scripts is a really nice touch that forces you to at least keep tabs on the AI, and doesn't let you fall into a pattern of laziness as with playing Brood War's default AI after many matches; all you have to know is what race they are, and you're pretty well set, because the variety of strategy is marginal so you know exactly what they'll (try to) do. The Terran AI is easily the best of the three in this area, as the usage of Ghosts with Lockdown, Nukes and Spider Mined bases can have a significant impact on your strategy depending on your race (This variant is usually the bane of newer Starcraft players that try to make an army consisting solely of Battlecruisers or Carriers).

I recall somewhere bajadulce wrote that he had originally intended to make BWAI Gold a list of individual scripts to select from, possibly like BWAI 3.0? I'm glad he chose to do it this way instead with Entropy II, for the very reason you described, Archon_Wing. It turned out very good! Being kept guessing about what your enemy is doing keeps you on your toes and makes taking on AI opponents much more fun.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Fri Dec 26, 2008 4:24 am

Xerxes > My comment was made in the presumption you wouldn't be abusing the horrendously outdated AI coding methods Blizzard uses in their games, but instead a more substantial basis to work with. For example, in Supreme Commander, you can cripple Sorian's AI by rushing fighters and landing them in its base. It immediately assumes AA roles and you can just steamroll it with a follow-up land attack. A pre-built script can defend against both threats - with superior timing - than a dynamic script. Again, this is in a game where you actually have control over things like workers and placement, and not like Starcraft where everything is horrendously hardcoded.

I'd rather have an AI that doesn't keep using Vultures and Tanks the whole game


And so you do. You have Entropy, RequiemD, ect.

Judging by your posts you are not very well versed in how Starcraft AI works. It is not logical to have checks every few seconds for so and so structure and then presume they'll do this or that and base the AI's actions on that - that's exactly what I was talking about when I said it's easy to abuse such an AI. Build a spire, okay, they're going to dump their cash into turrets and you never build a single air unit. If this is a cheating AI, it doesn't matter, the AI will have units faster than you anyway (re: ZONS), but in the case of non-cheating AI, the scripters here know what they're doing and they designed their scripts the way they did for very good reasons.

Yes, I discourage further exploration of the idea in Starcraft. After eight years of writing Starcraft AI I have found under all circumstances that basing an AI exclusively on "reactive" activity in this game is simply not worth the time or effort and abuse is the least of your worries, succeeded by getting it to function decently at all. In a game where you can fix all of the ridiculous otherwise hardcoded issues with the AI, like slow building, horrible placement, bad economic management, inability to control priorities directly, ect, then yes, I totally agree with you - if it's done in moderation. But an exclusively reactive AI is boring to play, I know because every single person and their mother gets the super original idea to make a super reactive AI. Random jumps here and there alleviate the problem of repeditive, predictable gameplay, but as a player and a modder I'd much rather prefer having a very large selection of pre-built AI scripts with reactive elements; much like Entropy.

Also let's keep in mind I like to build AI's suited for big games, 8 player FFA's, 4v4's, ect. And I like to see a lot of variety around than all of the computers just trying to counter each other the same old way every time. That's basically what RequiemD is. If you wanted to build a hardcore 1v1 tournament-style AI, you'd probably have a lot more reactive elements but again the limitations of SC's AI makes such an AI suffer greatly.
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Fri Dec 26, 2008 10:33 am

IskatuMesk, this looks to me like a thread talking about writing a non-cheating AI for Starcraft with reactive routines. Half of everything you just posted seems completely irrelevant to the discussion. This isn't Supreme Commander, and we're not talking about money scripts that have all the resources they need at their disposal to make sure they have a full contingent of land and air superiority units ready for battle at all times if they can simply keep their factories alive.

Perhaps it was the OP's intention to build an AI revolving exclusively around reactivity. I however didn't see him explain that was specifically his intention, and so I politely assumed he was talking about using reactivity to a realistic extent - in moderation, as you so put - rather than rudely assume he has little or no idea what he's talking about or doing, as you've so eagerly assumed of me.

Since you've been a part of this community much longer than I, surely you're familiar with *all* the non-cheating AI scripts here and know very well that many of them never attempt more than a single major strategy. Yes I am quite aware I have Entropy II, but because some of the scripts are so single-minded and easily identifiable after a couple minutes of gameplay once you're familiar with it, my only major complaint about it is that Entropy II's strong point - randomity - is being diminished by this behavior. Once I recognize the script running I know to expect a wave of Mutalisks etc. next. One or two different reactions to enemy build order is a possible remedy for this, as would be multiple opening moves such as Blizzard's Protoss AI (although that Dark Templar attack doesn't seem used very often). Or heck, even simply adding more AI scripts to Entropy II. A couple of the scripts are difficult to tell apart until later in the game because the first 15 minutes are fairly similar.

So, yes, I encourage people to explore this idea in future scripts. Variety is exponential in nature. The more you have, the more combinations are possible, and the more variables there are. Which means more fun. I'm quite aware that building some kind of super-reactive god-like script isn't feasible, as the sheer amount of code required would be a nightmarish mess. That and with the AI's macro ability it'd be like playing against someone using a maphack since it'd always be one step ahead of your strategy. What fun is that?

Also, you talk about it being exploitable. So what? So what if a snickering Terran player builds a Starport behind his Supply Depot barricade and never so much as builds a single Wraith? There's no reason the AI couldn't pull out a 50% chance decision to make build adjustments to try to keep focused on producing units that are better suited for all-purpose combat. At least it'll be keeping things interesting. Doesn't even have to occur immediately. Maybe it can wait awhile before making the transition. Maybe it can at least check to see if the Terran player actually BUILDS any of the Terran air units and didn't just make the Starport to get a Science Facility. Be creative. I'm just giving examples and trying to contribute to brainstorming, instead of going around pissing in people's cornflakes.

Yes yes, we all know no non-cheating AI is never going to be an ultimate opponent for any pro Starcraft player, but unless I'm dazed and confused the whole purpose of making these scripts was fun. To provide entertainment and variety. A mix of AIs that go with standard build orders together with others that adjust slightly based on one or two major changes in your own activity would easily make some "big games" very, very fun for average and Veteran players alike. There's still a couple people around here writing scripts, and probably a few in the audience who are thinking about it, and it's worth making the suggestion to them that hey, there's already a good variety of standard scripts available to everyone here, why not experiment a little and get creative? There are other possibilities that haven't seen their full potential yet, even only through slight deviations.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Fri Dec 26, 2008 11:31 pm

You see, everything I said is completely relevant because if you were an AI scripter you'd know exactly what I'm talking about and unfortunately since you are not my comparisons seem a bit irrelevant to you. So, I'll put it in very simple terms.

SC's AI is retardedly broken. Hardcoded issues make it a challenge to get working at all. You're proposing loading scripts with a massive number of checks at nearly every point in time. Ashara's script is the most multi-thread heavy script ever made and he can attest to how much of a pain it was to get working in the first place. Multithreads, especially these checks, are slow and unreliable, can make the AI soft or hardlock, and are generally best avoided. As Baja always says, "Keep it simple, stupid!" which applies very literally to your concept.

I have dabbled in reactivity in the past and I'll give you a crash course on how this stuff works.

SC's AI script follows a single thread linearly. You can run multithreads but they tend to slow down the AI as a whole. Ashara's multithreads are very simple and tend to fire very quickly. To have the AI wait and react to do this or that, chances are you will run a looping multithread trying to find specific buildings (you can't check for units (Actually you might be able to iirc but that might cause issues in 3+ player games)). These slow down the AI, and if you want your script to react to every possible build order at the most opportune of times, you'll have to assume your enemy is doing a certain timing and trigger them at specific periods. As experimentation has proven, the whole "player_owns" check is extremely slow to react even if you tell it to recheck every 30 ticks, sometimes taking minutes to actually do what you want it to do. The enemy_owns command is no different. Thus not only is it eating up precious threads for your AI, it's also not going to be very timely in actually reacting to anything, probably not fast enough to make a difference against an amatuer player. The exception to this would probably be early-game where not much is going on.

many of them never attempt more than a single major strategy.


Just getting them to do that single major strategy is enough work, believe me. It can take months, if not years, to perfect a single activity and even then it's subject to being destabilized by map layouts and random hardcoded elements we have no control over.

Here is the OP's concept for the AI he wanted.

My concept is an extremely reactive AI. It should be any AI that actually looks at what the opponent is doing and reacts accordingly.


By his words he wants an AI that reacts to virtually anything. As the OP title says, an extremely reactive AI. I'm saying that while you can probably hackjob together something that is at least pseudo-reactive, it will be slow, and maybe even impossible to get performing correctly at all. By all means, if you want to try to write it, go ahead, but I doubt you'll find many people here willing to attempt this beyond what they have done already.

I've done a lot of experimentation and gotten pretty creative. I turned Ashara's mean protoss into the most vicious carrier and scout rushing scripts you'll ever see, randomly alternating between their strategies and my traditional carrier rushing script. I've also tried making scripts based on reactivity and they just didn't perform well at all. If an AI script doesn't perform well, it's not very fun; I've had enough playtests with members of the SA community to learn that the hard way when my AI was too slow or didn't work at all. So I built AI that worked and did unique things and randomized their strategies to the best I could while keeping them functional on every map possible and taking advantage of free money to make up for their innumerable shortcomings.

AI's that have been built in Entropy are built the way they are for good reasons. Reactive AI is not an original, new, astounding idea. Everyone who's ever wrote an AI has considered it. Some have done it (Dawn of Skirmish for DoW which I was a part of), Supreme Commander, ect. But in games like this, you don't usually see major reactive AI for the simple fact they don't perform well at all, if ever, because of the limitations of the engine. I discourage attempting it but I am not going to scream at you if you because you try it. By all means. I have resources for AI scripting available including my bible and I could give you a primer in the form of a video tutorial on AI editing if you want to try it.

I don't mean to seem irate or anything but it's not a new idea and it rarely works. If you want to try it go ahead but many have and not gotten anywhere.
User avatar
Xerxes
Posts: 43
Joined: Wed Dec 24, 2008 9:38 am

Postby Xerxes » Sat Dec 27, 2008 1:26 am

[quote name='IskatuMesk' post='5574' date='Dec 26 2008, 03:31 PM']You see, everything I said is completely relevant because if you were an AI scripter you'd know exactly what I'm talking about and unfortunately since you are not my comparisons seem a bit irrelevant to you. So, I'll put it in very simple terms.[/quote]
What you're saying is irrelevant because you're operating on the assumption I'm proposing "loading scripts with a massive number of checks at nearly every point and time", which logically implies I have no understanding of the limitations you have to work with to accomplish this. But I think I've made it pretty clear that's not what I'm proposing at all. You're holding an entirely different discussion about what is or isn't possible or feasible because you've "judged" me from - what, three posts at that point? - as someone who's clueless. I'm talking about a realistic application of the topic. Ashara's v1.2 AI has tried this turned out some interesting results. Why should others be discouraged from giving it a try if they want?

These scripts already have attack loops at some point. A single check at the end of a loop after an attack could be launched where it decides if it repeats this particular loop, or if that the strategy may not be effective any more and it should change to plan B. That's hardly absurd, and again, only for something simple like changing, say, a mid- or late-game army that only has land-based attacks to something a little more well-rounded if the enemy might be utilizing air tech. I've played Starcraft with plenty of casual players who'd get a hoot out of AIs they might not be able to beat simply by building a fleet of capital ships.


[quote name='IskatuMesk' post='5574' date='Dec 26 2008, 03:31 PM']Just getting them to do that single major strategy is enough work, believe me. It can take months, if not years, to perfect a single activity and even then it's subject to being destabilized by map layouts and random hardcoded elements we have no control over.[/quote]
Why does it have to be perfect? Only a fraction of your audience can even play anything remotely resembling a "perfect" game. Maybe it can take over a year to really get insane AI scripts shining, but with non-cheating AIs we're talking about average AI opponents that make an attack loop with 3 different units. Unless you don't have at least an hour to devote to it on a daily basis I don't see that taking more than a couple weeks to make a decent product. Two months at most if you're very picky.


[quote name='IskatuMesk' post='5574' date='Dec 26 2008, 03:31 PM']Here is the OP's concept for the AI he wanted.

My concept is an extremely reactive AI. It should be any AI that actually looks at what the opponent is doing and reacts accordingly.
[/quote]
That doesn't necessarily mean he wanted to approach it with the "check every possible build order every 2 seconds" method. You're assuming. What he wanted to do could have been as simple as my suggestion about about adding a check to the end of an attack loop. If you read his posts you can see that he had read around the forum and was aware of some of the limitations involved. Does this sound "extreme"?
[quote name='billking']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.[/quote]


Now, I really do appreciate the effort you put into explaining this, but you could have saved yourself the trouble if you'd of put a little more faith in other people's intelligence. Or at least asked them to clarify if you weren't sure before pouncing into the thread with a sledgehammer.

One last thing. Some of the AI's in Entropy II are not "built the way they are for good reasons"; some are unfinished or still WIPs. A simple block to change the final attack loop is one potential option someone could explore if they wanted to improve one of these unfinished scripts, be they the creator or not.
IskatuMesk
Posts: 329
Joined: Wed May 16, 2007 5:57 pm

Postby IskatuMesk » Sat Dec 27, 2008 1:53 am

Well the OP should have clearified, but again, he's probably not very knowledgeable in what he's asking for and doesn't understand the limits, so I provided the answer most suitable to his request. He hasn't clearified yet, so I presume he's not even checking these forums anymore.

The AI generally doesn't like switching up its units, that's what I'm trying to say. No AI will ever be perfect but getting them to operate correctly at all is very hard.

If you are really determined to try making the AI a bit more dynamic, maybe you should PM the authors and ask permission to modify their AI's a bit? I don't know. I don't mod anymore so I'm afraid I'm just being bitter, now. It's not so easy as just writing some lines and saying, "Well, the AI's gonna work this way, now!"

All I have to work on your guys' posts is assumptions. I have dealt with a lot of people who want to learn modding but don't know where to start, ect. and worked them from the basics to becoming quite proficient. It's hard to work with people who aren't very sure what they're wanting to do but expect a lot out of the game without being familiar with its limits. I'm trying to clearify these limits for you. Out of three posts from someone who hasn't modded before, I can't just say, well you have to watch out for multithreads colliding and overlapping waits in addition to the player_owns delay because you might start asking "wtf r u talking about lololol?"

If all you want to do is make an AI like those Entropy with reactive elements, there's nothing wrong with that. But most of the AI's to my knowledge in Entropy are pretty old and as you said not being worked on anymore. If you want an AI like this I think you're on your own.

Return to “StarCraft Modding”

Who is online

Users browsing this forum: No registered users and 1 guest