Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Old AI bugs

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

Old AI bugs

Post by Eric Walch »

I was playing with the behemoth AI to improve it when I found bugs inside the original Oolite AI's. With version 1.65 Giles made a lot of improvements in his AI routines. e.g old route1traders just rammed anything on their course and the 1.65 routine makes nice evasive movements. you very good see this if you place yourself in the way. Traders than move away.

The old Behemoth and also the route1Patrol didn't do it so I changed the code that the Behemoth also avoided ramming (with the checkCourse command). The behemoth had also a bug that if you were fugitive you could stop him with a request for docking. He did refuse, but still initiated a stop. With a extra check he now just goes on attacking you. if you were fugitive.

By the way, it was yesterday the first time I attacked a Behemoth. It was a wimpy, I shot him in pieces within a moment and he just fled. (Although he was in the attack state according to the log). With the improvements (AI only) he grew a little stronger. Anyone who knows the author, it is not enclosed in the documents.

But to the bugs. Giles took lots of routines out of the AI's and gave them a separate file as AI. One of them was the receiveDockingAI. But in the route1PatrolAI there are two references to the old DOCKING_PLANET and DOCKING_WITCHPOINT states which are deleted in he actual version. This should be "setAITo: receivingDockingAI.plist". It only happens in the states where he is looking for loot. (=escape capsules with police).

An other bug is in the escortAI. At the end there is a command: "setStateMachine: route1PatrolAI.plist". That should be "switchAITo: route1PatrolAI.plist". setStateMachine it not a legal AI command but a C routine. I was surprised that it stil worked though.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

It would be nice if you send all corrected/improved original AIs to Ahruman, so he can include them in the next release.

Behemoth.oxp was written by nobody else than the Master and Commander himself. In my version (behemoth-v2.3) this is clearly stated in the readMe-file.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Aegidian was the original author of the Behemoth.OXP.

You can check oosat1(and sometimes2) for referencing authors.
Unfortunately the wiki-oxp list does not credit authors.
Riding the Rocket!
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2869
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

A_H wrote:-
Unfortunately the wiki-oxp list does not credit authors.
It will do eventually, as I'm slowly getting round to adding a wiki page for each OXP. Thargoid Wars, Military, Navy Station, HoOpy Casino, Aegidian's Special and X-ships currently have a page. (As do my own Assassins and Asteroid Storm OXPs). The page desribes what the OXP does in more detail (taken from the authors readme) and credits the author(s). Its a long job though, so if a few peeps want to do some wiki cataloging it would help! :wink:
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Make a nice template, complete with possible screenshot-slots.
I'll considder it.
Riding the Rocket!
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2869
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

If you check the Assassins page, that'd probabley do as a template and it has screenshot slots.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
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 »

It was even worse with the Behemoth AI's. His fighters have a dockingAI that was probably an altered copy of the old station dockingAI. Some of the docking and approach responses he uses don't exist (anymore). I copied the new 1.65 dockingAI.plist and added some code to scan for offenders so the patrols abort their waiting for docking if they spot a new target.
The Behemoth now waits when in docking procedure unless he is targeted himself.

As far I can see the docking of the fighters goes faster now.
McLaine wrote:
Behemoth.oxp was written by nobody else than the Master and Commander himself. In my version (behemoth-v2.3) this is clearly stated in the readMe-file.
I looked at the wiki and downloaded that link. It also gives no version and author. But it is a year newer than mine. It dates from 23 august 2006. My version had only one behemoth and the script placed one at the witchpoint. This script places only behemoths at interstellar place. The ones in normal space are always added in a hole as hunter. Also the minimum version is raised to 1.65.

But the AI still sucks. It is the same old one without the Oolite 1.65 improvements. So the fighters will never react on al the possible messages of the mother on docking.

The results "APPROACH_START" and "APPROACH_STATION" don't exist in Oolite 1.65 or newer.

