Sign in to follow this  
japro

RTS unit AI. Intelligence or Simplicity?

Recommended Posts

How intelligent should the AI of units in an RTS be? On the one hand, it's frustrating if units are incredibly "dumb". Like the infantry in some C&C games that would heroically their position until they got run over by a tank. Also with the whole "more realism" thing that seems so important for games people want to give more abstract orders ("Attack that position and flank it") instead of "microing" every single unit, since that obviously isn't what a real general does (telling every infantryman personally what to do...). On the other hand, units that are trying to be intelligent can also be extremly annoying. Either because they are not doing what you expected them to do, or because they insist on doing something "wrong" and you have to contantly give them explicit orders. When I set out on my current project I started with the idea of having a very high level command system where you would assign units to some sort of "strike groups" and then only give abstract orders like "take that position", "destroy that enemy group" etc. and wanted them even to request permission to retreat or artillery assistance... Since I am only a one guy team programming for fun I almost immediatly realised that I'd never get there since even moving around a single unit intelligently proved to be quite a challenge. I also switched the whole game to a space setting since that allows me to disregard most of the expected vehicle physics, wayfinding etc. Also, after having replayed some of my old RTS Games, I realised that I prefer having units that are predictable in their "stupidity" (meaning, they do exactly what you tell them to in a straightforward way) than ones that are unpredictable because of their AI. This can be something as simple as wayfinding. In starcraft when the way for a unit is blocked by another unit at a choke or similar they start to recalculate their path which generally makes them wander around aimlessly further screwing up the wayfinding of other units they cross (ever tried to defend a base against carriers with a lot of goliaths?...). I'd rather have them to just stop when their path is blocked and issue a "can't go there" message and move on as soon as the path is cleared again. So what are your thoughts? Do you want intelligent behavior and a highlevel command system or just dumb tell-me-exactly-what-to-do-units?

Share this post


Link to post
Share on other sites
You are confusing the issues. Starcraft units are not intelligent. They just have bad pathfinding (fixed in Starcraft 2).

It depends totally on the design whether simple or complex commands fit better. Half or more of Starcraft is action and multitasking. It's also a spectator sport. Within those parameters dumb but snappy units are best. For a simulation feel, OTOH, the units must not be in your direct control.

I dig Starcraft, even though I'll never have mechanics good enough to play a serious match. But I would also like a hardcore infantry/armor/artillery RTS with semi-realistic command system where you have no hands-on control of anything. Possibly even so that you don't see any of the battlefield except your own LOS, but you get radio reports from your troops when they spot something.

Share this post


Link to post
Share on other sites
"a hardcore infantry/armor/artillery RTS with semi-realistic command system"

Now, that's one of the things on my list; I wrote one many years ago, which you can't play because it's used for military training. So in the back of my mind has been a redevelopment for modern systems... I'm just umming and ahing about whether anyone would actually play a game where one of your jobs is to work out the prioritisation scheme for having the artillery tasker allocate resources to fire requests..

Share this post


Link to post
Share on other sites
The problem is that you assert the question from the wrong perspective.

From a gameplay perspective, micro-management increases the user engagement (he actuall has stuff to do if he wants to win) but you have to make sure that these clicks are "fun" to do and "rewarding". You obviously don't want a game about boring clicks for little advantage. The reason they removed most of the workers micro-management from SC2 is because they felt it was more FUN to micro-manage military units on the offense than to assign probes to patches of mineral.

Now, a realistic system may play out well, but how engaged will be the user? Once he clicks on that area, what can he do to affect the outcome aside from looking at how well the AI is made? This system feels like the player would spectate the events rather than influencing them. Unless you have something to burden the player with, that is fun to do, and rewarding meanwhile, this mechanic sadly fails. I'm not saying it wouldn't work great, but alone? It wouldn't work. Maybe if your game is about a lot of base buiding, or massive amounts of units, then maybe the player will be burdened, but how will it be trully rewarding. In other words, what incentive to you give the player to be extremely active in-game to try and affect the outcome of the battle.

You obviously want to avoid Macro-control // landslide attack. It is a boring victory when you outnumber the opponent 100:1. Strategy implies you win through strategical choices. This is far more exciting than the short wow-factor of outnumbering the enemy.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stroppy Katamari
You are confusing the issues. Starcraft units are not intelligent. They just have bad pathfinding (fixed in Starcraft 2).


