Station AI's are broken.

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

McLane wrote:
I have another issue with what you are describing. I don't think that Rock Hermits should launch police ships (purple blips) at all.

I would therefore vote for setting their max_police_ships to 0 and give them some variants of their usual mining ships (probably just ordinary Cobra 1 with the pirate/hunter-specs) as defense_ships.
I agree on that. I looks strange to have police defenders. For that reason we also choose not to have police defenders on the GRS station but only the custom ships. But there I do launch police ships from the planet surface on an attack. It takes them some time to arrive but at least that looks more realistic.

Setting max_police_ships won't work. Look at the wiki "how to AI" page under the link of launching ships. Internal there is just one counter for defence ships. When you launch police it is compared with max_police and when you launch defence it is compared with max_defence. This way you can't define both defence and police and increase the amount of defenders this way.
launchDefenseShips first looks for a defenseShip key than at a defenseShip role. Only if not present it chooses a police or interceptor as defender. So to not have police as defenders one just has to define a defenseShip role for the hermits.

One strange thing is that the default AI fir defenders is removed. With 1.65 the default police defenders launched with a policeInterceptAI. Now, with 1.72 they always inherit the AI from shipdata. For police that is the route1patrolAI. And that is the reason the police defenders not attack the target they launched with, but ignore everything and want to go to the witchpoint first. And that must also the reason they make a loop after launch and almost always hit the rock hermit. The removal of the default policeInterceptAI is a bug and should be placed in. For me I don't understand why it is removed as you than know for sure the police defenders launch a not working AI.

And this is also the reason why the main station police does not work since 1.71. They launch defense ships. I always wondered why they always launched with a gotoWaypointAI because that was not defined in a policeInterceptAI. Now it makes sense: They launch with a route1patrolAI. The first thing it detects is that the station is blocking the route to the witchpoint and goes into a waypointAI.

Please look into the 1.65 code how AI was assigned for default defenders. That was much better than now.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ark wrote:
Right now they are more like sitting ducks for the simple reason that they share almost the same AI with rock hermits (the only deference from the original rockhermit AI is that they use their EMC always)
They are sitting ducks and the weak defense is probably deliberately. Adding the one missing "fireECM" will cause this particular AI to hang. Leaving it out in one place was deliberate to prevent the AI hang.

For a real defense you need a complete different and more aggressive AI. The buoyRepair station has just a modification of a normal stationAI. When looking at the defense side of this script it still behaves the same. It does contain an additional script message that lets the JS script launch police from the surface. But that needs a distress message to be received by the station. Happens when you attack a trader of the buoy near the station.

ENERGY_LOW is already answered by thargoid. I can only add that it is send after every shot that does damage to a ship as long as the energy stays low.
Also in the socom Ai (Galactic Navy) I have seen that if it is attacked is launches 2 or more defenders by repeating the command “laungedefenceship”. Is this prudent?
Don't overdo the defender launches. A constore is not a military basis.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

Eric Walch wrote:
Don't overdo the defender launches. A constore is not a military basis.
I do not want this either. My main concern for the constore defense is to be balanced. Not to aggressive as the Secom base (it will probably ruin the build-in thargoid plans mission among others) but not to weak as the reockhermit one as the area near the witchpoint usually is dangerous. I just want to give it a fighting chance, something that is impossible with the modified rockhermit AI that Dr. Nil gave to them.
Thargoid, Eric thanks for your help :D
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

When you need a nice, non aggressive station Ai you could use:

Code: Select all

