Advanced AI control suggestion

    What do you think about it?

    • Agree with most.

      Votes: 0 0.0%
    • Neutral.

      Votes: 0 0.0%
    • Absolutely disagree.

      Votes: 0 0.0%

    • Total voters
      4
    Joined
    Dec 3, 2016
    Messages
    93
    Reaction score
    7
    Hello!

    I know that game is alpha now, but I think this AI control is important and should be implemented as soon as possible, because of a problem. I've seed similar suggestions, but this would connect best of them as I guess.

    The problem: AI configuration is narrow and not enough to control AI. For example, missile/cannon drones prefer moving away and miss their target in battle (you can't make them to keep distance you want). You can't control AI as you want to. You just able them to move in some sector, fight, idle and some few more options.

    Suggestion:

    [Orders]
    We can add some orders to a fleet and/or a single drone:
    1. Attack target.
    2. Retreat.
    3. Some navigation orders from navigation suggestion (move to an object, orbit, keep distance...).
    That would add some rts mechanics and as result more control and tactics.

    It will resolve: that drones moves as they want and you can't control them while in a battle.

    Needs to add some AI configurations:
    1. Target priority: faster, slower, bigger, smaller, closer, farther, "shielder", "less shielder", most armored, less armored, most attacked, less attacked, most damaging, less damaging, most damaged, less damaged and A LOT more (possible)...
    2. Action priority: fight, support, mine.
    3. Facing to the main target (should be disabled for turrets): front, top/bottom, side, mixed (very important, because some ships use turrets that can to fire only while ship is side-faced).
    4. Tanking priority (should be disabled for turrets): shield/armor/mixed, speed, range.
      • Shield: ship will prefer to use energy to recharge shields.
      • Armor: ship will prefer to keep facing to the enemy.
      • Speed: ship will prefer to change it's speed against firing.
      • Range: ship will prefer to get max range when it's not far enough, after that it will prefer to fire. Also, need to add an optimal range configuration for this.
      • No tanking priority: ship will prefer to fire (unnecessary, because of it's might be implemented as tanking priority: range with optimal range 100 m or about).

    • Retreat at (should be disabled for turrets): no retreat, enemy detection (will avoid any battle), reaching shield hp level, loosing shield, reaching armor level, loosing armor, reaching hull level and another.

    • Formation priority (should be disabled for turrets): 0 - closest to the front, 999 - farther from the front.
    Also, you can add role (default template) for ships: fighter, bomber, interceptor, damage receiver, damage dealer, support, carrier.
    For example:
    1. Fighter (anti-bomber small fast ship):
      • Target priority: closer, smaller, most damaging.
      • Action priority: fight.
      • Facing: front.
      • Tanking type: speed.
      • Retreat at: 10% of armor.
      • Formation priority: 1.
    2. Bomber (anti-capital small fast ship):
      • Target priority: bigger, slower, most damaging, most attacked, most damaged, "less shielder".
      • Action priority: fight.
      • Facing: front.
      • Tanking type: speed.
      • Retreat at: 20% of armor.
      • Formation priority: 5.
    3. Anti-air turret:
      • Target priority: closer, smaller, faster, most damaging.
      • Action priority: fight.
    4. Battleship (big ship without manual weapon, but with heavy turrets on it's sides or top):
      • Target priority: bigger, slower, most damaging, most attacked, most damaged, "less shielder".
      • Action priority: fight.
      • Facing: front.
      • Tanking type: shield, armor.
      • Retreat at: 20% of armor.
      • Formation priority: 15.
    5. Capital shield support turret:
      • Target priority: bigger, "less shielder", most attacked, slower.
      • Action priority: support.
    6. Drone shield support turret:
      • Target priority: faster, smaller, "less shielder".
      • Action priority: support.

    Every tick AI will update some code. User can code it as he want. And save template too.

    All may be the same as in variant 1, but target priority.

    Drone will use a method to choose target. Rule is easy: drone will attack entity with highest priority value. Priority value = getPriority(args);

    For default this method will be:
    int getPriority(Entity entity)
    {
    if(!isEnemy) return 0;//It mean that drone will not attack target if it is not enemy.

    if(isOutOfRange()) return 1;//It mean that drone don't want attack target if it is out of weapon's range. But it will attack it if here is no other enemies.

    if(isAlreadyAttacking()) return 100000;//If drone is already attacking, it will continue;

    return 100000/range;//Else it will attack closest enemy.

    }

    For example, bomber's code:

    int getPriority(Entity entity)
    {
    if(!isEnemy) return 0;
    int priority = 0;//Used to calculate

    priority = (10000/ (range + 3000)) * entityMass * (1.25 - entityShieldLevel) * (1.25 - entityArmorLevel) * (1.25 - entityHullLevel);//Will want to attack closest biggest and most damaged entity

    if(isAlreadyAttacking) priority *= 2;//If already attacking it, it will want to continue


    return priority;

    }

    //If range = 3000, mass = 50000, shields = 100%, armor and hull = 100%, result will be = 1302;
    //If range = 3000, mass = 50000, shields = 25%, armor and hull = 100%, result will be = 5213;
    //If range = 3000, mass = 50000, shields = 0%, armor = 50% and hull = 100%, result will be = 19531;
    //You can make a desicion
    //For example, bomber will not be interesting in attacking of light ships like:
    //Light ship 1: range = 3000, mass = 1000, shields = 0%, armor = 50% and hull = 100%, result will be = 390;
    //Light ship 2: range = 500, mass = 2000, shields = 0%, armor = 50% and hull = 100% result will be = 1399; As you can see 1399 is more than 1302, so bomber will choose to attack damaged medium ship against non-damaged heavy ship. It allows you to choose what you want.


    For example, fighter's code:

    int getPriority(Entity entity)
    {
    if(!isEnemy) return 0;
    int priority = 0;

    priority = (5000 / range) * (500/(abs(entityMass - 150) + 1) * (200 + entitySpeed);//Drone will want to attack fastest closest ship with mass closest to 150.

    if(isAlreadyAttacking) priority *= 10;

    return 0;
    }

    It will resolve: that big turrets/ships try to hit small and fast ships when they can't hit them. And some sort of irrational behavior of AI.

    What do you think about it?

    //Status: 60% done
    //TODO more detailed description of suggested configurations
     
    Last edited:
    • Like
    Reactions: Xskyth

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    We definitely need something for the AI. The placeholder stuff is getting old...
     
    Last edited:
    Joined
    Dec 3, 2016
    Messages
    93
    Reaction score
    7
    We definitely need something for the AI. The placeholder stuff is getting old...
    This suggestion is not finished yet. I made only suggestion for orders and navigation. It's different suggestion and don't touch AI management. Orders suggestion is not conflicting with your one. So you can say what do you think about orders. I think it's compatible with block suggestion too.

    We also can make a head thread to discuss about all AI suggestions.
     

    Edymnion

    Carebear Extraordinaire!
    Joined
    Mar 18, 2015
    Messages
    2,709
    Reaction score
    1,512
    • Purchased!
    • Thinking Positive Gold
    • Legacy Citizen 5
    This suggestion is not finished yet. I made only suggestion for orders and navigation. It's different suggestion and don't touch AI management. Orders suggestion is not conflicting with your one. So you can say what do you think about orders. I think it's compatible with block suggestion too.

    We also can make a head thread to discuss about all AI suggestions.
    I was referring to the AI in the game. It is a placeholder. It is just barely good enough to work as a test, because we're in early alpha and thats all that it needed to be to test other things with.

    Didn't mean anything about your post, I meant the placeholder AI in the game is getting old, it would be good to see anything that upgraded it.
     
    Joined
    Jun 13, 2013
    Messages
    16
    Reaction score
    5
    • Legacy Citizen 6
    • Legacy Citizen 5
    • Legacy Citizen 4
    I completely support the code idea; although a visual AI scripter would be great, too. I think they're definitely planning the fleet controls and whatnot. You only really touched on priorities in your post, but I think different functions and a wide variety of controls would really nice for AI customization. e.g;
    Code:
    initialise();
    
    function unloadWeapons()
    {
    for (i=1;i<self.weaponCount;i++)
       {
          weaponSelect(i)
          if (self.weapon(powerCons) >= self.power)
          {
             pressLMB();
          }
       }
    }
    
    if (get.FlagShip(selected) != null)
    {
    
       var target = get.FlagShip(selected);
    
       if (targetMass > 3000 )
       {
           face(target);
          unloadWeapons();
        }
    }
    else
    {
       approach(target);
    }

    You could even do stuff like formations using something like var right1 = fleet.rank(8); and then using get.right1(relativePosition) to maneuver yourself into position.

    Only problems I can see with this is;
    A. People are too lazy to learn the code
    B. People will make infinite loops that break the game.
     
    Last edited:
    Joined
    Dec 3, 2016
    Messages
    93
    Reaction score
    7
    I completely support the code idea; although a visual AI scripter would be great, too. I think they're definitely planning the fleet controls and whatnot. You only really touched on priorities in your post, but I think different functions and a wide variety of controls would really nice for AI customization. e.g;
    Code:
    initialise();
    
    function unloadWeapons()
    {
    for (i=1;i<self.weaponCount;i++)
       {
          weaponSelect(i)
          if (self.weapon(powerCons) >= self.power)
          {
             pressLMB();
          }
       }
    }
    
    if (get.FlagShip(selected) != null)
    {
    
       var target = get.FlagShip(selected);
    
       if (targetMass > 3000 )
       {
           face(target);
          unloadWeapons();
        }
    }
    else
    {
       approach(target);
    }

    You could even do stuff like formations using something like var right1 = fleet.rank(8); and then using get.right1(relativePosition) to maneuver yourself into position.

    Only problems I can see with this is;
    A. People are too lazy to learn the code
    B. People will make infinite loops that break the game.
    You can do everything using code. Formation idea is very big, but not a biggest idea that can be implemented using code.
    Solutions to fix this problems is easy as I think:
    A.
    • Lazy people can use code templates
    • They people can use constants without changing code
    • People can learn basics of coding. It will take 5-10 minutes (block logics is not easy too)
    B. It's easy to fix too:
    • AI code should be a "daemon" (background) thread that will not crash the game if it have an infinity loop.
    • If thread is not responding 50ms it will be stopped. We also can disable it's AI to prevent lags.
    • Add something-something-stuff to limitate the code. Players should to pay something to increase code. Loops should cost a lot. OR Disallow loops for AI.
    But block controlled AI is good too. I think that we should to test them both.
    [doublepost=1482338493,1482337908][/doublepost]
    I was referring to the AI in the game. It is a placeholder. It is just barely good enough to work as a test, because we're in early alpha and thats all that it needed to be to test other things with.

    Didn't mean anything about your post, I meant the placeholder AI in the game is getting old, it would be good to see anything that upgraded it.
    Agree. We can test both suggestions. But I think you should explain your suggestion a bit more for developers.
     

    NeonSturm

    StormMaker
    Joined
    Dec 31, 2013
    Messages
    5,110
    Reaction score
    617
    • Wired for Logic
    • Thinking Positive
    • Legacy Citizen 5
    Don't make it too complex in the UI - Try to separate config values from behaviour coding.

    evasion efficiency is hard to check (needs to watch for missed shots aimed at you, which isn't easy code-wise when you are not a locked target).
    if shield buff efficiency or activation would react on outgoing shots of the enemy ship, it could be op easily.
    maybe it's better to not have an AI for everything (performance, overpowered), but at least your own ships goals should be modifiable.
    Goals:
    desired move goal "target distance / max firing range": 70%
    desired evasion goal "capacitor charge / maximum": 30%

    The goal shouldn't be exact, but approached. with 20% or 50% capacitor charge, you could have 50% evasion usage on average.
    (on 50%, it would cycle like 0% 100% 0% 100% …)

    But however AI will improve, I recommend to separate code from configuration.