I'm aware of that, I was just using that as an example how units following a "nontrivial" pattern can annoy the player. After all Pathfinding is part of the units AI...
Also obviously, if there was a way to have "perfect" AI for a unit, it wouldn't be a problem. But since the AI will always have some flaws, the unit will at some point exhibit unwanted behavior (which can be as simple as your dragoons blindly walking into a siege tank line because they autoattack/follow some worker that walked by them).

Share this post


Link to post
Share on other sites
I have considered ways to remove the micro-management from an RTS as well by trying to make units think for themselves a little better. Here are a few ideas that I've had:

Give the player the ability to assign units (or groups of units) certain types of behavior. For example, do you want your infantry to attack the strongest or weakest unit, or the unit with the least amount of health or most? One thing that drives me nuts on some AI's is that an enemy unit may be at <5% health, but no one kills it (automatically).
This could be simple:
AttackMode = WEAKEST_FIRST, STRONGEST_FIRST, MOST_HEALTH_FIRST, LEAST_HEALTH_FIRST, or NONE.

Same idea for their own health. You could tell your units how to act when near death:
NearDeathAction = RUN, FIGHT, SEEK_MEDICAL, or NONE. If its RUN or SEEK_MEDICAL, you would give them a threshold at which to do that. This would reduce some of the micro management in battles, where you have to keep telling your near death units to run away or go out of range. Doing this would need a decent pathfinding algo for all your units as well, so that units will move out of the way so a RUNing unit can get through.

These ideas look good on paper, but implementing them would be tough I think. To get a good system you would have to break the above modes apart even more (what if you want infantry to attack the strongest unit AND the one with the least amount of health?). Perhaps some games already do this behind the scenes?

Share this post


Link to post
Share on other sites
Quote:
Original post by geo2004
Give the player the ability to assign units (or groups of units) certain types of behavior. For example, do you want your infantry to attack the strongest or weakest unit, or the unit with the least amount of health or most? One thing that drives me nuts on some AI's is that an enemy unit may be at <5% health, but no one kills it (automatically).
This could be simple:
AttackMode = WEAKEST_FIRST, STRONGEST_FIRST, MOST_HEALTH_FIRST, LEAST_HEALTH_FIRST, or NONE.

Dragon Age uses a system like this, where you can set the behavior patterns for your characters. I haven't really been able to do this successfully (red rings of death killed my 360), but it's something I'd like to see ported to RTS games. It would allow strategy to start prior to the actual game. And, as in Dragon Age, the number of commands that can be pre-programmed this way could become another unit attribute. During gameplay, the player could take manual control to override the programming, and could also issue general commands that would apply to his entire army (attack using pre-program mode 1, defend using pre-program mode 2, etc.). The pre-program blueprints would likely be shared among players, similar to the deck builds of Magic the Gathering.

Share this post


Link to post
Share on other sites
Quote:
Original post by hiigara
I think you will be alright with dumb Units. Most RTS Players like the Micromanagement.


That is like saying that you should be alright with large cars, because most people who drive 'like' large cars when there are very few options for small cars.

Personally I can't stand micromanagement. It isn't fun, it is annoying, and it too often turns into a click fest and who can remember what order to press hotkeys in.

Share this post


Link to post
Share on other sites
Quote:
Original post by Katie
"a hardcore infantry/armor/artillery RTS with semi-realistic command system"

Now, that's one of the things on my list; I wrote one many years ago, which you can't play because it's used for military training. So in the back of my mind has been a redevelopment for modern systems... I'm just umming and ahing about whether anyone would actually play a game where one of your jobs is to work out the prioritisation scheme for having the artillery tasker allocate resources to fire requests..

Whose role are you actually playing when doing that? A logistics officer at artillery battalion HQ? It doesn't sound terribly interesting even though I'm familiar with artillery.

The scope of what I'm thinking is a front-line company or battalion where you play the commander.

Share this post


Link to post
Share on other sites
Quote:
Original post by hiigara
I think you will be alright with dumb Units. Most RTS Players like the Micromanagement.


Most RTSs have nothing to offer besides multitasking and micromanagement, so of course the people who stick with them like micromanagement. At the same time the rest are being ignored. Besides, the action-y RTS market is so hotly contested, how are you going to make one that is worth playing when you could be playing Starcraft 2 or Supreme Commander?

