Page 1 of 2

AI Probs.

Posted: Sat Nov 14, 2009 1:19 pm
by Killer Wolf
Hi all. got some odd things happening when testing my Dominatrix.

Firstly, what happened to "hunter.plist" for the AI? i've got it for my Isis Vampires and it's not in my Config folder now :-/

anyway, finding that, i've instead been using a script Griff gave me w/ his example ships : this was to attack the station when i launched. this is his AI, but i've changed the "scan for ship having role" bit to "example", which is his ship type, in order to get my ship to attack them to try and get some good screen grabs.

{
"ATTACK_SHIP" = {
ENTER = (performAttack);
"ATTACKED" = (setTargetToPrimaryAggressor);
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"TARGET_DESTROYED" = ("setStateTo: LOOK_FOR_TARGETS");
"TARGET_LOST" = ("setStateTo: LOOK_FOR_TARGETS");
EXIT = ();
UPDATE = (performAttack);
};

"LOOK_FOR_TARGETS" = {
ENTER = ("setDesiredRangeTo: 45.0", "scanForNearestShipHavingRole: example");
"ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP");
"NOTHING_FOUND" = (performIdle);
EXIT = ();
UPDATE = ();
};

GLOBAL = {
ENTER = ("setStateTo: LOOK_FOR_TARGETS");
EXIT = ();
UPDATE = ();
};
}

i also amended this script for the Example ships, to look for my Dominatrixes, so i'd get a big dogfight going....that was the theory.

- when his ships used the stock script, they attacked the station fine.
- when i spawn my ships, and use this script for his ships to hunt mine, they do nowt, wandering listlessly around.
- using this script to hunt his, my ships go absofrickinglutely MENTAL. they attack the ships, but they're flitting around like moths on speed, doing repeated loops to get a firing line. the spec is about comparable w/ the Viper Interceptor, so i'm not using anything too uber, i'd say. his ships, though not close to mine in spec, were far more typical in performance, strafing the station etc and dogfighting w/ the cops.

so :-
- does anyone know why my ships are going scatty?
- why's the hunter.plist gone? my Isis Reaper will now not work. i considered a bounty hunter-specific AI worthy, i'm surprised it's vanished :-/

related to that vanishing, is another oddity : scanning the available AIs, i gave my Doms the route1patrolAI instead. The prob is now they just wander about. i've tried firing on them to provoke a reaction, but 99/100 they just ignore me. i got a bit of a twitch when i launched a missile at one, but a quick ECM and she was back on her way ignoring my laser fire.

cheers....

Posted: Sat Nov 14, 2009 1:30 pm
by Kaks
No idea I think I know why your ships are going scatty:

can you change the performIdle to performTumble? It might well be that performIdle is your problem there.
I'd do

UPDATE = ("scanForNearestShipHavingRole: example");

Also, I'd spawn the 'example' ship before the 'hunters' to see what happens.

The standard AI for hunters is route1patrolAI.plist now, & I think it's been the case for quite some time.

Eric would definitely know a lot more about all this than me, though!

Re: AI Probs.

Posted: Sat Nov 14, 2009 1:42 pm
by JensAyton
Killer Wolf wrote:
Firstly, what happened to "hunter.plist" for the AI? i've got it for my Isis Vampires and it's not in my Config folder now :-/
I’ve seen a few OXPs referencing hunterAI.plist, but as far as I’m aware that has never been a standard AI. It certainly isn’t in 1.65 or 1.40, and it isn’t on the updater’s list of files to delete.

Re: AI Probs.

Posted: Sat Nov 14, 2009 2:34 pm
by Eric Walch
Killer Wolf wrote:
- using this script to hunt his, my ships go absofrickinglutely MENTAL. they attack the ships, but they're flitting around like moths on speed, doing repeated loops to get a firing line. the spec is about comparable w/ the Viper Interceptor, so i'm not using anything too uber, i'd say. his ships, though not close to mine in spec, were far more typical in performance, strafing the station etc and dogfighting w/ the cops.

so :-
- does anyone know why my ships are going scatty?
Most likely it is because "performAttack" is used in update. performAttack starts a selection process that than chooses one of the attack methods. By using it in UPDATE without any pause, the attack process is restarted every 0.125 seconds. So it never finds time to finish anything. :(
setting it once in ENTER is enough.

And setting a range before a scanForNearestShipHavingRole is useless. It will be ignored. The ship will only use the scanner_range defined in shipdata

Posted: Sat Nov 14, 2009 3:54 pm
by Killer Wolf
thanks for all the replies guys. it's not too much of a prob for me in the finished OXP, i ws just using the scripts and AI to test, but i thought i'd check in case the scatty behaviour was something quirky w/ the code.

It's a shame "hunter" seems to be some mythical AI ~ the description said it basically roamed about and attacked anything w/ a bounty, which seems a pretty good AI to have for FdL etc.

Posted: Sat Nov 14, 2009 7:04 pm
by Eric Walch
Killer Wolf wrote:
It's a shame "hunter" seems to be some mythical AI ~ the description said it basically roamed about and attacked anything w/ a bounty, which seems a pretty good AI to have for FdL etc.
As Kaks writes, all current hunters use the route1patrolAI. This is at least since Oolite 1.40 the case. Probably always.

Both police and hunters just scan for ships with bounty and attack them when found. Police has just some extra privileges because of its scanclass. However, there is a big BUT with route1patrolAI. The command that must find ships with bounties contains a random factor, to prevent all police and hunters going after a player with just 1 point worth of bounty.
Then you need a ship that jumps for every bounty, no matter how small, you must write your own scan routine in JS

Posted: Sat Nov 14, 2009 8:02 pm
by JensAyton
Killer Wolf wrote:
It's a shame "hunter" seems to be some mythical AI ~ the description said it basically roamed about and attacked anything w/ a bounty, which seems a pretty good AI to have for FdL etc.
This describes the hunter role. There is no specific hunter AI.

Posted: Sun Nov 15, 2009 8:16 am
by Killer Wolf
Ahruman wrote:
Killer Wolf wrote:
It's a shame "hunter" seems to be some mythical AI ~ the description said it basically roamed about and attacked anything w/ a bounty, which seems a pretty good AI to have for FdL etc.
This describes the hunter role. There is no specific hunter AI.
yeah, we established that, i was saying a no-nonsense bounty-hunter-specific AI might be a good addition to the collection. from what i can understand of the Route1PatrolAI, used by default as Kaks/Eric says, thre's a few bits just not relevant to non-police craft. a bounty hunter AI that went after ANY ship w/ a bounty (or the highest bounty of the ones it scans) might make the game more interesting, is all i was saying.

makes me wonder what my original Reaper Vampires were using tho : i've got them set to use the hunter.plist as AI. when i tried that w/ my Dominatrix she just hung dead, presumably because she had no valid AI to control her, but when i've been playing Oolite in the past i've seen a couple of Reapers trawling about the space lanes.

Posted: Mon Nov 16, 2009 8:17 am
by Commander McLane
I don't think it makes much sense to make a hunter attack everything with a bounty on sight. It would make for a much too nervous ship IMO. The Personalities ships with a hunter characteristics have a random factor built into their ship scripts, which lets them attack only with a certain probability. The effect is a smoother behaviour.

Another factor you have to take into account for ships which are supposed to attack other ships is their fuel. If they have injectors, they shouldn't have too much of it, because it tends to make them fly around high-speed like crazy, but as a result they hardly fire any shots.

Posted: Mon Nov 16, 2009 10:28 am
by Killer Wolf
i get your point, but given bounty hunters kind make their living from killing ships, then i'd think any ship w/ a bounty WOULD be a target. maybe setting a default of say 10cr (or whatever) would limit things, but beyond that you're in trouble, unless there's a higher bountied ship in the area which would attract the BH's attention first.

How exactly is the fuel attribute used? my Dominatrix currently uses values around the stuff that's existing for the Viper Interceptors etc, but when it says eg "fuel 100", 100 what? Seconds-worth of injection burn?

Posted: Mon Nov 16, 2009 11:00 am
by Commander McLane
Basically the fuel value refers to LYs, of course. So the default of 70 means a travel distance of 7.0 LYs. (And before anybody asks: No, you cannot extend the range of NPCs by giving them more fuel. The 7 LYs are double-checked by the code.)

But while using injectors, I think they translate roughly into something like 70 seconds of injector speed. However, it seems that the amount of available fuel also influences the AI engine's decision whether to use injectors in the first place. If there's plenty of fuel, the NPC goes into a mad frenzy right away; if there is less fuel, it seems to be much more cautious.

Also the NPC fuel consumption seem different to the player. NPCs consume fuel with the same steady rate of about one unit per second, as long as their current speed is above their usual max_speed, regardless of how much it is above their max_speed. So the commands setSpeedFactorTo: 1.01 and setSpeedFactorTo: 7 both cause an NPC to burn witchfuel at the same rate. However, it takes much longer to accelerate to the higher factor, and decelerate again. And during the whole time fuel is consumed.

Note also that JS fuel property uses full LY, while the shipdata fuel key uses tenths of LY. So

Code: Select all

     <key>fuel</key>
     <integer>70</integer>
in shipdata is the same as

Code: Select all

     this.ship.fuel = 7
in a JS script.

Posted: Mon Nov 16, 2009 12:01 pm
by Eric Walch
Commander McLane wrote:
Also the NPC fuel consumption seem different to the player. NPCs consume fuel with the same steady rate of about one unit per second, as long as their current speed is above their usual max_speed, regardless of how much it is above their max_speed. So the commands setSpeedFactorTo: 1.01 and setSpeedFactorTo: 7 both cause an NPC to burn witchfuel at the same rate. However, it takes much longer to accelerate to the higher factor, and decelerate again. And during the whole time fuel is consumed.
Starting with 1.74, npc ships will no longer use fuel during the deceleration period. It is not logic. Or at least not consequent, as the player never did use fuel on deceleration. The player only uses fuel when pressing i. This now also applies to npc ships

(With Newtonian physics acceleration and deceleration do use the same amount, but under Newtonian laws no fuel is used while flying stationary on a high speedfactor)

Posted: Mon Nov 16, 2009 1:58 pm
by Screet
Commander McLane wrote:
Also the NPC fuel consumption seem different to the player. NPCs consume fuel with the same steady rate of about one unit per second, as long as their current speed is above their usual max_speed, regardless of how much it is above their max_speed. So the commands setSpeedFactorTo: 1.01 and setSpeedFactorTo: 7 both cause an NPC to burn witchfuel at the same rate. However, it takes much longer to accelerate to the higher factor, and decelerate again. And during the whole time fuel is consumed.
Would it not be fun to use the speed setting with a multiplier on injectors, thus also giving the player the ability to select a specific speed on injectors?

Furthermore, I think it would be logical to use different fuel consumption for different injector speeds, like with different after burner settings for modern aircraft.

Screet

Posted: Mon Nov 16, 2009 2:11 pm
by DaddyHoggy
Screet wrote:
Commander McLane wrote:
Also the NPC fuel consumption seem different to the player. NPCs consume fuel with the same steady rate of about one unit per second, as long as their current speed is above their usual max_speed, regardless of how much it is above their max_speed. So the commands setSpeedFactorTo: 1.01 and setSpeedFactorTo: 7 both cause an NPC to burn witchfuel at the same rate. However, it takes much longer to accelerate to the higher factor, and decelerate again. And during the whole time fuel is consumed.
Would it not be fun to use the speed setting with a multiplier on injectors, thus also giving the player the ability to select a specific speed on injectors?

Furthermore, I think it would be logical to use different fuel consumption for different injector speeds, like with different after burner settings for modern aircraft.

Screet
I can think of quite a few fighter jets where Afterburners = pour in fuel as fast the engine can take it - there's no control - just on or off.

A trial (before I left the MOD) with Eurofighter/Typhoon was very cool - it has a clean top speed in excess of Mach 1 - so all the US aircraft had to keep blipping their afterburners to keep up (they'd then rip past of course) but they used up a lot of fuel and always needed refueling before the Typhoon did...

Posted: Mon Nov 16, 2009 2:27 pm
by Eric Walch
DaddyHoggy wrote:
I can think of quite a few fighter jets where Afterburners = pour in fuel as fast the engine can take it - there's no control - just on or off.
Even worse.... The solid fuel rockets of the space shuttle have only an on-switch. Once ignited, they don't stop before there is no fuel left. Its almost the same fuel mixture as some of the propelling fuel in fireworks that we use at silvester. (Aluminium powder with amonium(per)chlorate)

And to some extend this effect was happening in the old situation because of the slow deceleration rate and high starting speed, npc often burned all their fuel during the deceleration on their first flee.