Page 1 of 2

Oolite AIs

Posted: Tue Jun 14, 2011 2:48 pm
by RyanHoots
I am going to work on AIs for Oolite, maybe an escort fighter, or a clown that blows up after a bit. Any tips or ideas? Thanks.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 2:56 pm
by Smivs
Yeah, read the Wiki page, then realise it really doesn't give you any idea how they actually work. :o
The good news is, as always, there will be plenty of help here if you need it.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 3:10 pm
by RyanHoots
Smivs wrote:

The good news is, as always, there will be plenty of help here if you need it.
Yep. I just completed a simple AI. If it works it will be very funny. If attacked, it blows up like a Q-Bomb.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 3:19 pm
by Smivs
RyanHoots wrote:
..... it will be very funny. If attacked, it blows up like a Q-Bomb.
I can think of something else that does that. :lol:

Re: Oolite AIs

Posted: Tue Jun 14, 2011 3:27 pm
by RyanHoots
Cool! I think I see some big explosions in my future...

Re: Oolite AIs

Posted: Tue Jun 14, 2011 3:29 pm
by Smivs
:D :D :D

Re: Oolite AIs

Posted: Tue Jun 14, 2011 4:16 pm
by m4r35n357
Try looking at these to give you some ideas . . .

http://wiki.alioth.net/index.php/AI

That should get you started. Also, try looking at any OXPs that do things that you enjoy with the AI.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 4:52 pm
by Capt. Murphy
In addition to the Wiki take a look at the AI's included in the core game to get a bit of a grip on how they are put together. It's a pretty complex area.

If testing a new creation's AI I suggest giving it an attached script with this code snippet.

Code: Select all

this.shipSpawned = function()
{this.ship.reportAIMessages = true;}
This will help you tweak/bugfix your AI from the log file.

I'll be releasing version 1.1 of my escort contracts OXP in a day or two which includes a custom AI and ship script built from scratch. It's only taken me about a month to get it right.... :roll: . If you are interested take a look.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 6:53 pm
by RyanHoots
I hope to write AIs for some ships I've made. I then need to find out why I can't install Wings... but getting a LInux app to work is my specialty. 8)

Re: Oolite AIs

Posted: Tue Jun 14, 2011 7:27 pm
by Eric Walch
Capt. Murphy wrote:
If testing a new creation's AI I suggest giving it an attached script with this code snippet.

this.shipSpawned = function()
{this.ship.reportAIMessages = true;}

This will help you tweak/bugfix your AI from the log file.
Yes, if you really want to understand, you must start logging them. That helps in understanding how they work. They probably work different than you first think. And instead of setting the messages on with a script you can also switch it on during the addition command:

Code: Select all

system.addShips('pirate', 1, player.ship.position, 10000)[0].reportAIMessages = true
But if testing a special script, it is the easiest to use the method by "Capt. Murphy". It even works for ships spawned at the other end of the system.

One other way is targeting the ship and use:

Code: Select all

player.ship.target.reportAIMessages = true
But in doing so you will miss the initial AI commands.

Anyhow, you do need the console to do this all.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 7:40 pm
by RyanHoots
I am now going to take a look at some AIs, and write a few while I'm at it.

Re: Oolite AIs

Posted: Tue Jun 14, 2011 9:39 pm
by JensAyton
There’s also the generate-ai-graphviz hidden setting, which makes graphs of the possible state transitions in each AI that’s loaded. Have I mentioned that I like graphs? ;-)

Re: Oolite AIs

Posted: Tue Jun 14, 2011 9:57 pm
by m4r35n357
Wow, some cool stuff in there, esp. flush cache!

Re: Oolite AIs

Posted: Wed Jun 15, 2011 10:08 am
by m4r35n357
Ahruman wrote:
There’s also the generate-ai-graphviz hidden setting, which makes graphs of the possible state transitions in each AI that’s loaded. Have I mentioned that I like graphs? ;-)
Anyone know where these files are created, I have yet to locate one - it's either missing, or absent . . . ?

Re: Oolite AIs

Posted: Wed Jun 15, 2011 10:20 am
by JensAyton
m4r35n357 wrote:
Anyone know where these files are created, I have yet to locate one - it's either missing, or absent . . . ?
They should be generated in the same place as the log. Also, they’re only generated when an AI is first loaded, so start Oolite with shift held down to clear the cache.