The sorian PA AI thread

Discussion in 'Planetary Annihilation General Discussion' started by Quitch, December 23, 2014.

  1. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    Playing on PTE and the AI seems to have an aversion to attacking Jigs with Avengers.

    Also, I have this as the only code block for the Advanced Air Factory

    Code:
    {
             "name":"Advanced Air Factory",
             "to_build":"AdvancedAirFactory",
             "instance_count":1,
             "shared_instance_count":"AdvancedFactory",
             "priority":477,
             "min_num_assisters":3,
             "max_num_assisters":5,
             "builders":[
                "BasicAirFabber",
                "AdvancedAirFabber"
             ],
             "build_conditions":[
                [
                   {
                      "test_type":"AloneOnPlanet",
                      "boolean":true
                   },
                  {
                      "test_type":"HaveEcoForAdvanced",
                      "boolean":true
                   },
                   {
                      "test_type":"CanAffordBuildDemand"
                   },
                   {
                      "test_type":"CanAffordPotentialDrain",
                      "string0":"AdvancedAirFactory"
                   },
                   {
                      "test_type":"UnitCountOnPlanet",
                      "unit_type_string0":"Basic & Fabber - Orbital",
                      "compare0":">=",
                      "value0":3
                   },
                   {
                      "test_type":"PlanetHasUseablePlanetWeapon",
                      "boolean":true
                   },
                   {
                      "test_type":"CanFindPlaceToBuild",
                      "string0":"AdvancedAirFactory"
                   }
                ]
             ],
             "placement_rules":{
                "buffer":5,
                "threat":{
                   "influence_type":"AntiSurface",
                   "compare_type":"<",
                   "radius":10,
                   "value":50
                }
             }
          }
    
    However, the AI still build several of them on PAX Lava in the PAX Prime system. Does PlanetHasUseablePlanetWeapon work in PTE?
    Last edited: March 30, 2015
  2. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    Ran into an interesting one where Queller wouldn't attack the purple player despite a massive overwhelming advantage. It kept forming up outside then going home.

    2015-03-31_00001.jpg

    2015-03-31_00002.jpg

    You will see some white tanks near the top, which is an AI army sitting outside the base, constantly realigning itself.

    As this could of course be my fault here's what the MAX platoons look like for Queller

    Code:
    "Land_Raid_Max":{
                "units":[
                    {
                      "unit_types":"(Bot & Mobile) - Advanced - Fabber - Construction - Artillery - Heavy",
                      "min_count":40,
                      "max_count":-1,
                      "squad":"Fast"
                    },
                    {
                      "unit_types":"Land & Scout",
                      "min_count":0,
                      "max_count":2,
                      "squad":"Defense"
                    }
                ]
             },
    "Land_Attack_Max":{
                "units":[
                    {
                      "unit_types":"((Tank & Mobile) | (Bot & Mobile & Advanced)) - Fabber - AirDefense - Construction - Artillery - Heavy - Scout",
                      "min_count":40,
                      "max_count":-1,
                      "squad":"General"
                    },
                    {
                      "unit_types":"((Tank | Bot) & Mobile) & Artillery",
                      "min_count":0,
                      "percent":0.35,
                      "squad":"Artillery"
                    },
                    {
                      "unit_types":"((Tank | Bot) & Mobile) & Heavy",
                      "min_count":0,
                      "percent":0.1,
                      "squad":"Close"
                    },
                    {
                      "unit_types":"(Tank & Mobile) & AirDefense",
                      "min_count":0,
                      "percent":0.2,
                      "squad":"Defense"
                    },
                    {
                      "unit_types":"Land & Scout",
                      "min_count":0,
                      "max_count":3,
                      "squad":"Defense"
                    }
                ]
    Last edited: March 31, 2015
  3. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    So, things the AI needs to play orbital better:
    • Ability to send Avengers between planets
    • Ability to send SXX between planets
    • Ability to send Phoenixes between planets
    • Building Jigs in a way which prevents chain reactions
    • Planning builds ahead of arrival so orbital fabbers arrive at the build location
    • Recognition that it being shot from the orbital layer and appropriate assigning of threat
    • A ground support function for avengers in the same way air has it (maybe it already has this but with Avengers not moving between planets it's hard to tell)
    • Exclude orbital fabbers from PlanetWithoutFabberWithTeleporter
    • Orbital neural net
    • An understanding that it should rally its orbital layer forces at a planet which allows it to quickly deploy i.e. Avengers shouldn't be crossing gas giants to attack, they should be arriving on top of the target. Ideally this would be a planet that's empty or under AI control which orbits other planets which either need defending or are targets for attack.
    • AI needs to be more willing to throw radars away to end the game. I've seen rare situations where the AI will stalemate even though one has a billion nukes because it doesn't know where the enemy commander is but it doesn't seem willing to chuck a few radars over there to finish the game.
    • It should understand that teleporters are a priority target
    I'm trying to make the AI better about taking over worlds. Currently it will basically start from scratch each world, sending over only one fabber. I added this code:

    Code:
    {
             "name":"Teleport Fabber To Planet - Nothing to do here",
             "instance_count":-1,
             "priority":1,
             "builders":[  
                "BasicBotFabber",
                "BasicVehicleFabber",
                "AdvancedBotFabber",
                "AdvancedVehicleFabber"
             ],
             "build_conditions":[
                [
                   {
                      "test_type":"UnitCountOnPlanet",
                      "unit_type_string0":"Structure & Teleporter",
                      "compare0":">=",
                      "value0":1
                   },
                   {
                      "test_type":"UnitCountOnPlanet",
                      "unit_type_string0":"Fabber - Air",
                      "compare0":">=",
                      "value0":2
                   }
                ]
             ],
             "task_type":"TeleportFabberToPlanet"
          }
    Yet I see idle fabbers sitting around not moving to other worlds. I'm not sure if I'm doing something wrong, or whether TeleportFabberToPlanet only works when certain conditions are true, or it's reserving teleporters for other functions so the task doesn't work.

    Also, the AI seems to get into some real economy stalls on orbital maps. I don't know if it's due to the way it anticipates income doesn't scale well across worlds, but you'll see it build factories while hundreds in the red despite CanAffordBuildDemand and CanAffordPotentialDrain. It will eventually get on top of it, but there's a real transition period.

    Edit: on the last point there was a bug in Queller not building advanced vehicle fabbers on planets without an enemy presence, so that was probably responsible for a lot of the transition pains. Though I would expect potentialdrainchecks to compensate
    Last edited: April 4, 2015
  4. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    The AI will fight walls. It will literally micro attack them (incidentally the AI moves units too far away when attacking structures leading to it having to circle back and wasting lots of time). It needs to just ignore walls.

    Walls do seem to be a major weakness for the AI, it has absolutely no understanding of them or the force multiplier they represent. It needs some kind of walls to artillery threat ratio.
  5. earth75

    earth75 Member

    Messages:
    93
    Likes Received:
    25
    I guess the AI treats wall segments as regular buildings, or worse, regular units. I can see sorian implementing some kind of test though
  6. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    It's not only orbital. The AI is completely incapable of reading any tracers, at all.

    But I don't think teaching the AI how to read tracers would be the right way to solve it, instead this functionality should really be incorporated into the generic intelligence system.
    Quitch likes this.
  7. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    A way to measure threats across planets would be good, SystemThreatRatio.
  8. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    I completely disagree, the AI should be able to respond to tracers, but it shouldn't be part of unit AI. Good lord that would be tedious, whole armies getting dragged into turret walls because someone used a pelter to trigger their AI.
    Last edited: April 5, 2015
  9. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    That's not what I meant. It's not part of the unit AI - it's part of the intelligence system. Seeing a tracer is not supposed to cause any immediate reaction in the unit AI, but it's supposed to cause an update to the intelligence system which reveals the origin of the tracer.

    When someone fires a pelter at you, you just know that there is a pelter at the other end of that ballistic curve. The AI doesn't know that, as this information is currently only available by watching out for tracers manually as it isn't promoted to the intelligence system as it *should*.

    In return, it's actually a feature you would expect as a player as well. If you see a tracer, you can already trace it back to see where it came from, and you can see what unit type the firing unit was, just by looking at the projectile. So there is no reason, why this (already available!) information shouldn't be forwarded to your intelligence.
  10. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    Well there are, one of which is clarity of UI. You've just introduced a new type of radar blip which cannot be targeted, unless you want it to be targetable, at which point you've just massively nerfed radar and reduced the requirement for intelligence.

    What problem would you be trying to solve exactly?
  11. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    The point of radar and scouting isn't to tell what is currently firing at you - you already have that information right now, it's just not displayed in any human friendly form when not using mods. The point of radar and scouting is to detect enemy units before they start shooting at you, and that means also scouting them before you can see their tracers flying into your direction.

    But I guess you are right about "non targetable" blips, that's actually a problem we had for quite a while now.

    Back in SupCom we had these "ghost" units and blips which would remain whenever you lost intelligence on anything, and you could still target them, they just wouldn't get any position updates or feedback as the source unit moved or got destroyed. (Unless you spotted either the source unit again, or you scouted the location and invalidated the ghost.)

    If I'm not completely mistaken, then AI is already emulating that ghost behavior in its own intelligence component, so the AI already has the feature to remember units which only appeared on radar or vision once, even though (at least I think so) it still won't be able to use weapons which don't allow ground targeting against ghosts, currently.

    So what I'm asking for is essentially to move the existing(!) ghost system out of the AI and make it a first class feature of the regular intelligence system, and to extend the list of events which can trigger the creation of ghost blips to cover all scenarios, from which a player can allready pinpoint the type and position of an enemy unit right now.
  12. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    You haven't said what problem it is you're trying to solve with this or how it benefits the gameplay.
  13. exterminans

    exterminans Post Master General

    Messages:
    1,881
    Likes Received:
    986
    The problem is, that there is information presented to the player, but it's not being aggregated or processed in any form to be easily readable. The AI is currently completely incapable of parsing the information, and most players will only be able to process the information if they happen to witness it by chance.

    It's a generic class of problems with intelligence in PA, where a player (both human and AI) will only know about units he has no recent intelligence on, if he was to witness an event which indicated the existence of this unit. The server is emitting these events, but the information is neither being aggregated nor persisted in an accessible manner.

    This has lead to @sorian developing parts of the missing features of the intelligence system as components of the AIs internal view of the intelligence system, which comes at the cost of that feature being underdeveloped as it has a lower priority than as if it was integrated with the intelligence system right away. As a direct result, certain events, such as seeing a tracer, have been overlooked by Sorian which causes the AI not to be aware of the existence of certain units, even though there is obvious evidence.

    As for the impact on the game play, try to figure yourself:
    How could it possibly be beneficial for the game if intelligence wasn't lost just because you happened to be zoomed out too far (to see tracers being rendered), or because your current camera didn't cover the location? With planet wide area patrol and the wide range of zoom levels, the controls for efficient planet wide intelligence have been created, but the aggregation process is more than just lacking.

    Having targetable ghost blips (both anonymous and identified, that means unit type symbol and frozen unit model) means preserving the information from the intelligence gathering process which lowers the requirements to comprehending the situation as you are now guaranteed that you can access past data without any barriers as long as it hasn't been invalidated.

    Making these blips targetable results in your units having access to this information as well, which allows them to react to the result of a previous scouting process when evaluating area commands.

    Extending the list of events which are sufficient for creating a blip from just vision and radar, towards all events which would give away the location and type of an unit if wittnessed, such as tracers, eases the the process of gathering intelligence even further and reduces the risk of own units acting counterintuitive when they make a wrong assumption about no enemies being present whereby any human observer could see that this assumption is wrong.

    In summary: It reduces the memory footprint for the process of intelligence gathering in your mind model as data is being preserved properly, and it reduces the impact your attendance has on the effectiveness of any source of intelligence. By aggregating intelligence from all relevant sources, both the AI and human players get a more accurate and easier to understand model of the situation, whereby all information to be aggregated is already available right now, only neither aggregated nor preserved.

    For the AI, this means that certain situational analysis, which are currently performed on an internal model which is built up over time, can instead be performed directly on the state of the simulation. This helps reducing the complexity and the state size of the AI. (You probably know as well as I do, why having a large, internal state inside the AI is not favorable. And that's not just because the AI becomes dumb as a piece of bread after loading a saved game as it has lost that state, and with it all intelligence it has gathered so far...)
  14. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    The AI seems to have some strange behaviour going on here:

  15. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    What does the AI do with radar intel? It seems to ignore it all the time.

    Here we see the AI send its army on some long southern attack even as its own radar shows that it's about to come under attack.

    2015-04-16 21_43_37-2015-04-16_00002.jpg

    Here we see the AI drive its tanks into a radar blob. I don't care what that blob is (it was Bolos and Dox), there's no way it's sending enough units. It continued to drive stuff in that direction like the blob didn't exist. It also knows the commander is that way. AND it's spotted four factories, so what precisely is that group doing going off in that direction?

    2015-04-16 21_44_26-2015-04-16_00001.jpg
  16. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    317
    From your examples it seems that this is more a lack of "understanding" the future (to be more precise the future outcome of actions) than the use of intel. I'm not sure if sorian has anything in the AI that can predict that a large moving blob of enemy units heading towards the base is a very bad thing.
  17. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    The one where it plows through the blob, yeah I can see that (though I cannot envisage where it was sending that tiny group of tanks), but what the AI should do is evaluate nearby threat before reducing its defensive capabilities. That shouldn't be outside the realm of possibility.

    The AI still prioritises resource generators over everything else, and it costs it a lot of games. It will roll into battles with a small numbers advantage, spot a MEX and proceed to throw the game. Meanwhile, fabbers, which it should prioritise, are ignored.
    Last edited: April 16, 2015
  18. TheFinitePeach

    TheFinitePeach New Member

    Messages:
    21
    Likes Received:
    9
    Maybe if it was able to better prioritize usage of its units against threats seen or predictable via radar blips.
    ie.
    Snipe forces (groups of boombots or bombers) > attacking forces > fabbers > resource generation > enemy base

    Also maybe give the radar the ability to predict what a blob of units is based on previously aquired information (visual info, factory type, radar blip speed, and spacing)
  19. crizmess

    crizmess Well-Known Member

    Messages:
    434
    Likes Received:
    317
    I must be a horrible PA player, since I lose my expanding fabbers on a regular basis to the absurd AI...

    But the fundamental problem of this is way trickier than one might expect.
    For example: Assuming the AI knows that destroying mex is a good thing, and now it is in the situation where on the one side the AI is facing an enemy army, but there is also a mex in sight.
    Then there are two possible action paths:
    Code:
    >destroy mex *
    >destroy army >destroy mex *
    
    First of, if the "destroy army" is better rated than "destroy mex" it is trivial, the AI would pick "destroy army" in this situation regardless of what would follow this action.
    For the AI seeing that the second path is viable, it needs to be able to estimate the outcome of the action "destroy army", because the path is only viable when there are troops left after the enemy army is gone.
    For a greedy AI (that only looks for the next best action) this situation is ambiguous. Depending on the situation sometimes going blindly for the mex is better than facing the army, and vice versa. You actually need to evaluate the outcome of the first action and the second order action to make a better decision.

    Basically this is like path finding with discreet state space operators (on an continuous state space), where the start is the current state and the goal is a state where the mex is destroyed. (Yes, I do path finding, so every problem I see is either an optimization problem or a path finding problem, where on the extreme both are equal.)
    To be able to do this, you first need a model of the world (the state space) then you need to define all state space operators for each action possible, something like:
    Code:
    >destroy army(state) = if (AI army >> enemy army) { state - enemy army - my army + possibly surviving units } else { state - my army + possibly surviving enemy units}
    >destroy mex(state) = state - enemy mex
    ...
    
    I did something like this for a hobby project where agents simulated a trading post. The only thing the agents knew was the atomic actions like buy, sell, grow wheat, eat, etc and a model of those actions. It was fun, because the agents "discovered" action chains that made actually more sense than just pure greedy behaviour.
  20. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    Right now the AI simply goes resource first, which is a poor choice because army first is more often than not the better choice. Once you have a strong default choice you can work on additional complexity as needed, but right now it has a poor default choice.

Share This Page