Unit AI - Role Awareness

Discussion in 'Planetary Annihilation General Discussion' started by erastos, September 7, 2012.

  1. erastos

    erastos Member

    Messages:
    207
    Likes Received:
    0
    A perennial irritation in TA/supcom style games is the way unarmed support units tend to go hump the leg of the nearest hostile unit when engaged in combat. I was thinking about how to address this, but as a rule I like to address specific problems with general systems. So, there are broad classes which define how much you normally want a unit to charge into the teeth of the enemy. In most games you have something like:

    • Suicide (crawling bombs)
    • Assault (heavy armour/short range)
    • Combat (medium range/armour)
    • Skirmish (long range/light armour)
    • Support (radar/repair/stealth/shield)
    • Artillery (extreme range/no armour)

    If each unit understood what class it was in, and had some awareness of relevant other units orders, you could add some intelligence to the move/attack-move and guard orders.

    Guard an engineer with combat units then tell it to build a bunch of mexes. Rather than the combat units trailing along behind as the engineer gets out of their guard range, the combat units lead the way, exploring the potentially dangerous area before the engineer and engaging hostiles.

    Order a mixed group of assault, skirmish, and artillery to attack-move and the assault charge in, with the skirmish providing covering fire and the artillery holding back to provide long range bombardment.

    Do the same thing with a group of skirmish and mobile stealth gens, the skirmish would go first while the stealth gens follow just close enough to keep them concealed.

    Of course the exact number and definition of the classes depends on the particular mix of units, but I think something like this could eliminate some of the mandatory-to-use micro (mobile shield and stealth gens in supcom are almost useless unless heavily microed, when they become extremely strong) and generally make units less stupid without infringing on legitimate 'oh god I must squeeze the absolute last bit of efficiency out of these units' type micro (whether you're in favour of that class of micro is a separate question entirely, but either way this particular feature remains useful).
  2. zordon

    zordon Member

    Messages:
    707
    Likes Received:
    2
    This is a good idea.
  3. ooshr32

    ooshr32 Active Member

    Messages:
    749
    Likes Received:
    141
    A smarter guarding mechanic would be most welcome!
  4. giantsnark

    giantsnark Member

    Messages:
    77
    Likes Received:
    0
    This would be much appreciated. Currently in SupCom you need to micro that yourself, such as by sending the combat units ahead and then sending the engineer, or use a formation that's clunky and slow. Escorts trailing behind their unarmed and weakly armored target was always really dumb.

    That said, there is a facet of "role awareness" that depends on the situation, not just the unit type, and I don't think that can be automated. For instance, whether or not you want units to go within range of an enemy fixed defense, or hover just outside it. An artillery unit that outranges the fixed defense has a no-brainer default behavior, but what about a combat unit with a range equal to or shorter than the fixed defense? The unit can't read your mind about whether it's supposed to avoid the turret's range or trade blows with it, so you need to give explicit instruction.
  5. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Just give us a platoon based AI. Let the player form a platoon of a set of unit and those units start to behave as a single unit towards the player. The AI takes care of formation, attack distance and retreat behavior (including kiting against AoE!) of the whole platoon for you. You define way-points, primary targets and general behavior of the platoon (hold ground vs chasing vs scouting).

    With modern AI technology, this is an easy task which produces a behavior which is on par with highly skilled micro management while being easy to develop (neural networks) and using even more complex behaviors (like "deploy to fire" or "limited fuel") in a seemingly intelligent way.

    Basically that kind of AI has tried out any possible action with any possible unit in any possible situation and has stored the results in an huge database. So when given basic information about the situation, it will just look up the most appropriate action for the current situation which is very likely to be the perfect tactical choice.

    This is completely different from just having a number of basic "AIs" which do nothing but performing a movement and attack pattern they have been assigned, disregarding synergy effects with nearby units or subtle differences between units based on slightly different DPS, HP or speed of other units using the same AI. Not to mention that such static AIs lack the ability to react to situations like artillery bombardment and alike.
  6. linecircle

    linecircle Member

    Messages:
    83
    Likes Received:
    0
    I completely agree that units need to behave a bit more intelligently. Having that intelligence come from algorithms, particularly in the 'all-out' case as described by exterminans, would take some strategy elements out of the players' hands. If the developers had time to make such intelligent AI for humans to play against, that would be great. There are going to be many unit formation combinations and multiply that by all the different enemy formations you might encounter; I don't know much about modern AI but it would seem like a hard hard problem requiring lots of development resources to make an AI that behaves well in all situations.

    My suggestion for human players: an inbetween solution. For example:
    Units have a default behavior according to their role that doesn't try anything too strategic or intelligent. But you can put them into formations, and the various parts of the formation can be configured from a set of behaviors. The 'suicide, assault, skirmish, support, etc..' list is a good start. The compromise is that the default set of behaviors is probably not able to cover every possible strategy that a full AI with modern tech can do -- this is somewhat remedied through allowing modders to write their own advanced behaviors. The upside is that all strategy remains with the player, and the user interface is reasonably simple.

    What strategy elements are there in unit behaviors?
    Adapting your battle strategies to the task/opponent at hand. If you know a certain base is heavily defended or not, you can set your army to 'shell from long range' versus 'charge!!', respectively.
  7. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    The development of such an AI is actually EASIER then creating a classic one. You set up the system and than you just let the system LEARN. Thats an ongoing task and whenever the AI gets confronted with a situation it doesn't know yet, it will just learn to deal with that situation too. Not at first attempt, but over time it will find the perfect solution.

    I also don't see how this takes any STRATEGICAL decisions out of the users hand? Thats tactics and micromanagment, that has nothing to do with strategy at all. It just ensures, that the game makes the best use of your units even if you don't look. And unless you are playing with multiple users, you won't be able to manage all fronts at the same time, with battles spanning across multiple planets.
  8. linecircle

    linecircle Member

    Messages:
    83
    Likes Received:
    0
    Training an AI poses its own issues, namely creating a training set, which is where I raised the concerns about difficulty (sorry I should have been more specific before). That is, how or who will find all the "situation it doesn't know yet" for the AI to learn from. You can throw all permutations of unit vs unit combat at it but that will not capture higher-level information; start taking in more context and the possibilities explode. Prerelease testing will give it lots of data, but if PA comes out of the box with a less than perfectly-trained AI, people will eventually exploit it, and uber will release a patch, and people will find new exploits, etc...

    Even an ideal superintelligent AI will only be able to perform what it was trained to do. There is no doubt that units with such AI will be loads better than anything we have seen, but it won't address the fundamental problem of being unable to tell it what you want: when your units encounter a situation, 'overall best according to an AI' is not always in line with the player's overall strategy. You can call it tactics if you'd like, but someone or something has to decide which of several tactics to use, and the choice doesn't always boil down to 'best'. A player's bigger strategy could be, eg. "wipe them all out", "hit and run, don't engage", or "minimize casualties", and without a way to tell your units that, how will they know which tactic is appropriate?

    A best of both worlds would involve an AI that knows every tactic and is able to understand the human's strategy. The non-AI alternative would be to provide a UI to the player, designed to accomodate commanding large forces, so that they can manage large battles going on in many places. Forces can be managed in many places without having to micro a lot: you simply have to work out your strategies/plans in advance and tell it to the game, which then handles the micromanagement of execution.

    Neither solution is perfect. They have their specific advantages and disadvantages, so understand that I'd like both to be examined, to eventually see which one will work better in the final product.
  9. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Micromanagement in advance is still micromanagement and that is impossible in a game of this size. You can define some target and waypoints (which enables hit an run), but it is impossible for you to select a decent target for each unit in play or to move every single unit to the right spot within the formation, depending on how much HP the unit has left.

    Those all are decisions only an AI can take. And since one of the declared goals was to eliminate the tactical benefits from micromanagement (it's an RTS, not a real time tactic combat simulator like Starcraft or alike!), it is clear that we need such an AI.

    If you give a unit or a platoon a command, that command will overwrite the decisions the units AI would have made, so you won't loose control of the units. But there are far more details then just "moving from waypoint A to B", like which unit to place in front when engaging enemies on the way, which is the optimal distance, whether to break a mixed formation for maximum efficiency or to stay close to make use of synergistic effects.

    You also want your units to act intelligent even when not looking, for example when setting up a fully automated production line which sends your units straight to the battle field via multiple transports without the need to change your selection every time new units arrive.

    And as for the number of possible situations, it's not that high. While not every precise situation can be tested, there is only a limited number of general orientations which are relevant in normal battle. The trick is, to provide the AI with an USEFUL analysis, not the raw informations. Like "how many seconds can my platoon withstand the enemy DPS". If such an information tells the AI, that it would be unable to destroy even a single target before being destroyed itself, then an attack would be futile, always. Not when artillery is about to take out parts of the defense, but that would change the parameters, making a different behavior rational. Only sometimes the enemy proposes an high value target which makes losses acceptable, but how could a simple AI know about that? To many informations and to many actions to handle them by hand or by static rules.

    You just don't want to feed your enemy the metal, if your units could just LEARN to stay out of weapon range if they wouldn't be able to do any significant damage at their current combined strength. Even for a suicide bombs, it's pointless if it would try to crawl straight towards point defenses if they just blew it up before dealing any damage. And thats what would happen, if we tried to equip units with a very basic, classic AI as such AIs are even more stupid. While they won't accidentally miss-learn wrong tactics, they are also unable to deal with anything except a very limited amount of situations. A unit with a classic AI left unattended is vulnerable like a sitting duck as it will fail to keep up with any type of tactical maneuver.
  10. linecircle

    linecircle Member

    Messages:
    83
    Likes Received:
    0
    Could you show me where the goal of eliminating the tactical benefits from micromanagement was discussed? I was not aware of this so I may have been insufficiently informed this entire time.
  11. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    I think that was within one of the first hundred threads in this forum, but i also lost track of it. We also had the AI discussion earlier with the same result, focus on platoons and making the micro management automated for real players too, with the option, but not default, to override their behavior with your own commands.
  12. linecircle

    linecircle Member

    Messages:
    83
    Likes Received:
    0
    Would I be correct to summarize your opinion as wanting smarter default unit behavior such that players who do not want to adjust unit behavior wouldn't be throwing free metal to the enemy as often?
  13. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Shortened of the technical details: Yes. Also units making use of synergistic effects by default without the need to babysit them all the time.
  14. linecircle

    linecircle Member

    Messages:
    83
    Likes Received:
    0
    Ah, alright, that is something I want also. It wasn't clear to me from your initial posts. It had sounded like you wanted to replace player agency with a "full auto" AI which, while it does remove micromanagement and allow larger scale battles, felt undesirable due to the loss of strategic possibilities, assuming player agency wasn't added back in elsewhere such as through optional overriding and customizing of behavior.
  15. coldboot

    coldboot Active Member

    Messages:
    447
    Likes Received:
    112
    I don't think you understand how difficult it is to create an AI that can learn that is also general purpose. Machine learning is the field you're talking about, and it's usually used in very specific applications with a narrow goal.

    In the context of many different types of units moving together through varying terrain with wreckage while encountering groups of varied enemy units, it would be very difficult to create a learning AI that could figure out the optimal set of decisions to make during combat.

    It's much simpler to go for erastos' original idea from the first post of this thread which is to create simple heuristics for unit roles. In this way you can break down the problem of "what should units do in general", to a question of what specific units should do in general based on their strengths and weaknesses.
  16. paulzeke

    paulzeke Member

    Messages:
    197
    Likes Received:
    21
    I like the idea of having units be aware enough of their roll to function properly when ordered in mass. It would be really convenient to have basic formation intelligence so that when I assign a squad, they form up and become a single clickable unit. Meaning, click on one squad member, it auto-grabs them all. This would make it far easier once you have massive hoards of troops. You could have a few specialized squads and suddenly the battle is simplified to only a handful of huge semi-autonomous squads instead of thousands of individual units stepping on each others toes
  17. zordon

    zordon Member

    Messages:
    707
    Likes Received:
    2
    Why make something complicated when you can just drag select the units you're interested in at the time and have them act as an impromptu squad. It's often quicker to drag select an area than it is to click on an individual, moving, unit.
  18. coldboot

    coldboot Active Member

    Messages:
    447
    Likes Received:
    112
    Or just use CTRL+(Number) groups for this purpose.
  19. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    It's really not that bad. It works just fine for complex scenarios as long as you have a clear defined fitness function and a well filtered input. There has a lot of research been performed on neural networks within the last 10 years and they can be considered suited for practical use for about 3 years now.

    This also wouldn't be the first game which used neural networks for tactical decisions, several FPS did before (not in release version, but for creating the AIs in first place). Given a large number of factors and possible actions, the number of combinations which the AI can deal with is limited by manpower. The development of a neural network and automated training have shown to be more time efficient than to write an AI based on a hand written rule set. It has been mathematically proven, that it is almost impossible for humans to write a proper rule set when there are more then 4-5 independent environment variables present. A neural network will still require a lot of training, but it isn't condemned to fail in first place.

    A typical RTS game (as well as modern FPS) exceeds this number by far (10-15 variables after filtering), which leads to the typical problem, that even an average player can outsmart almost any AI with proper micro management. There is only a very limited number of RTS games which managed to solve this problem by reducing the complexity of the environment, but thats not an option for PA! We also require a strong tactical AI since micro management is impracticable given the scale of the game and the resulting number of simultaneous front lines.
  20. ledarsi

    ledarsi Post Master General

    Messages:
    1,381
    Likes Received:
    935
    I don't like the idea of having a designer-created AI govern unit behavior. It is extremely difficult to implement well, and even if it were implemented properly it would essentially result in the armies going through the same programmed behavior over and over again.

    It would be much better if the player had the UI tools to be able to control the behavior of their units en masse, with relatively few commands. This might involve setting up an organized hierarchical army organization and giving specific and general orders to those groups. There are a lot of ways it might be done.

    It is a bad thing if something bad happens and the player can, quite reasonably, say "the AI caused that." That is not fun. However, if the player's units do something really dumb, and the player goes down into that lower level of detail and sees "Oh. Whoops. I did order that" then it is their fault, and they should know it. Everything that happens with the player's units should be caused by the player.

    Players just need more power to give orders that will be copied automatically a large number of times. And allow players to give more complex orders that tell units what to do without needing to assign every single individual unit every single coordinate to move or attack. Or automate repetitive actions like reinforcing from a factory, or loading and unloading from transports.

    The player should make any and all high-level decisions they want, and should be able to rely on scripted actions that they designed to implement their high-level orders without needing to do it manually every time.

Share This Page