Board index FlightGear Development

Possibility of incorporating "learning" AI?

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Possibility of incorporating "learning" AI?

Postby lcflight » Fri Jul 06, 2012 1:54 am

Dear all,

I would like to inquire about the possibility (feasibility) of incorporating artificial intelligence (utilizes bayesian networks, has reasoning and learning capabilities) into flightgear with Bombable add-on so as to be able to either (a) pit my artificial intelligence against a standard AI in combat scenario or (b) pit myself against my artificial intelligence in a combat scenario.
Thank you for your time! :)

Yours sincerely,
lcflight
lcflight
 
Posts: 1
Joined: Mon Jun 25, 2012 5:43 am

Re: Possibility of incorporating "learning" AI?

Postby xiii » Fri Jul 06, 2012 9:28 am

Hi Icflight

Sure, most everything is possible here.

Just a little damper, Bombable is not really supported and imho wasn't conceived with software architecture in mind. I think it would be better to think on a robust and modular AI implementation so any other existing or future piece could use it without requiring Bombable. This doesn't say that Bombable couldn't use it.

My 2 cents,

Alexis
If the engines are Pratt and Whitney, the seats best be Martin Baker
xiii
 
Posts: 472
Joined: Tue Jan 08, 2008 10:04 pm

Re: Possibility of incorporating "learning" AI?

Postby Hooray » Sat Jul 07, 2012 3:10 pm

We talked about this a number of times, and the bombable developer (flug) repeatedly indicated an interest in adding this:

viewtopic.php?f=6&t=5742&p=86630&hilit=neural#p86630
viewtopic.php?f=6&t=5742&p=86630&hilit=neural#p86696
viewtopic.php?f=6&t=5742&p=140015&hilit=neural#p140015
viewtopic.php?f=6&t=5742&p=140015&hilit=neural#p140349
viewtopic.php?f=6&t=5742&p=140381&hilit=neural#p140351

A while ago, I started a write-up (never completed it though):

http://wiki.flightgear.org/Howto:Neural ... s_in_Nasal

However, you can see there's clearly interest for this sort of thing here, and you can certainly get support from flug and others (including myself) on the Nasal/FG scripting side of things.

If you have any ideas to share, I suggest to add to the wiki article that I started.

EDIT: It seems somebody else is currently working on similar things: viewtopic.php?f=42&t=16853&p=161248&hilit=neural#p161248
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11354
Joined: Tue Mar 25, 2008 8:40 am

Re: Possibility of incorporating "learning" AI?

Postby Hooray » Sun Jul 08, 2012 3:10 pm

lcflight wrote in Fri Jul 06, 2012 1:54 am:I would like to inquire about the possibility (feasibility) of incorporating artificial intelligence (utilizes bayesian networks, has reasoning and learning capabilities) into flightgear with Bombable add-on s


It is certainly possible (like xiii said already), however it will require a solid background in AI and coding. It could definitely be implemented without touching any C++ though (i.e. using scripted Nasal code).
I am disagreeing a little with xiii regarding the feasibility of using the bombability package for this, it's actually pretty well-written and well-commented source code. However, it is obviously a huge and complex piece of software. Just understanding how everything works, will take weeks or even months.
In other words, it might be simpler to start out with something standalone - i.e. based on the tanker.nas example, so that you could first create an AI bot using NN which controls the tanker (or some other aircraft) and then consider integrating this with the bombable package later on.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11354
Joined: Tue Mar 25, 2008 8:40 am

Re: Possibility of incorporating "learning" AI?

Postby Bomber » Sun Jul 15, 2012 3:40 pm

T4T is looking for something like this... If you like I'm sure Paul would welcome your input into a combat sim. You could use T4T as a development environment.

Please contact us if you're interested.

Regards

Simon.
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1934
Joined: Fri Dec 14, 2007 7:06 pm
OS: Windows XP and 10

Re: Possibility of incorporating "learning" AI?

Postby flug » Thu Aug 02, 2012 12:52 am

Hooray wrote in Sun Jul 08, 2012 3:10 pm:I am disagreeing a little with xiii regarding the feasibility of using the bombability package for this, it's actually pretty well-written and well-commented source code. However, it is obviously a huge and complex piece of software. Just understanding how everything works, will take weeks or even months.


That is true, Bombable is definitely large & complex and though I'm interested in continuing to develop it I am also very limited in my spare time available right now.

Flip side is, it could written (in fact probably SHOULD be written) as a completely stand alone module that just reads the location & other info from the property tree for the main AC and the AI AC of interest, and gets the general geographical and other information it needs to navigate the through the regular FG functions and the property tree variables for that sort of thing.

