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,884
    Likes Received:
    6,045
    For PlanetHighestEnemyArmyThreat is it possible this could blind the AI to certain threats? For example, the highest enemy threat is a player with an all land army, and the second highest threat has an all air army, would that mean the AI would see the skies as being safe using the following test?

    Code:
    {
                      "test_type":"PlanetHighestEnemyArmyThreatRatio",
                      "string0":"Air",
                      "string1":"AntiAir",
                      "compare0":">",
                      "value0":0.9
                   }
    Or is it using the highest enemy threat value for the string being checked against?
    Last edited: June 17, 2015
  2. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    string0 = The enemy threat to check for
    string1 = the ai threat to check for.

    So, it is checking for the enemy army with the highest threat of that type (string 0).
    Quitch likes this.
  3. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    Running a local server the SIM speed suddenly tanked, then after a short while it fixed itself. Happened around the time one AI fired the unit cannon. Also, this error appeared in the log just after the SIM speed returned to normal.

    [23:02:22.047] ERROR Attempted to create a search space with a ground last voxel not owned by this nav world!
  4. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    What's the format of a SpawnablePlanetCount test? My assumption is:

    Code:
                   {
                      "test_type":"SpawnablePlanetCount",
                      "compare0":"",
                      "value0":
                   },
    Also, is PlanetWithoutPresence a planet without the AI, or a planet without anyone?
    Last edited: June 18, 2015
  5. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Neat. I added that log message and some code to prevent the server crashes we were seeing. Now I have a repro case to try. :)

    SpawnablePlanetCount is correct as presented. It will return the number of planets currently alive and that support starting locations.

    PlanetWithoutPresence will detect if there is a planet that is not currently occupied by the AI. Occupied, in this case, is defined as having an active base on the planet and having a fabber either on the planet or in route to the planet.
  6. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    At which stage is this an active base:
    1. Orbital fabber arrives and queues a teleporter build
    2. Teleporter construction begins
    3. Teleporter completed
    4. Units arrive through teleporter
    5. Fabber arrives through teleporter
    6. Fabber queues a build
    7. Fabber starts build
    8. Fabber completes build
    I'm guessing somewhere from 1-3 as the AI seems to create bases for any and all build locations.
  7. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    DistFromNearestEnemyThreat doesn't count the Commander. Does this mean it's not a part of any threat calculations? It would certainly explain a lot of the AI bomber behaviour around bases.

    For planets where it knows where the enemy base ahead of time it should set this value at the start of the game.
    Last edited: June 18, 2015
  8. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    I don't think SpawnablePlanetCount works, Sorian. I've setup an AI with only one thing it can build

    Code:
    {
       "build_list":[
          {
             "name":"Basic Air Factory",
             "to_build":"BasicAirFactory",
             "instance_count":-1,
             "priority":376,
             "builders":[
                "Commander"
             ],
             "build_conditions":[
                [             
                   {
                      "test_type":"UnitCountOnPlanet",
                      "unit_type_string0":"Factory & Air",
                      "compare0":"<",
                      "value0":1
                   },
                   {
                      "test_type":"SpawnablePlanetCount",
                      "compare0":"<",
                      "value0":2
                   },
                   {
                      "test_type":"CanFindPlaceToBuild",
                      "string0":"BasicAirFactory"
                   }
                ]
             ],
             "placement_rules":{
                "buffer":3
             }
          }
       ]
    }
    Without SpawnablePlanetCount it works fine, but with the check the AI does nothing. Change the check to >= 0 and it works again. Tested on Styx.
  9. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    DistFromNearestEnemyThreat looks at econ threat, so yeah, the commander would be included in that.
  10. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Are you sure the AI isn't simply refusing to build an air factory to start due to it's personality settings? I think that highlights a different bug.
  11. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    If an AI is set to idle does that mean it's not counted as a threat?
  12. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    Positive. Take out the SpawnablePlanetCount block, or set it to >= 0 (but < 2 or = 1 don't) and it works fine. I was using it to test DistFromNearestEnemyThreat earlier by having the commander build an air factory which spams Fireflies, then having the commander build different structures depending on the DistFromNearestEnemyThreat value.
  13. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Keep in mind, mobile unit threat values decay over time.
  14. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    Oh sure, but I needed an idea as to what 300 units of distance actually equates to in-game. I might do something similar in the future to try and figure out how many points of threat different units represent.
  15. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    If I recall, bot factories are about 30 x 30, so 300 would be 10 bot factories side by side.

    Looking into the spawnable planet thing.
    Quitch likes this.
  16. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    So, that build condition is working properly. If you look at pa\main\server\script\lobby\ladder_systems_table.js both planets in the Styx system are marked as starting planets. So, SpawnablePlanetCount < 2 will correctly return false.
    ace63 and Quitch like this.
  17. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    D'oh! Thanks, Sorian. Sorry to waste your time on that one :)
  18. Sorian

    Sorian Official PA

    Messages:
    998
    Likes Received:
    3,844
    Never a waste.
    websterx01 and ace63 like this.
  19. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    The AI prioritises resources over the Commander with its SXX, even when there's no anti-orbital threat.
  20. Quitch

    Quitch Post Master General

    Messages:
    5,884
    Likes Received:
    6,045
    Are ships included in the AntiSurface threat count?

Share This Page