For Backers Only: AI building stuff

Discussion in 'Backers Lounge (Read-only)' started by Sorian, July 19, 2013.

  1. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Code:
    {
    "max_count": 20,
    "min_count": 10,
    "squad": "Fast",
    "unit_types": "(Tank & Mobile) - Fabber - AirDefense - Construction - Artillery - Heavy - Scout"
    },
    {
    "max_count": 20,
    "min_count": 10,
    "squad": "General",
    "unit_types": "((Tank | Bot) & Mobile) - Fabber - AirDefense - Construction - Artillery - Heavy - Scout"
    },
    Be very careful with setups like this. I am not 100% certain that the json order remains the same once parsed. In this example, if the General squad gets filled first it will grab all the tanks and bots (up to 20) and there may not be any tanks left for the Fast squad. Since you have a min_count for Fast squad that means the platoon will not be able to be created if General gets filled first, unless you have at least 30 tanks (ignoring bot count), which may not be the effect you are after.
  2. zweistein000

    zweistein000 Post Master General

    Messages:
    1,362
    Likes Received:
    727
    You were right. Apparently those files were formatted using some other json formatter and not json lint. After opening up jsonlint, everything had a different order.

    EDIT: IT'S FIXED. Now just to tell the AI to scout and we're golden.
    Last edited: November 13, 2014
  3. zweistein000

    zweistein000 Post Master General

    Messages:
    1,362
    Likes Received:
    727
    Hey @sorian When the AI looks at platoon_templates and platoon_builds does it read the file form the bottom up or from the top down? Also must the platoons in platoon_templates and platoon_build be in the exact same order?

    I'm asking because when I try to tell the AI to build bot/tank only platoons it stops building any kind of platoons and I'm not sure why.
  4. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    They platoon builds are stored in priority order, so no guarantee which build item with the same priority will be first.

    Also, no, platoon templates and platoon builds do not have to be in any particular order.
  5. zweistein000

    zweistein000 Post Master General

    Messages:
    1,362
    Likes Received:
    727
    So.. The Platoon_x_builds and platoon_templates seem to be very fragile things. In fact they seem to be so fragile, that sometimes they stop working without any reason. Yesterday it was working, today no. I did no changes to any of the files (I only changed Fabricator_economy_builds). What gives?

    EDIT: I've found a bug wit the AI (and it's nothing that I did). Is seems that unless the AI has both tanks and bots readily available to build platoons it WILL NOT build platoons, even though it's set up to do so.

    It WILL however build platoons of mixed bots or tank (but not of these don't become available early it seems).


    Code:
    {
        "platoon_templates": {
            "Land_Attack_Small": {
                "units": [
                    {
                        "unit_types": "(Tank & Mobile) - Fabber - AirDefense - Construction - Artillery - Heavy",
                        "min_count": 0,
                        "max_count": 3,
                        "squad": "Fast"
                    },
                    {
                        "unit_types": "((Tank | Bot) & Mobile) - Fabber - AirDefense - Construction - Artillery - Heavy - Scout",
                        "min_count": 0,
                        "max_count": 3,
                        "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.5,
                        "squad": "Close"
                    },
                    {
                        "unit_types": "((Tank | Bot) & Mobile) & (AirDefense | Construction)",
                        "min_count": 0,
                        "percent": 0.2,
                        "squad": "Defense"
                    },
                    {
                        "unit_types": "(Land | Air) & (Scout | Recon)",
                        "min_count": 0,
                        "percent": 0.05,
                        "squad": "Defense"
                    }
                ]
            },
    Code:
            {
                "name": "Land Attack Platoon Small",
                "to_build": "Land_Attack_Small",
                "instance_count": -1,
                "priority": 104,
                "build_conditions": [
                    [
                        {
                            "test_type": "UnitPoolCount",
                            "unit_type_string0": "((Tank | Bot) & Mobile) - Fabber - AirDefense - Construction",
                            "compare0": ">=",
                            "value0": 1
                        },
                        {
                            "test_type": "FocusTargetThreat",
                            "string0": "AntiSurface",
                            "compare0": "<",
                            "value0": 840
                        },
                        {
                            "test_type": "CanAttackWithPoolUnitsLand",
                            "string0": "WL_AnySurface",
                            "string1": "WL_AnySurface",
                            "unit_type_string0": "Mobile | Structure"
                        }
                    ]
                ],
                "task_type": "LandAttack"
            },
    EDIT2: I bypassed the problem by allowing the AI to make Bot only or tank only platoons in addition to mixed platoons. .
    Last edited: November 15, 2014
  6. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    I don't find them fragile at all. They work just fine. Not sure what difficulties you are having here. I've seen the AI build plenty of tank or bot only platoons.
    Quitch and squishypon3 like this.
  7. mjshorty

    mjshorty Well-Known Member

    Messages:
    871
    Likes Received:
    470
    Define Platoons *as MJshorty already defines standards for rankes* the absurd AI would barely be able to beat a silver player because they dont build any sort of large platoon or use them effectively....let alone mass multiple amount of platoons. Players can easily hit up to 1000 sized armies *yay* while AI struggles to use the 200 in its base sitting around =(
    FSN1977 likes this.
  8. zweistein000

    zweistein000 Post Master General

    Messages:
    1,362
    Likes Received:
    727
    See the above post. It also seems that if I hive the AI a 5x economy multiplier it will happily make any platoons it can, but at 1x the units just keep idling in it's base. I'll go check again to confirm.

    EDIT: It's not even that. Sure the AI is more likely to make platoons and send them out at 5x economy rating, but it's not given. When testing at 1x economic rating, in a 52 minute game I saw both AIs constantly making air, scout and orbital platoons and only 1 AI making 1 ground forces large platoon at about 44 minute mark after it had gotten nuked by the other AI into oblivion.

    In a 5x Economy game I only saw 1 AI making the ground platoons while the other one happily sat in its base doing sweet FA.

    In another 5x economy game I saw both AI working as intended with no oddities.
    Last edited: November 16, 2014
  9. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    The AI builds plenty of bot only platoons under Queller, I've never seen any land platoon issues.
  10. zweistein000

    zweistein000 Post Master General

    Messages:
    1,362
    Likes Received:
    727
    As I have said. It seems random. I have difficulties figuring out why doesn't it want to form platoons at one time, but happily forms them the other time.

    EDIT: Could it be the fact that some RCBM unit drain power/metal to reload their ammo? Still those kinds of units are all late game units so it should form platoons in the early game.
  11. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    I did find a bug in the platoon manager. Not sure if it will fix your issue or not, but I will try to get the fix in the next build that goes out.
  12. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    My platoon manager fix did not make it into the current PTE build (75134-main), but should make it out in a future build.
  13. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Working on getting some info down about the AI and thought some of you might be interested in the class hierarchy. It doesn't show access or dependencies, just who owns what.

    PA AI.jpg
    lafncow, zihuatanejo, cdrkf and 9 others like this.
  14. websterx01

    websterx01 Post Master General

    Messages:
    1,682
    Likes Received:
    1,063
    How much processing resources does the AI get? How does it allocate those resources so that it's efficient? That there chart is cool though; lots of stuff happening within the AI's brain.
  15. Geers

    Geers Post Master General

    Messages:
    6,946
    Likes Received:
    6,820
    You mean other than "EXTERMINATE!"?
    websterx01 and mjshorty like this.
  16. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    As much as I steal before project leads start complaining.

    There isn't anything to stop the AI from taking what it needs other than the fact that I have a lot of code in there to make it performant. I think the next step would be to multi-thread the calls to AIBran::tick() (which is the entry point to the AI) so that each AI gets its own thread and they all make their decisions at the same time. That would speed up games where there are multiple AIs. Not super necessary since the AI does not seem to be a perf hog, even in late game with more than a few planets.
  17. Engineer1234

    Engineer1234 Well-Known Member

    Messages:
    325
    Likes Received:
    291
    So no repeat of the FA vanilla AI slowdown, THANK you :) I followed that thread on the GPGforums for litterally years hoping someone could fix it 100%.
  18. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    Was one brain per AI also true when the AI did shared armies, or was the team counted as one AI? Also, why did shared army support disappear and is it coming back?
    mjshorty likes this.
  19. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    For AIs shared army means one AI brain. Still want to make it so the AI can utilize multiple spawn points.

    Was not aware shared army support was gone.
    Quitch, mjshorty and igncom1 like this.
  20. Quitch

    Quitch Post Master General

    Messages:
    5,885
    Likes Received:
    6,045
    It disappeared back when AIs were allowed to join human teams, I assume to avoid AI and human shared army teams, but you can't have shared army AI teams either.

Share This Page