Code: Select all

 
        "APPROACH_START" = ("setStateTo: GO_TO_START"); 
        "APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS"); 
        "APPROACH_STATION" = ("setStateTo: GO_TO_STATION"); 
        "HOLD_POSITION" = (performIdle, "pauseAI: 10.0", "setStateTo: GLOBAL"); 
        "DOCKING_ABORTED" = ("setStateTo: ABORT"); 
        "TRY_AGAIN_LATER" = ("pauseAI: 30.0", "setStateTo: ABORT"); 
        "COLLISION" = ("setStateTo: ABORT"); 
In the current oolite docking procedure these lines are now replaced by:

Code: Select all

 
        "APPROACH" = ("setStateTo: APPROACH"); 
        "APPROACH_COORDINATES" = ("setStateTo: GO_TO_COORDS"); 
        "BACK_OFF" = ("setStateTo: RETREAT"); 
        "HOLD_POSITION" = ("setStateTo: STATIONKEEPING"); 
        "DOCKING_ABORTED" = ("setStateTo: ABORT"); 
        "TRY_AGAIN_LATER" = ("pauseAI: 30.0", "setStateTo: ABORT"); 
        "COLLISION" = ("setStateTo: ABORT"); 
        "RESTART_DOCKING" = ("setStateTo: GLOBAL"); 
        DOCKED = ("setStateTo: EXIT_SYSTEM"); 
I'll see what to do. Maybe only put the improved AI on the WIKI? Not my work, as is mainly copied from the current routines.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

I always assumed those waypoint etc messages were correct and working.
Riding the Rocket!
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 »

I always assumed those waypoint etc messages were correct and working.
They work of course. But in oolite version 1.65 station handling is "improved". it just cann't handle all exeptions. But maybe they are rare. BACK_OFF seems new.

Still complicated to see how things work in detail.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

yeah I remember trying to make sense of how the AIs worked...took me a while of plotting all possible paths and methods. especially in those using waypoints (which are(were?) not documented anywhere)
Riding the Rocket!
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 »

I always assumed those waypoint etc messages were correct and working.
They work of course. But in oolite version 1.65 station handling is "improved". it just cann't handle all exeptions. But maybe they are rare. BACK_OFF seems new.
I figured things out and uploaded the effect of the requestDockinCoordinates to the wiki in the "OXP howto AI".

What the behemoth AI is also not doing well is the abortDocking command. He uses it in one place to ask for the abort coordinates, but if fighters are attacked they break the docking procedure without issuing the abortDocking. The mothership is now waiting forever untill the return. Problem with this is, that if the fighter dies the mother keep waiting indefinitely for its child. The same have I seen when a fighter crashes while docking. The mother keeps waiting. But in combat the changes of getting killed are much larger.

In my opinion this is also a omission in the program. Killed ships should also be canceled from docking waiting lists. But there is a solution. I tried putting "abortDocking" in the death_actions of the fighters. It seemed to work. This time when fighter one crashed in the docking procedures, the behemoth fly away after the last docking. So one should put a abortDocking in death_actions of dockable fighters.

I'll update this in the Wiki soon in the same document as the requestDockinCoordinates.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

Some new AI bugs -maybe-

I recently installed several OXPs, plus I have 60000+ trumbles crawling around, so that may have some influence too.

Problem: slow AI response.
step1: shoot unsuspecting target.
step2: It will launch missile immediately, if available.
step3: the target will remain yellow and ignore you.
step4: after several seconds, it cries out in alarm and turns red.
Riding the Rocket!
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 »

An other bug in the Oolite AI files. This time I stumbled over a bug in the original dockingAI.plist that really could course ships crashing into the station. And the AI has been the same since at least version 1.55.

To understand the bug, first something about docking works. (see also Docking Instructions on the Wiki, I just wrote).

