Question AI

_Designer_

New member
Joined
Oct 6, 2011
Messages
87
Reaction score
0
Points
0
Location
Playas de Tijuana
Has anyone ever tried to have an AI craft be randomly flying across Orbiter? I want to try and make an AI for some patrol aircraft on my project and was looking to see if anyone has done it yet? since I am so new to Orbiter I do not know what else I need besides knowing mesh, textures and c++
 
Check out:

  • [ame="http://www.orbithangar.com/searchid.php?ID=1468"]Autopilot 1.72 with AIRAC and worldwide Airports[/ame]
  • [ame="http://www.orbithangar.com/searchid.php?ID=2132"]Scheduled Moon Flights (AP)[/ame]
 
Might as well drop an update on OBSP autopilots and AI while we're at it.

For the last two years, my job at OBSP has been the development of autopilots. Flying from place to place, flying in formation, bombing a target, launching missiles at ground targets or dogfighting. While every autopilot is a limited decision making process of its own, it's only bound to its own job. It won't think about anything else. These are so called instructions in the instruction queue. They resemble a robot that will do what the owner tells it to, but won't decide what to do on its own.

But a week ago, OBSP finally got its feet into the ocean of artificial intelligence. For now very limited - if a missile is fired at a plane, the plane will no longer just fly as it was before, it will turn into a direction that makes it tough for the missile to track and hit and it will start deploying countermeasures. The behavior I described is again an instruction, but the AI adds it.

What will the future bring?
I have three types of AIs in mind. The unit AI, the squad AI and the team AI. The unit AI will be like the brain of a soldier - a pilot in a vessel. The pilot will take care of himself and communicate to the squad leader. The squad AI will be like the squad leader. The leader executes the plans given by the team AI - the general.

In order to make it work without multiplayer, all of the AIs will need to be created. As a "civilian" offshoot to the autopilots, I have in mind stuff like air traffic control. I'll need it for OBSP anyway, to organize the mess around military airports. I intend to make it so that airbases such as Ascension Island come alive, with planes and rockets flying around :)


I think that's enough for a spoiler for now :P
 
so a basic AP is just a weak AI, it does as its told

but having ANOTHER automatic process to feed these instructions, gives you the basis for an AI

taking the combat example from RF
if a vessel is flying in formation, and it detects that a missile is fired at it, it recieves this as an instruction, to turn away in such a manner as to avoid the missile
in the same way, you could program any vessel to do the same:

if you want some small aircraft to fly around your airbase, you just put it at a suitable runway, tellit how to take off, then instruct it to do so, then use a chain of commands (which could include programmed waypoints) to change heading, altitude speed etc

however, lets not forget that we have problems:
time acceleration:
if you increase your time accel to 1000x from orbit, to get closer to your de-orbit, all the craft in the atmosphere may crash, since their control surfaces and throttle become locked for 1000 timesteps at normal time

not to mention them getting in the way (though they wont stop you without collision detection)

personally, i think it needs some special coding to control it, to make sure that they fly realistically and that they actually fly!

you could still use the AI to go to orbit, as long as the AI can understand the craft, or have a working sub-autopilot to launch/re-enter it, which could require a fair amount of code (as much as a launchMFD, glideslopeMFD, basesyncMFD PLUS the code to control the craft, it makes it a very CPU intensive addon)