Then you could develop some kind of API type thing to communicate with Bombable where the AI pilot module puts the current piloting info into the property tree (or just a nasal data structure, probably better for speed), including info like:

- which direction/how much to turn/turn rate
- which direction/how much to climb or dive/climb or dive rate
- whether to speed up, slow down and by how much, and rate
- Also right now Bombable implements loops as a special/separate routine - but they are easy enough to trigger with the same API type of approach, just send the data along via the API to say 'start loop' and a few parameters to define what the loop will do.

Bombable could then read these nasal variables and/or the property tree or however the module-to-module communications API is worked out, and take the appropriate action.

This would be pretty simple to implement just because Bombable is already doing something very similar to this, but it uses its own internal logic to make those decisions about turning, climbing, diving, looping, etc. It could just as easily take those cues from an outside module.

The only other things that Bombable is currently using for AI aircraft decision-making are (1) weapons hits and near hits on the AI/AC, (2) overall AI/AC damage level, and (3) in the last version I implemented some code to simulate the AI/AC's fuel situation (with good fuel reserves the AC will attack aggressively, when fuel gets low it turns tail and slows down to conserve fuel). Those things could easily be implemented via the AI module as well, with info passed back & forth via the property tree or a nasal data structure. There are only a few simple parameters for all of those items.

So--I think this *could* be done with Bombable as a completely separate module that only interfaces with Bombable via an API type interface and furthermore, the API would be pretty simple. I think. (Famous last words, I know!)
flug
 
Posts: 218
Joined: Wed Jun 17, 2009 1:06 am

Re: Possibility of incorporating "learning" AI?

Postby flug » Thu Aug 02, 2012 1:07 am

flug wrote in Thu Aug 02, 2012 12:52 am:
Hooray wrote in Sun Jul 08, 2012 3:10 pm:So--I think this *could* be done with Bombable as a completely separate module that only interfaces with Bombable via an API type interface and furthermore, the API would be pretty simple. I think. (Famous last words, I know!)


The other flip side is, even if this is the long term plan it might still be smarter to start by implementing this same kind of an AI system (including the idea of an API-type interface that would allow the new AI piloting module to get needed info from other modules as needed and transmit the piloting instructions back to another different module that would do the actual piloting) but choosing a much simpler task for the first project.

Then once the basic ideas have been worked out and are functional, tackle the much more complicated project of making a convincing AI fighter pilot module--which, really when you think about it, is what is needed for Bombable.

Making an complete, realistic AI fighter pilot module is a pretty daunting project, really! The only thing that makes me think it is even possible at all is that the current Bombable pilot AI really only has a very, very few basic behaviors (attack in certain situations, evade in certain situations, do a loop in certain situations, retreat in certain situations--that's about it) and it really works much better than I ever imagined it would, given that absolute simplicity and complete unsophisticated-ness of the AI pilot model it's using.
flug
 
Posts: 218
Joined: Wed Jun 17, 2009 1:06 am

Re: Possibility of incorporating "learning" AI?

Postby Hooray » Thu Aug 02, 2012 9:53 am

Like you say, we should probably consider this a long-term goal, and then it would make sense to extract the AI control code from bombable into some separate "ai.nas" module, i.e. splitting up bombable into separate files.

So that some of these could eventually be moved to the Nasal standard library directory in $FG_ROOT/Nasal, this is where we could then have a separate "ai.nas" module that allows controlling AI objects via the property tree. And another "pilot.nas" module which uses the ai.nas module.

It should definitely be simpler to do this with some standalone aircraft, or maybe just the tanker.nas module. So that we could tackle this task separately, reuse as much of the bombable code as possible, and re-integrate the results later on via some sort of API, like you say.

Custom "pilot" implementations could then be provided for different purposes, i.e. by reimplementing an abstract "pilot" base class and overriding functionality as required.

Currently, the major showstopper is probably the complexity of the whole system, and having to understand it in its entirety, if bombable could be split up into separate modules, that should be made easier - also, adding the bombable package as a Nasal subsystem (sub module) to the base package should be easier then.

Also it's worth mentioning that there have been discussions on exposing the autopilot/route manager system and the FDM system to Nasal space via the property tree and/or new Nasal extension functions, that could also help to make some old code obsolete, i.e. because a real autopilot or FDM could be used for scripted AI traffic eventually.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11354
Joined: Tue Mar 25, 2008 8:40 am


Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest