Better Commands; specific ideas

Discussion in 'Planetary Annihilation General Discussion' started by jseah, October 3, 2012.

  1. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    The war between the Core (pro-'AI') and the Arm (anti-AI) has started in this very forum. One of the threads mentioned that there has been precious little specifics on what sort of unit or group AI we Core people are looking for.
    Fair enough, guilty as charged.

    So, let's suggest a few. What sort of scripts, helper AIs, power UI, whatever you want to call it, do you want to see?
    Give it a representative name and describe what it does. Clearly! No handwaving, no vagueness. The description should be enough for a programmer to work out what information the script needs to access and what commands it needs to be able to give and what logic to implement.

    Here's a small list of my ideas:
    1. Auto-kite
    Modified Googlefrog version: Periodically move to the closest point which puts the nearest non-air enemy with weapons at this unit's max range
    A unit state toggles it. Direct move/attack command overrides. Attack-move command executes this if the state is ON.
    1b. Formation auto-kite
    Periodically move to the point backwards along the current command's trajectory displaced by formation position which puts the nearest non-air enemy with weapons at this unit's max range
    1c. Conservative auto-kite
    Periodically move to the closest point that is outside all non-air enemy weapons range
    A global command that makes all units under this control ignore a specific unit or unit type is required (don't want to kite Big Berthas)

    2. Target Prioritization & Group Targeting
    Units in a group will split their fire on enemies in range (with a maximum of say, 110% target hp in damage). Miss rates and ranges should be approximated and factored in.
    This is not a command. Since units attack and move independently, the individual turrets and weapons, just before firing, will reserve the predicted damage amount of enemy hp and prefer to shoot enemies with predicted damage > current hp. Shots in-flight are tracked and when they impact, their predicted damage is removed (it becomes real damage if the shot hits)
    This would appear as a toggle on the units. Firecontrol ON/OFF will make the unit's targeting appreciate its allies' targeting or ignore them.
    Direct attack command overrides. Priority Attack (see below) overrides.

    3. Advanced contextual commands
    Single target: as now, commands are issued against a point in space or a specific target unit

    Line: Mouse down and drag to draw a line (note that I mean any continuous length following the path of the mouse, not straight lines), mouse up to complete. Orders given to selected units are split across the line (minimize distance)
    - Commands that can only target enemy units are not valid for this

    Area Static: Mouse down, hotkey down, drag to define radius of a circle centered on mouse down point (different hotkey for rectangle). Orders given to selected units are issued against all valid targets in the area (attack queue for all enemies currently in the area).
    - Special case, move commands generate a grid of move orders inside the area spaced to have a number equal to the number of selected units and Split (see below) is executed on these; this makes the units space out to try and fill the area
    - Commands that can only target points on the ground are not valid for this

    Area Dynamic: Defined the same way as static (perhaps another modifier key?). Units executing this will insert the order in front of their queue on the nearest valid target. (area attack will generate an attack order on the nearest enemy unit, pushing itself back in the queue) When there are no valid targets, this order completes.
    - Commands that can only target points on the ground are not valid for this

    Polygonal areas: Modifier key down. First mouse down generates a point, dragging draws an edge along the mouse path. Mouse up generates another point. Mouse down again generates a straight line between the last point and where you mouse down, drag continues the edge... etc. Other mouse key undoes the last point. Releasing modifier key completes the polygon with a straight line between the first and last point.
    Defines an area enclosed by the edges. Applies area static or dynamic on that area.

    4. Command Queue management & meta-commands
    Commands that affect the command queue should be implemented.
    - Wait: Selected units will stop in place and not execute their order queue (as if idle); issuing wait on waiting units resumes execution
    Eg. An engineer assisting a factory is issued a wait command. It stops building (even though its assist command still exists). The engineer is asked to build an alternating series of powerplants and metalmakers. It does nothing. It is issued another wait command. Engineer moves away from factory and begins construction.

    - Coordinate: Selected units will estimate time to entering execution range of the first command in their queue even if the first command is not the same and will use wait with appropriate delays to make this time be the same for all selected units (with a 5% error say)
    Eg. Ten tanks on the front line and 2 freshly built one screen-length behind the front are issued wait. They are ordered to attack an enemy defense tower. 'Coordinate' is given. Wait is issued to resume their orders. The ten tanks on the front idle until the 2 tanks catch up to the front then all 12 proceed to attack at the same time.
    Specifics: Time to get to the spot for move, time to weapons range for attack if starting outside weapons range, time to reload for attack if inside weapons range (salvo shots basically), time to nano range for build

    - Split: Selected units, when they have the same order queue, can be given a split command and two commands in the queue are selected with the split tool. All commands between the first and last of the two selected (selection included) will be split among the selected units evenly.
    Eg. One hundred bombers are given an area attack order on all the 50 enemy tanks on the frontline. Split command is issued. 2 bombers are assigned to one tank each.

    5. New Commands
    Priority attack (also called Move-Independent Attack)
    This is a meta-command (see below) and accepts a target enemy unit. Units can only have one of them and it exists outside the order queue. This command will make the unit attack the selected target whenever the target is in range regardless of the order queue or fire state.
    This command is context sensitive in the same way that attack is. The Stop command clears this.

    Global Priority Attack
    A global meta-command that exists independently of units. You target an enemy unit with it and all your non-air units that can shoot that enemy target will gain Priority Attack against that target unless they already have one.

    Face
    This is a command that accepts a point on the ground. This command will make the unit try its best to turn so that its front faces towards the target point. This command will cause the unit to turn in place, units that cannot turn in place cannot execute this command. Time to completion for this command is the time it takes for the unit to turn that amount of degrees.

    Resource Reserve Levels
    ZK recently implemented this. You can click on your resource bar and that amount of resources will be reserved for high priority construction and basic running of units.

    Essentially, the reserve level is a crude way of saying "power that radar and shield before using it to build". If you don't have enough E, your radar and shield stays online, you just build slower (and start to pile up M)

    6. Command Templates
    Similar to build templates, command templates are a set of commands with a defined position relative to the unit group given the order and accepts a certain input (usually a point but can be line and so on)

    Command templates are basically widget-lite. No ifs or loops, no memory. They are essentially a preset script of commands that you can drop into a unit's order queue, with some ability to modify them. Obviously, they will only execute on the units you have selected and will be queueable just like any other command.
    They can be modified out of game, like how an advanced build template system might be modified out of game. There, you have access to some tools that would be too clunky to use in-game. Some examples of these tools would be: idle for X seconds, all units with X classification (category either set by mod or modifiable by player), some simple math (mean, Not, +-*/), etc.
    I am not too sure if allowing them to accept more than one command would be worthwhile. It would make them more useful and flexible, but also complicate making them.

    These would be accessible the same way as build templates, they are hidden behind a tab on the menu. Given that they will need some amount of clicking to use, they might only be used for orders that require some precise timing and for fancy formations.

    Simple example (probably not worth it to use): Post Battle clean up; accepts area
    All Constructor units as group: do reclaim in given area; queue repair in given area; queue move to "this unit" current position

    Timing example: A "Shield and Rapier"; accepts line
    All Assault units as group: do fight in given line
    All Non-Assault, Armed units as group: idle 3 seconds; queue fight in given line
    - Note that a very similar version of this for fighters to screen bombers can be made too
    Last edited: October 5, 2012
    TheLambaster and carlorizzante like this.
  2. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    You might note that my suggestion both encompass some basic automation as well as better tools for even lower level micromanagement.

    It cuts both ways. More powerful tools let us perform at our best regardless of the scale. The true dream RTS would have a scale independent UI, allowing us to issue orders from down to one tank (push button to fire cannon!) and all the way up to saying "all units on this planet, find a rocket and launch a full-scale invasion of this other planet!"
  3. BulletMagnet

    BulletMagnet Post Master General

    Messages:
    3,263
    Likes Received:
    591
    I'm against (1).

    I'll need to have a think about (3) before I comment on it, but I support (2), (4) and (5). I'm biased towards target priorities, because I added that one to FA in a mod.
  4. thefirstfish

    thefirstfish New Member

    Messages:
    296
    Likes Received:
    0
    Great topic and suggestions.

    I support all of these suggestions in principle, although I'm not sure I'd use some of them, such as polygonal area commands and the face command. Perhaps the more obscure commands could be hotkey only rather than taking up icon space in a command menu.

    I'd also like to see point 1 expanded with different behaviours for different unit types, kiting won't be the optimal strategy for all units. Unit behaviour should either be configurable through toggles or linked to a special command.

    An example of the latter point: "Attack" command makes light bots run straight towards a target until close enough to stand still and shoot it; "fight" command makes light bots run in zigzags towards a target and then stay at their maximum range while dodging about. Bonus points for random direction dive rolls, sideflips etc. as part of light bot dodge protocol. Any dodging movements should be random, not reactive to predicted or actual projectile trajectories.
  5. thorneel

    thorneel Member

    Messages:
    367
    Likes Received:
    1
    Why? When you micro your light bots, you will try to avoid the slow rockets of the skirmishers, and it will work better than just letting them randomly swarming around. So why make an automation system if it fails to do it properly anyway? Obviously, they should only try to avoid the slowest non-guided projectiles, but there are no reasons to not let them actively avoid projectiles. It could also be good for other units to try to avoid lone artillery shots.
    OTOH, a swarm of skirmishers could try to concentrate their fire in a way to make some of them unavoidable, but that's another story.

    Also, short-range light raiders should probably to surround enemies with their random movements, so said enemy has to spend more time turning its turret to destroy the next one.


    About targeting. If your artillery gun can shoot a giant flying fortress down, then it should target it! You shouldn't have to manually fire it by guessing which patch of ground two km away it should aim at in order to shoot the damn thing down from right above your base.
    Another (more on-topic) thing, with the "100 bombers vs 50 tanks" examples, the 100 bombers should be smart enough to concentrate on the tanks in a way so they can kill a maximum of them with one pass. if a tank needs 3 bombs to be destroyed, then they should attack by 3 against each tank, and make a second pass against the remaining ones.
    And target priority shouldn't override anti-overkill, there isn't much point to.

    Also, when you order a group of units to attack, you should be able to select what targets are prioritized in a more general way than just "this unit". For example, targeting generators in priority, or factories, or radar, or anti-missiles...


    Another element is the "advanced template" that was talked about in other threads.

    Those templates should be scalable (so you can, for example, build one factory and a few generators, or a whole array of those, for example), for example if you drag them, with a way to choose the spacing. It should also take into account terrain (for example, putting turrets in heights or at the cliff's edge and fragile buildings in hollows. Or putting torpedo launchers on water instead of land point defences).
    Obviously, it should be rotatable. It should also, if possible, include some parameters so you can select if you want, say, more anti-air or simply less defences. It should use a priority system (which should be used for all building anyway). And it should take into account the construction order (so it can build, say, the mex or the building tower first).
    It should also be editable out of the game, and shareable.

    I'm not sure how it should do all that UI-wise without having the game running, though.


    More about UI-power :
    We need to be able to order units whose construction has not begun yet (for example, selecting the factory you just ordered the construction after a mex and two generators, whose construction didn't begin yet).
    We also need a way to order units before they are built, particularly engineers.
    We need a way to order unbuilt units to form a group and perform actions (like attacking an enemy base or securing a point) only when the group is complete. Possibly with orders as first-class entities.
  6. lirpakkaa

    lirpakkaa New Member

    Messages:
    60
    Likes Received:
    0
    If there is some sort of automated kiting, it should NOT be a state toggle. It should rather be a command you give, like move or attack - "move here and kite anything you encounter". That way you have proper control over your stuff, and it won't just automate itself without your wish. And constantly giving orders is much smoother than constantly switching state toggles.
    Problematic though is, how will it deal with groups of units with a mix of longer- and shorter ranged units than itself?



    2) is doesn't have a good effect on the game I think. It doesn't really do anything that a human would normally consistently do, but alters the game more fundamentally.
    But it grabs some options away from you, forcefiring targets down is no longer as good an option since you'd do more overkill that way (with random targeting there'll always be overkill so focusfiring won't up it as much). That's right, it encourages you to not touch targeting ever.
    Whereas if the target choosing algorithm is dumber, a battle of untended units on both sides will end up about the same regardless of if this is on, but focusing fire to an urgent target will have less of an overkill effect.

    And how can you even know if a projectile will hit, account for all AoE, etc., it also seems really CPU-intensive because of this.
  7. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    Sorry to say this: But to toggle such type of "tactics" by hand is a very bad idea. 1) and 2) can be considered broken by design.

    Such actions (retreating, sharing targets, advancing) may NEVER just be triggered randomly, it requires precise knowledge about the situation or it will mean an huge DISadvantage for the player using it.

    This already has been discussed multiple(!) times in various threads about tactical assistance by the AI for human players. The AI MUST have ALL options by hand and it will automatically choose the most appropriate action, based on "knowledge" it gained from training (simulating hundreds to thousands of different situations and measuring which action gave the biggest advantage - even if that action was retreating).


    3), 4) and 5) isn't new either, those suggestions have already been made in threads about area commands etc.
  8. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    1:
    No, letting the AI control unit movement like that goes too far, like I said on many other occasions.

    2:
    I dont fully understand. So the goal is to make units target more intelligent to avoid overkill?
    Yes, please. But why should that even need a toggle to switch it off?
    Attack priorities have been in RTS since a long time, thats not even new anyway.

    I dont see the problem. Focusfire is not something anyone does to reduce overkill. Focusfire has the sole purpose to clarify to all your units: I want that commander dead, NOW!

    3:
    As long as this only queues up normal (attack, move, what we already know from SupCom:FA) commands I think it will be useful.

    4:
    Wait: Isnt that just another name for pause? You can pause stuff in SupCom already. Thats nothing new and very needed in a streaming economy.

    Coordinate: SupCom has this, it is called "Coordinated attack". It is so useless, I dont even know how to give that command in SupCom xD

    Split: I would put this into the group of area commands. I.e. a split-attack area-command that queues up attack commands on all targets in an area, equally distributing them between the selected units. Very helpful for bombers indeed.

    5:
    Yes please

    6:
    Thats something that isnt really needed, I think. I never really cared much about where my tanks face to. Sure there are exceptions (i.e. the monkeylord) but for smaller tanks it is just not that important. Make them rotate their guns towards the nearest enemy automatically, I dont care. In fact, dont they do that in SupCom:FA?
  9. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    If kiting is a command, then if it is the last order in a queue, the command should never complete, otherwise there would be no method of making idle units kite.

    BulletMagnet & Exterminans:
    I am aware of the various arguments for and against auto-kite. You may consider it to be the average level of unit AI that we Core people are harping on about. If you don't support it, fair enough.
    Perhaps you have some ideas about making the UI more powerful or scale better?

    Perhaps your objections against auto-kite might be answered by a different implementation? How would *you*, as a player, determine whether some fragile long range units ought to kite when enemies approached?

    lirpakkaa & Exterminans:
    Option 2 would replace the default target selection behaviour of units, in favour of one that accounted for allied shots. The benefit, lower overkill, makes weapon types scale better.

    Consider two types of weapons. Both with the same DPS, same range, same ballistics. One is fires once every three seconds, the other fires once per second.
    Now, obviously the 3 second burst damage will overkill against units too light to take the hit but in those cases, burst weapons are at a disadvantage.
    Consider a target enemy that will be killed in 3 seconds on average, so the ideal target category for the 3 second burst damage weapon, no overkill at all. But no! Assuming the weapon isn't a laser and takes time to travel to the target, other units will fire on a doomed enemy, wasting shots. The continuous damage weapon actually does better despite the lack of an initial kill in opening salvoes, despite being a theoretically worse weapon.

    Now, with the system, the enemy IS an ideal target for the 3 second reload weapon, as intended. Units will prevent each other from firing on doomed enemy units, to better pick their targets.

    Imagine a T3 gunship swarm. They're tech 3, so T2 flak cannons don't do well against them (too much armour), especially when line commands are in (too easy to spread out vs AoE).
    T3 missile launchers fire large salvoes of missiles that are intended to block bombers from dropping their payload. Unfortunately, the targeting has an annoying tendency to all pick the same gunship (usually the first that entered range) and the T3 gunship swarm levels the base despite twice their cost in AA being present.
    Ten gunships would not dare to approach ten missile launchers. A hundred gunships swats a hundred launchers aside without a blink.

    I have seen this happen. It gets worse when you have burst AA for anti-bomber work (multi-second reload, humongous alpha). The practice of baiting enemy AA with cheap fighters relies on targeting stupidity and the sight of seeing 10 advanced AA missile launchers burn their shots gleefully on a single scout drone... well, let's just say I think that shouldn't happen. If you disagree, we're never going to understand each other.
    The minimap scene where you have a wing of bombers approaching and a hundred missiles rising from the base... all converging onto a few points. It's just ugly and stupid. A base with combined AoE and burst T3 AA should be nigh impregnable to T1 bombers, not swarmable with a relatively cheap cloud of a mere two hundred. (SupCom)

    The same applies to any unit with a weapon with significant cost of firing (usually a long reload but especially ammo ala screamers in ZK) and significant shot flight time.

    What this shared targeting will do is simple. Make weapons work as intended regardless of whether they are in single unit duels or in group vs group combat.

    I have tried to implement this for AA as a gadget in ZK btw. It was discontinued due to bugs and general unfixableness (which says that I am not a good coder, not that the idea is bad), but when it worked, it made sense. It did not lag the game, even when over a hundred targets and shooters were around. I'm sure my messy code could have been much improved. The core idea is simple after all.

    Cola-Colin:
    I know you were going to disagree about 1, I say we don't need to dredge up the old argument, hey?

    Facing I can see being very useful for ships and generally things with weapon arcs. You issue a line command to a bunch of ships then a face command towards the end of the line. Watch the fleet line up, turn and fire off a massive broadside salvo!
    Come on, you know you want that. =D

    I would like to ask, what is your opinion on client-side scripts?
    Some of us would like to use the crutch of auto-kite and if it makes us play worse, then all the better for you, no?
    Player developed scripts could then open it up for refinement. You know, open source and all that.
  10. qwerty3w

    qwerty3w Active Member

    Messages:
    490
    Likes Received:
    43
    I would like to see a command to keep the selected units dense so they won't be dispersed by other automations and have to move together. How dense they are should be configurable, and there should be some easy ways to add units to a group and remove units from a group along with this.

    Another thing I would like is a auto avoid state to keep the units away from their counter units, I know knowing which unit counters which is a skill in rts games, but it is a low level one so I don't think it is important.
  11. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    SupCom:FA supports UI-Mods already. I am using like 5 or so myself. I dont know if it is possible for such a mod to give commands to units, but I would not really care. Mods like that would fail anyway :p
  12. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    Well, I meant more like the Spring engine widgets. They're in LUA, simple but powerful language, that can support very complex logic and yes, you could, in theory, build a widget AI or redesign the entire interface.

    Like you say, a full AI is likely to fail badly. Some of us, though, think that something useful can be gained from the pieces.

    Would you be opposed to us making widgets and using them?
    In MP matches? Ranked ladder games?
  13. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    UI-Mods in SupCom use lua aswell. Call them widgets if you want, it is the same.
    The only important thing is that they are carefully sandboxed. UI-Mods in SupCom can access data that is not supposed to be accessible :/
  14. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    Oh, then if widgets can only do what players can *theoretically* do and only access information that players can *theoretically* access, you're fine with it used everywhere?

    Then yeah, we can both have our cake and eat it too. XD

    The AA firecontrol started as a widget btw.
  15. qwerty3w

    qwerty3w Active Member

    Messages:
    490
    Likes Received:
    43
    The only mod about unit behaviour I know in SupCom is Bullet Magnet's Over-Kill Control, it is really useful but not a UI mod, so if you want to see some good unit AI widgets, you might have to try some spring.
  16. BulletMagnet

    BulletMagnet Post Master General

    Messages:
    3,263
    Likes Received:
    591
    Yeah, OKC is impossible as a UI mod/widget/thingimajig. The Moho engine forbids orders and actions involving other objects from the UI-layer (so that people don't build bots that play ranked games for them). Toggling states on and off, like shields, or metal makers is permitted though.
  17. kromius

    kromius New Member

    Messages:
    27
    Likes Received:
    5
    Dont know if this has been suggested, but id like to see a scatter command, for when u want to dodge a bombing run by enemy planes and such .
  18. jseah

    jseah Member

    Messages:
    129
    Likes Received:
    2
    Why is this? Surely any halfway decent player could flatten a bot?
  19. BulletMagnet

    BulletMagnet Post Master General

    Messages:
    3,263
    Likes Received:
    591
    I agree with you there, but I didn't make the engine (though Neutrino has a better idea of the Moho Engine than me, so ask him).
  20. cola_colin

    cola_colin Moderator Alumni

    Messages:
    12,074
    Likes Received:
    16,221
    Considering that ui-mods can easily access stuff like resource or unit-numbers of your opponent I would guess they just didnt think it through completely. Or they just dont like the idea of AI-helpers themselves :p

Share This Page