and you wont really need mesh/texture knowledge, you can use existing models (like the stock DG, or borrowing other people's aircraft meshes (with permission of course)
 
so a basic AP is just a weak AI, it does as its told

but having ANOTHER automatic process to feed these instructions, gives you the basis for an AI

taking the combat example from RF
if a vessel is flying in formation, and it detects that a missile is fired at it, it recieves this as an instruction, to turn away in such a manner as to avoid the missile

Exactly. While the autopilots have a limited decision making process, they're not the brain. You need a separate system to hand out instructions.


in the same way, you could program any vessel to do the same:

if you want some small aircraft to fly around your airbase, you just put it at a suitable runway, tellit how to take off, then instruct it to do so, then use a chain of commands (which could include programmed waypoints) to change heading, altitude speed etc

OBSP already supports flying waypoints. The upcoming release of OBSP will contain scenarios where vessels fly a predetermined path. The goal of the AI is to choose the path without any intervention of the user. You want the vessels to pick your own destination, ask for clearance to taxi and take off, fly to their destination, ask for clearance to land and then land.


however, lets not forget that we have problems:
time acceleration:
if you increase your time accel to 1000x from orbit, to get closer to your de-orbit, all the craft in the atmosphere may crash, since their control surfaces and throttle become locked for 1000 timesteps at normal time

not to mention them getting in the way (though they wont stop you without collision detection)

Well, thanks to escapetomsfate, OBSP has a basic high speed collision detection. We've successfully tested a head on on-orbit collision at 100 x time acceleration. Of course, we collide a simple sphere and nothing as complex as Artlav was able to do. Instead of iterating through each step, we basically figure out if the vessels, flying from previous frame to this one were ever close enough to touch.

As for the autopilot time acceleration... indeed having atmospheric autopilots at high time acceleration is a problem. I've recently made some improvements to my underlying control functions that allow planes to execute all autopilots successfully even at 10x time acceleration (but only tested at above 50 FPS), however, I'll never be able to push it to 100x no matter how hard I try. I'm actually not aware of any games that can do their autopilots at high time compression. The most I've seen was X3 with something like 10 or 12, but even at those compression ratios, the autopilots get dodgy.

One possible solution would be to let the autopilots drop what they're doing and just fly in a straight line with as low speed and thrust as possible. Flying in a line requires no corrections and I'm hoping I can make my control functions accurate enough to survive 100x for that.

Even so, Orbiter's atmospheric model doesn't like high compression...

The simple solution is to limit the time compression (so users don't cause autopilots crashing because they press t out of habit) and have an override available, for when you really do want to go to high warp...


personally, i think it needs some special coding to control it, to make sure that they fly realistically and that they actually fly!

you could still use the AI to go to orbit, as long as the AI can understand the craft, or have a working sub-autopilot to launch/re-enter it, which could require a fair amount of code (as much as a launchMFD, glideslopeMFD, basesyncMFD PLUS the code to control the craft, it makes it a very CPU intensive addon)

and you wont really need mesh/texture knowledge, you can use existing models (like the stock DG, or borrowing other people's aircraft meshes (with permission of course)

The goal of OBSP is to allow all existing vessels to participate in combat to a limited extent. Every vessel should be able to fly and fire weapons, but they'll have trouble landing because not every vessel has a different way to deploy landing gear. For this, OBSP is working up a standard, so that addon developers to program their vessels in a way that the autopilots could access the special features. This implementation will be done via VESSEL3::clbkGeneric to minimize impact on each developer.

In addition to making all existing vessels combat capable, OBSP will also have its own vehicles. In the short term, we're looking at augmenting the combat version of the DeltaGlider called the Combat Cow. The ultimate goal is to create a generic vessel class with predefined selection of 2D panels, 3D cockpits, electrical and weapon systems and so on. We need it for OBSP to quickly create a large number of vessels, but we'll also make it available to the community as a .h and .lib that will make developing C++ vessels a lot easier for beginners. Instead of having to create panels themselves, they'll call a function inside the generic vessel and just like magic, the panels would appear in a ship.
That's distant future though. Since nobody volunteered to help us out with that side project, it means development will be going slower...
 
Last edited:
Hey, if I could code, I'd be all over this. As it is, I can barely make SC3 files and meshes.
Maybe in the future when I'm not pulling 16 units in college and working weekends...:P
Looking good so far, though. I can't wait to see the final result.:cheers:
 
what i meant about the huge code, was that if you wanted the AI spacecraft to go to the ISS, you'd need them to be able to work out plane misalignment for orbital syncing, then the actual orbital syncing itself, then basesync and aerobrake to get back to earth, so the amount of code would be ludicrous

of course, just getting them to fly in the atmosphere is much simpler, because there's no orbital mechanics :P
 
Back when EscapeTomsFate first offered up for testers, I PM'ed him, and am finally returning some useful info!
I've been playing with the Formation autopilot, and can roughly get one XR2 to follow another. But, trying to get 4 XR2s to follow me was carnage, they were all over the shop, flying up and down and side to side and everything. It is possible that collisions caused a problem, so I will be trying again tonight without it, but in the mean time, would you like me to upload the footage to youtube? even if just for the lols!
 
I must admit, it was quite a sight, 4 XR2s over which I had no control over, Flying (or more careening) out of a patch of ocean (My OBSP install doesn't have WIN ATM) But I want to wait for the ok from a member of the OBSP team first, you understand.
 
what i meant about the huge code, was that if you wanted the AI spacecraft to go to the ISS, you'd need them to be able to work out plane misalignment for orbital syncing, then the actual orbital syncing itself, then basesync and aerobrake to get back to earth, so the amount of code would be ludicrous

of course, just getting them to fly in the atmosphere is much simpler, because there's no orbital mechanics :P

Ah! Here's the catch! I can break all these maneuvers down into separate instructions.
Instruction to get to orbit, instruction to align planes, instruction to sync with target, instruction to dock. Than I can just give a set of these instructions and have them execute one after the other. Makes life a lot easier.


Back when EscapeTomsFate first offered up for testers, I PM'ed him, and am finally returning some useful info!
I've been playing with the Formation autopilot, and can roughly get one XR2 to follow another. But, trying to get 4 XR2s to follow me was carnage, they were all over the shop, flying up and down and side to side and everything. It is possible that collisions caused a problem, so I will be trying again tonight without it, but in the mean time, would you like me to upload the footage to youtube? even if just for the lols!


I recently improved the control functions, so there's a lot less of the up-and-down, left-and-right flying. I don't think you have the new DLL yet...

Currently the best results are achieved when the target vessel is flying straight and level. When the target goes into a turn, the following vessels won't stay in formation, but they will follow quite closely. Much more so than what you've seen till now.

Currently the AI is at a low stage. There is no squad AI yet, so when a vessel is attacked, it'll try to avoid the missile and if it manages to do so, it'll strike back. But it won't ask its wingman for help. The wingman is oblivious and flies close to its master through the whole thing.


Well, I guess now that I've spilled the beans, I'll get up a video of what we've been doing. Thanks to ETF (and it seems that guy doesn't sleep :lol:), OBSP now has a basic user interface. You can now drop bombs on targets and fire missiles at air or ground targets.
 
Can I throw the video up so we can all have a good laugh then?
 
Can I throw the video up so we can all have a good laugh then?

Sure, I guess. And if you want, I can upload a copy of your video to the OBSP channel too.

Which version of the beta do you have, anyway? Can you fire missiles and bombs manually yet and do the enemy planes react when you fire at them?
 
This seems to be very significant progress for such a small team working within the constraints of existing software. Looking forward to the video.
 
Short answer: Old.
Long answer: Planes are still dumb, hits every time, Everything done from the LUA console. I received the PM with the download link 10th sept.

Also my internet is v. slow at the moment, so this may take a while...
 
This seems to be very significant progress for such a small team working within the constraints of existing software. Looking forward to the video.

Yea, two physics students programming this. Exams take up most of our time.



Short answer: Old.
Long answer: Planes are still dumb, hits every time, Everything done from the LUA console. I received the PM with the download link 10th sept.

Also my internet is v. slow at the moment, so this may take a while...

Yea, definitely the old version.

Keep in mind that you can add a script to the scenario so you don't need to manually tell the planes to follow you every time. Check out how it's done in the "Autopilot tour" scenario.



I'll be tying up some loose ends this week and hopefully be able to make a short, unedited video of the progress.
 
Bad news, the vid I was planning to use seems to have not saved right. Good news: the new one I shot to replace it shows things even better! I'll get uploading it as soon as its ready!
 
Alright! time to settle down and wait...:coffee:
Oh, do you guys want some sort of Kinetic Energy Weapon for OBSP? I'm working on a simple demonstrator right now with SC3...
 
Back
Top