Share this post


Link to post
Share on other sites
Quote:
At the same time the rest are being ignored


I'd say there are plenty of RTS games that cater to people who don't like intense micromanagement nowadays. Though I agree with the assessment that you shouldn't generalize RTS players as micro lovers. Essentially, not RTS gamers are Starcraft players, whatever some would like to have you believe. Some prefer a more chess-like approach despite the continuous time. I like both kinds of games actually (and the range in between).

More on topic:
I don't think it's necessarily a case of dumb vs. smart, rather it's a case of waits for orders vs. takes initiative. The more initiative AI units take, the less there is for the player to do. Once you order a group of units to go somewhere they should always do so as smart as possible (avoiding traffic jams), I think that is indisputable. The question is rather whether they should act on their own, for instance to attempt to move to cover. Any kind of initiative like that risks to wreck havoc to the player's own planning.

Either one can be a good thing depending on what command level the game tries to simulate and what else there is for the player to do.

So to summarize: Always make the unit level AI response to player orders as intelligent as possible, but don't necessarily make unit level AI take own initiatives.

Share this post


Link to post
Share on other sites
Quote:
Original post by Beyond_Repair
Quote:
At the same time the rest are being ignored


I'd say there are plenty of RTS games that cater to people who don't like intense micromanagement nowadays. Though I agree with the assessment that you shouldn't generalize RTS players as micro lovers. Essentially, not RTS gamers are Starcraft players, whatever some would like to have you believe. Some prefer a more chess-like approach despite the continuous time. I like both kinds of games actually (and the range in between).
Can you name some excellent non-micro RTS games? Any tactical level games, not grand strategy like Paradox titles?

(I'm not asserting they don't exist, I just don't know any.)
Quote:
So to summarize: Always make the unit level AI response to player orders as intelligent as possible, but don't necessarily make unit level AI take own initiatives.
Not intelligent, but reliable. For example when you attack-move in Starcraft, units will generally shoot at the enemy closest to themselves. This is reliable but not intelligent. Intelligent troops would automatically shoot the most vulnerable or dangerous target in their range, which is not desirable for all games. Note that this is not an instance of the troops taking initiative since the player never specified a target in the first place.

Share this post


Link to post
Share on other sites
"Whose role are you actually playing when doing that? A logistics officer at artillery battalion HQ?"

Actually it's more something that a commander will decide at various points in a mission -- which subunits get priority over fire requests and the like.

Until recently, I would have said that actually classifying EACH individual request would make a stormingly dull game, but the slew of tower defence games kind of indicates that it might not...

Share this post


Link to post
Share on other sites
"Intelligent troops would automatically shoot the most vulnerable or dangerous target in their range"

You might be amazed how that isn't the case in the real world..

One of the original ideas for tanks was that they would trundle slowly along with infantry sheltering safely behind them[1]. Problem is that in real combat, tanks are *bullet magnets*. Everyone and their dog wants a pop at them, whether they've got decent weaponry or not. Infantry, rather sensibly, don't want to hang around a metal box which has bullets pinging off it, even if they're ineffectively pinging off it. One of the effects of this is that historically it's extremely easy to attack an infantry unit by sending a tank one way and some infantry the other. And generally they'll blaze away at the tank while being outflanked.

History is replete with examples of units which ignored actual targets to keep pursuing already routed enemies. ACW cavalry and ECW Royalists were both renowned for this sort of behaviour.

Modern table wargames include all sorts of modelling for whether units will uncontrollably chase defeated units regardless of whether it puts them into danger.


Much of modern warfare actually boils down to exploiting exactly the sort of errors that omniscient computer controlled troops don't make...

{We had to actually make units forgetful... too much stuff going on and they'd do things like lose count of how many targets they'd hit from an opposing unit and so not finish it off properly and so on.}



[1] This dominated various countries thinking (including Britain's) well through the 30s and even into the start of WW2 -- to the extent that they continued split tanks into two classes of "infantry support" (that don't need to move faster than 4mph) and "cruiser" even after having seen blitzkrieg happening.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stroppy Katamari
Can you name some excellent non-micro RTS games? Any tactical level games, not grand strategy like Paradox titles?


Funny, I was thinking of Paradox games. :p

But a more tactical example would be the Close Combat series. There you spent very little time giving orders, and spent a lot more time thinking and waiting for the perfect moment to give each order. Each order usually had some time overhead (a squad took a while to organize) so you wanted to minimize the number of orders. Furthermore, there were other considerations; for example the exact moment of opening fire in an ambush could be critical depending on the weaponry of your own squad and the enemy squad, the availability of support teams, etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by Stroppy Katamari
Can you name some excellent non-micro RTS games? Any tactical level games, not grand strategy like Paradox titles?


Globulation 2 is kind of an example of this. You place buildings, say how many workers are needed but very little micro actually goes on. Instead of moving trops they decide what to do automatically. To choose a target to attack you place a 'flag' and some soldiers storm off to attack.

The ai is actually really dumb but the concept is what you meant. And hell, it's free :D

Share this post


Link to post
Share on other sites
I guess it depends on what kind of game you are making. The point of RTS games as currently designed is micro-management and resource-management. That's the "game" in the game. You might not like it, in which case design something else. But when you say "this is an RTS" that's what gamers expect.

At any rate, in any kind of "strategy" game there is a problem of interpreting the player's commands. The more initiative or intelligence you give units, the more interpretation you have to do and the more players expect you to get that interpretation correct. Of course the challenge is that the more interpretation you have to do, the more likely that you will get it completely wrong.

If you want smart units you probably need to fundamentally change the order system. A single click (attack or move) is typically not sufficient data from which to interpret intent.

In a group of mixed units of varying speed, when I select the whole group and issue an attack order did i mean all units move at the same speed or do i expect the faster units to get there first? If I select a single marine and tell him to attack that massive group of hydralisks am I intentionally suiciding him or do I expect him to find neary-by cover and be "smart" about how he attacks them or do I expect him to ask for confirmation because I probably just screwed up? If there is a ground hazard or area of effect weapon going off and I issue a move order through that area do I expect units to path around or barge on through?

The problem is that the more intelligence you give units, the more players expect them to make the "right" decision in situations like the above. And there's no way given the current RTS control scheme to know which they meant. Counter-intuitively, the dumber the units are, the less the above situations are a problem for the perception of AI intelligence.

So I guess that all I'm saying is that if you give units more volition you should probably also look into changing the paradigm for issuing orders so that you can ensure you have enough context to get the user's intent correct.

-me

Share this post


Link to post
Share on other sites
This is actually a good question. Ultimately you need to give the A.I. rules about strategies that are optimal, but you obviously don't want them to perform to quickly.

Here are some suggestions:

1) delay timers. (e.g. gatherer A is chopping wood, then waits 3 seconds, then walks over and delivers wood to HQ, then waits 3 seconds, and so on)

2) difficulty settings. This would simply require the implementation of inferior strategies that you have designed. (e.g. on a reduced difficulty A.I. is instructed to build in an inferior order and to gather far more than necessary resources in order to advance.

Ultimately, regardless of what you choose to implement, the game needs to be tested by a player of high skill who can properly gauge how the changes you've made affect the difficulty. It all comes down to testing.

Just my .02,
Jesse

Share this post


Link to post
Share on other sites
I would love to see a game with Smart AI, but it would take a lot of talent, time, skill and innovation.

I personally quite like it when you don't control a single unit, but a bunch of them - Infantry in WiC, Fighters in HomeWorld etc.

I think that smart AI would have to start there, and try to use that as a base for move advanced "group" based AI for more powerful units (e.g. Tanks and Frigates), and eventually up to using capital ships (or *big* tanks) as Ai Hubs - A Fleet with 3 Capital ships in communication would be significantly smarter than a fleet with a single one.

Every time you take the AI to a new level you have to build in more personality, a single squad of fighters will be pretty dumb and do exactly what you tell it, but a group of frigates might try to chase off invaders and a capital ship lead fleet might try to SAD a perimeter.

I could Imagine an attack with 3 Fleets in coordination, using flanking maneuvers etc.

Share this post


Link to post
Share on other sites
I just now started learning programming, but the concept I've been working on is actually built around the concept of having most of the tactical stuff be handled by the AI. I'm looking to use a model that's kindof a mix of the systems used in RPGs like Dragon Age and Final Fantasy XII, and the hierarchies in Romance of the Three Kingdoms. This frees up the player's attention to focus on logistics, grand strategy, and determining the structure of their military (raising new units and reorganizing old ones, changing the training and equipment of troops, and changing strategic and tactical doctrines). Units, companies, and armies would be put under the command of characters with unique traits that affect both the effectiveness of the troops under their command and the types of decisions they'd make.

Share this post


Link to post
Share on other sites
There's also the option to make units detect that they're being stupid and call for player attention. For example a unit that is pathfinding but isn't getting any closer can tell the player that it's lost. So instead of making smart units you make stupid units that freely admit that they are. The advantage is that it's probably easier for units to detect problems than to figure out intelligent solutions.

Share this post


Link to post
Share on other sites
Quote:
Original post by KekkoFor example a unit that is pathfinding but isn't getting any closer can tell the player that it's lost.


I think the key to truly smart AI is to design the game around that concept, AI should only face AI with the player being at a much higher strategic role. If you pit AI against a player it either becomes to easy or unbeatable.

In the same idea the maps should be made so it is *Impossible* for the AI to get lost or stuck.

Share this post


Link to post
Share on other sites
I should note that in a "realistic" military command game, the commander cannot see his units and can only hear them on the radio and give orders via the radio. Nowadays if the commander is really lucky he might have some camera uplinks to a few predators, however this is a _looong_ way from an overhead view where you can click to give orders.

Orders aren't given by one commander, either. Each squad or group has a tactical commander who coordinates the squad, and the squad hopefully has the capability to send/receive radio contact with the local tac commander, who reports to the local strategic commander, who reports to general command. This chain of command is limited by a number of factors including radio/sat uplink time, distance, jamming, people getting shot randomly, and much much more. It should also be noted that units will not obey orders when under fire, and issuing them orders when they are already taking fire will be counterproductive.

Share this post


Link to post
Share on other sites
Quote:
Original post by aersixb9
I should note that in a "realistic" military command game, the commander cannot see his units and can only hear them on the radio and give orders via the radio...


Hmm, yeah. That's something I haven't thought about actually. During my time in the swiss army our "pathing" and "command response" was also seriously flawed... ;).

