Would it be possible to have an AI for NPCs that would follow a patrol route? what i'm thinking of is a list of waypoints in an array, simply a position using whatever Oolite format (WSP etc) and a speed as a % of the ship's top speed, and a variable to loop or not, so the ship would stop at the end of the list, or be able to fly circuits etc. (Viper patrol around a planet, say).
. this could open stuff up for eye candy ship/mission OXPs ~ you could have ships heading out to a station etc on a path none of the existing AIs incorporate.
Autopilot AI
Moderators: winston, another_commander
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
Total Patrol OXP sort-of does that for police Vipers:
http://wiki.alioth.net/index.php/Total_patrol_OXP
http://wiki.alioth.net/index.php/Total_patrol_OXP
- Commander McLane
- ---- 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:
Total patrol is only an extension of the usual police AI, so don't bother with it.
Instead have a look at cataclysm_militaryAI.plist from (you guessed it) Cataclysm.oxp. It is a patrol AI with 12 pre-defined waypoints, which sends ships along the lines between these waypoints, and randomly choose another waypoint to go to whenever they reached their destination. It also allows for them to break up course and attack, if necessary. It's basically exactly what you want. You only have to replace the waypoint co-ordinates with whatever suits you (SHIFT-F in game is your friend here; that's how I determined the co-ordinates in the AI).
Or you could have a look at the AI of the Tionisla Orbital Graveyard patrol ships. I guess it will be similar.
Instead have a look at cataclysm_militaryAI.plist from (you guessed it) Cataclysm.oxp. It is a patrol AI with 12 pre-defined waypoints, which sends ships along the lines between these waypoints, and randomly choose another waypoint to go to whenever they reached their destination. It also allows for them to break up course and attack, if necessary. It's basically exactly what you want. You only have to replace the waypoint co-ordinates with whatever suits you (SHIFT-F in game is your friend here; that's how I determined the co-ordinates in the AI).
Or you could have a look at the AI of the Tionisla Orbital Graveyard patrol ships. I guess it will be similar.
- Killer Wolf
- ---- E L I T E ----
- Posts: 2278
- Joined: Tue Jan 02, 2007 12:38 pm
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: Autopilot AI
There are plenty AI scripts out there doing such things. From the older ones: Tianve.oxp or Tionisla Graveyard.oxp. Both have patrol ships along special routes. In this old stuff the route is hardcoded in the AI. Since 1.74 a JS script can also set coordinates. With JS it becomes possible to calculate coordinates. One example is the control ship in buoy repair.oxp. Its AI starts as:Killer Wolf wrote:Would it be possible to have an AI for NPCs that would follow a patrol route? what i'm thinking of is a list of waypoints in an array,
Code: Select all
GLOBAL = {
ENTER = (switchLightsOff, "setStateTo: NEXT_COORDS", "pauseAI: 5.0");
};
"NEXT_COORDS" = {
"APPROACH_COORDINATES" = (setDestinationFromCoordinates, "setStateTo: GO_TO_COORDS", switchLightsOff);
"END_CONTROL" = ("setStateTo: EXIT_SYSTEM");
UPDATE = ("sendScriptMessage: nextPosition", "setDesiredRangeTo: 10.0", "setSpeedTo: 0");
};
"GO_TO_COORDS" = {
ENTER = (performFaceDestination);
"FACING_DESTINATION" = ("setSpeedTo: 60", performFlyToRangeFromDestination);
"DESIRED_RANGE_ACHIEVED" = (performStop, switchLightsOn, "setStateTo: GET_TARGET");
"END_CONTROL" = ("setStateTo: EXIT_SYSTEM");
ATTACKED = (setTargetToPrimaryAggressor, "setAITo: interceptAI.plist");
RESTARTED = ("setStateTo: EXIT_SYSTEM");
STOP = (performStop);
"ENERGY_FULL" = (performFaceDestination);
};
NB the current release sets coordinates on a more complex way that worked already with 1.72, but the next release will use the easy 1.74 way to set coordinates with JS.
UPS-Courier & DeepSpacePirates & others at the box and some older versions