First the C code: When a ship is asking for docking, the station first checks if the ship is with the range of 1000 to 12,500 km. If yes it starts sending coordinates. If not it is either it is to far away or to close. In the last cases is sends APPROACH or BACK_OFF to the ship with destination coordinates. It stroke me that in both cases it sends the coordinates of the station itself. In case of tho close this must be wrong.
Normally the AI does not need setting of a destination as the docking computer does it for him. But if you look at the RETREAT and the APPROACH states they are the same. Also these two override the computer settings and set again the destination to the station.

This has as effect that if the dockingAI.plist is started at the moment a ship is within 1000 meters of the station, the dockingAI will send the ship in a crash course to the station. You can check it yourself with your docking computer that uses the same dockigAI.plist. When you are within 1000 meter of the outside of a corriolis station (within 1700 meters from the center as indicated on you screen), and you start computer docking your ship will be send in a crashing course.

There is a solution as the AI can also ask for DockingAbort coordinates. These are calculated in a way you never hit the station. So changing the first two lines of the old into the first three lines of the new will solve the problem. You can check this yourself. Copy the AI from within Oolite into an existing OXP. Then replace the old retreat state by the new one. When you start the docking computers close to the station, he will first guide you away and than start docking.

This could be one potential course of crashes with NPC ships, altho starting this dockingAI.pilst that close to the station will be very rate.

Original code

Code: Select all

    RETREAT = {
        ENTER = (recallDockingInstructions, setTargetToStation, setDestinationToTarget, "setSpeedFactorTo: 0.5", "setDesiredRangeTo: 5000.0", performFlyToRangeFromDestination); 
        "DESIRED_RANGE_ACHIEVED" = (requestDockingCoordinates, "setStateTo: AWAIT_COORDS"); 
        "DOCKING_ABORTED" = ("setStateTo: ABORT"); 
        "COLLISION" = ("setStateTo: ABORT"); 
        "RESTART_DOCKING" = ("setStateTo: GLOBAL"); 
        EXIT = (); 
        UPDATE = (); 
    }; 
Improved code

Code: Select all

    RETREAT = {
        ENTER = (recallDockingInstructions, "setSpeedTo: 0.0", setDestinationToDockingAbort, performFaceDestination); 
        "FACING_DESTINATION" =  ("setSpeedFactorTo: 1.0", "setDesiredRangeTo: 500.0", performFlyToRangeFromDestination); 
        "DESIRED_RANGE_ACHIEVED" = ("setSpeedTo: 0.0", requestDockingCoordinates, "setStateTo: AWAIT_COORDS"); 
        "DOCKING_ABORTED" = ("setStateTo: ABORT"); 
        "COLLISION" = ("setStateTo: ABORT"); 
        "RESTART_DOCKING" = ("setStateTo: GLOBAL"); 
        EXIT = (); 
        UPDATE = (); 
    }; 

The whole thing started with debugging of the Behemoth docking routines. One of them was that defenseships farther away than 12500 meters never started a approach. A further thing was that he always was overruling the variable range given by the docking computer with a fixed 50 meters. This way he constantly overshoot the target destination on his way to the docking bay. A new AI version is excellent working with me and will be uploaded in a way soon. Also the Dredger is using the same routines. And there are possible more carrier-ships that could use them in the future.
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 »

While testing the dockingAI.plist I put a lot off commsmessages in it for debugging purposes. One was in the enter part of the second state. This message showed op in the startupscreen os Oolite 1.65. I don't know why this AI was run on startup?
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

saw a cobra3 trader hanging around close to the sttion a few days ago, thought this was odd and checked it's AIstate. It appeared to be stuck in the STANDOFF state.
It did not make a move, the cause may have been collision avoidance. which IIRC Ahruman has recently improved. (or was that fixed in next version?)

In the same session I also noticed that the player-entity also had dockingAI.plist as it's AI.(in Eagis) This may have something to do with it being run when a game is loaded.
Riding the Rocket!
Post Reply