"We got a firing order? NOW? All the artillery is unmanned inside a storage building..."
"Well, apparantly the order was issued three hours ago but got somehow stuck in the data communication thingy."
"Three hours?"
"Um, yeah, they just managed to reestablish the data communication that was down for the like last nine hours."

So a realistic strategy game would have lots of cool features like: random miscommunication of orders, units killing civilians half of the time instead of the enemy, units getting completly lost because some idiot was unable to read the map... ;)

Back to topic. I actually wasn't trying to eliminate micromanagement from an/my RTS by having more intelligent units. Removing micromanagement kind of takes the RT from RTS... It's just that there are different kinds of micromanagement. I have to assume, that most people think of Starcraft when they hear micro. Now, even if I like starcraft I have to admit, that it's full of very annoying microrequirements. A lot of the micro seems like the result of bugs in the game (vulture patrolmicro, mutalisk stacking...). And the worst thing is, that there are units that require you to have quite advanced microskills just to deal with them. For example lurkers... you have to micro against lurkers if you are terran or otherwise they are just going to destroy you. You can't outmacro a lurker rush strategy.

Generally I think it's okay if you get an advantage from micromanaging units. But there shouldn't be elements in the game that can only be dealt with by advanced micromanagement.

What I always liked in the homeworld games, was that you could get an advantage by micromanaging stuff but weren getting heavily punished if you didn't. You could just attackmove a fleet to some location and it wouldn't get instantly wiped out when it flew into an opponents fleet while you didn't watch it. If you did micromanage and multitask better than your opponent, you off course gained an advantage over time, but it wasn't just "micro or die"...
Homeworld achieved that through relatively slowpaced gameplay and possibly also because there wasn't that much terrain to abuse. Now I was thinking to also get a similar effect in a 2d RTS by having more intelligent units. When I think about starcraft for example i'd like to "soften" the microrequirements of marines vs lurkers by having the marines at least react in some way. Instead of just stubbornly walking through a lurker ambush and getting wiped out in seconds, they could retreat or try to find a path around the lurkers. But then I get those "too intelligent" problems that you can mess up the pathing of marines with a single lurker which will possibly annoy the player as well. You just replaced the problem of "marines getting randomly wiped out when not microed" by "marines getting their pathfinding screwed up when not microed"...

I guess ideally units would have reasonable behavior by themselves with room for optimization through micromanagement.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this