Skip to main content
GameDev.net gamedev.net
🔒 Locked

RTS unit AI. Intelligence or Simplicity?

Started by japro Mar 31, 2010 at 5:51 AM 26 replies 6.7k views
Original Post
japro
japro
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?
Stroppy Katamari
Stroppy Katamari
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.
Katie
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..

Orymus
Orymus
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.
The fact you were there before they invented the wheel doesn't make you any better than the wheel nor does it entitle you to claim property over the wheel. Being there at the right time just isn't enough, you need to take part into it.

I have a blog!
japro
japro
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).
geo2004
geo2004
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?
Silvermyst
Silvermyst
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.
You either believe that within your society more individuals are good than evil, and that by protecting the freedom of individuals within that society you will end up with a society that is as fair as possible, or you believe that within your society more individuals are evil than good, and that by limiting the freedom of individuals within that society you will end up with a society that is as fair as possible.
hiigara
hiigara
I think you will be alright with dumb Units. Most RTS Players like the Micromanagement.
Luckless
Luckless
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.
Old Username: Talroth
If your signature on a web forum takes up more space than your average post, then you are doing things wrong.
Stroppy Katamari
Stroppy Katamari
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.
Stroppy Katamari
Stroppy Katamari
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?
Beyond_Repair
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).

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.
Stroppy Katamari
Stroppy Katamari
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.
Katie
Katie
"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...

Katie
Katie
"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.
Beyond_Repair
Beyond_Repair
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.
JamesPenny
JamesPenny
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
Palidine
Palidine
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
PlaysOnDrugs
PlaysOnDrugs
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
NPSF3000
NPSF3000
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.