{
    GLOBAL = {ENTER = ("setStateTo: SCAN_DEBRIS"); }; 
    "SCAN_DEBRIS" = {
        ATTACKED = (setTargetToPrimaryAggressor, "setStateTo: DEFENSE_MODE"); 
        "INCOMING_MISSILE" = (fireECM, setTargetToPrimaryAggressor, "setStateTo: DEFENSE_MODE"); 
        "TARGET_FOUND" = (setTargetToFoundTarget, launchScavenger, "pauseAI: 20.0"); 
        UPDATE = (scanForLoot, "pauseAI: 20.0"); 
    }; 
    DEFENSE_MODE = {
        ATTACKED = (
            setTargetToPrimaryAggressor,  increaseAlertLevel, 
            groupAttackTarget,  launchDefenseShip,  "pauseAI: 10.0"
        ); 
        ENTER = (increaseAlertLevel); 
        "INCOMING_MISSILE" = (fireECM, increaseAlertLevel); 
        "RED_ALERT" = (launchDefenseShip, "pauseAI: 5.0"); 
        "YELLOW_ALERT" = (launchDefenseShip, "pauseAI: 5.0"); 
        "TARGET_DESTROYED" = ("setStateTo: IDLE"); 
        "TARGET_LOST" = ("setStateTo: IDLE"); 
        "TARGET_FOUND" = (setTargetToFoundTarget, groupAttackTarget, launchDefenseShip); 
        "NOTHING_FOUND" = ("setStateTo: IDLE"); 
        UPDATE = (scanForHostiles, "pauseAI: 10.0"); 
    }; 
    IDLE = {
        ATTACKED = (setTargetToPrimaryAggressor, "setStateTo: DEFENSE_MODE"); 
        "CONDITION_GREEN" = ("setStateTo: SCAN_DEBRIS"); 
        "GREEN_ALERT" = ("setStateTo: SCAN_DEBRIS"); 
        "ENERGY_FULL" = ("setStateTo: SCAN_DEBRIS"); 
        "INCOMING_MISSILE" = (fireECM, setTargetToPrimaryAggressor, "setStateTo: DEFENSE_MODE"); 
        UPDATE = ("pauseAI: 20.0", decreaseAlertLevel); 
    }; 
}
It loops in the debris scanning node. Only when attacked it goes in defence mode. And as long as there are hostiles present it will launch defenders. And as soon the other ship stops targeting the station, the script jumps in IDLE mode and after a cool down it start to look for debris. I think for a constore this will do nice. Its a variation of a new pirate_cove script I play with. But that one also has an active scanning state for traders.

Take note that scanForHostiles needs that ships have to target the station to be found. For a player that is enough, NPC ships must also be in attack mode. (Our brain is currently not attached to the computer so a script can not tell the players intentions when he targets something. I think a player is always regarded as hostile when he targets something.)
To make it even less defensive you can raise the pause in the update or remove the yellow_alert line.
Last edited by Eric Walch on Fri Jan 09, 2009 12:44 pm, edited 1 time in total.
User avatar
Ark
---- E L I T E ----
---- E L I T E ----
Posts: 664
Joined: Sun Dec 09, 2007 8:22 am
Location: Athens Greece

Post by Ark »

Thanks Eric!!!!!

Another quick question
Eric Walch wrote:
"Setting max_police_ships won't work. Look at the wiki "how to AI" page under the link of launching ships. Internal there is just one counter for defence ships. When you launch police it is compared with max_police and when you launch defence it is compared with max_defence. This way you can't define both defence and police and increase the amount of defenders this way"
When you press shift + h at a station under attack that has predefined defenders (not police) with just man_defence_ships = 4 in the shipdata you can see in the log maxpolice=4 and maxdefendships=4.
That is confusing and maybe the reason why Mclane said that. I was to confused by this double entry in the log :?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ark wrote:
When you press shift + h at a station under attack that has predefined defenders (not police) with just man_defence_ships = 4 in the shipdata you can see in the log maxpolice=4 and maxdefendships=4.
That is confusing and maybe the reason why Mclane said that. I was to confused by this double entry in the log :?
First I edited the above script. GLOBAL now jumps right (It jumped to the state I deleted for you variation)
Internal there is just one counter. But the max is different. e.g. when you define maxpolice=1 and maxdefendships=4 than the first launch can be both, but the second will only react on launchDefender commands. When the first launch was a defender, it cant launch a police as second.
But normally no problem as a script normally launches only one type.

But you could for instance define max_police 1 higher than max_defence. And launch a police in energy low conditions. That way, even when max defence is reached, the station can still launch a last police as backup!
Post Reply