Custom AI

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

Post Reply
User avatar
johnsmith
Deadly
Deadly
Posts: 141
Joined: Fri Sep 22, 2006 10:32 am
Location: Teance
Contact:

Custom AI

Post by johnsmith »

I'm working on a revised AI based on pirateAI.plist. In shipdata.plist I have the correct custom ai_type set, but whenever I come across these ships in space, their AI is pirateAI.plist, not my custom AI. Is that becuse they switch to other AIs like enteringPirateAI.plist, and then forget to return to the custom AI?

Second question is is there a way to refine attack modes? I'm thinking along the lines of:

Code: Select all

 <key>ATTACK_SHIP</key>
	<dict>
		<key>ENERGY_LOW</key>
		<array>
			<string>setStateTo: FLEE</string>
		</array>
		<key>ENTER</key>
		<array>
                <string>performAttack</string>
                <string>setSpeedFactorTo:1.5</string>
                <string>setDesiredRangeTo: 500.0</string>
                <string>setSpeedFactorTo:1</string>
                <string>rollD: 2</string>
                <string>ROLL_1= performAttack</string>
                <string>ROLL_2= setDestinationWithinTarget</string>
	</array>
		<key>ENTER WORMHOLE</key>
		<array>
			<string>setStateTo: ENTER_WORMHOLE</string>
		</array>
		<key>EXIT</key>
		<array/>
		<key>INCOMING_MISSILE</key>
		<array>
			<string>fightOrFleeMissile</string>
		</array>
		<key>TARGET_DESTROYED</key>
		<array>
			<string>setStateTo: COLLECT_LOOT</string>
		</array>
		<key>TARGET_LOST</key>
		<array>
			<string>setStateTo: COLLECT_LOOT</string>
		</array>
		<key>UPDATE</key>
		<array/>
	</dict>

This is meant to have the attack come in fast, slow to normal speed when close, then ram the target 50% of the time. Will it work?
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2876
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 »

One the first one, once AI is switched (with a switchAIto) - pirate AI contains a few of these, yeah Oolite forgets the Custom AI and the ship becomes a trader in terms of behaviour (or wherever the AI was switched to).

Not sure about the setdestination within target bit. However, a switch to missileAI would work (although the ship could be ECMed!). If therefore you did a set state to CRASH, then define crash by copying in missileAI, but taking out the ECM=, that should do it.
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
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

I would think The Constrictor AI is similar to what you are trying to achieve, or possibly the Imperial Courier.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
johnsmith
Deadly
Deadly
Posts: 141
Joined: Fri Sep 22, 2006 10:32 am
Location: Teance
Contact:

Post by johnsmith »

Thanks for the tips guys. I ended up renaming the AI and clearing the cache, and it now does its thing. Can't get the tactics quite right yet, but it's getting there. Got rid of all the switchAIto stuff, so it remembers who it is.

I found some randomisation stuff in the hardMissileAI, which I'll try to incorporate so it doesn't get too predictable.

Couple of keywords I don't understand. Frustrated, and performTumble. Does anyone use these, and for what?

Constrictor didn't have it's own AI, it used pirateAI. Which is why it was so dissapointing to kill. Not sure about the Courier.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2876
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 »

Not sure about "frustrated", but performtumble tells the ship just to wait where it is rolling left and right until a condition is met.
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
Judebert
Dangerous
Dangerous
Posts: 88
Joined: Sat Aug 19, 2006 4:56 pm
Location: Orlando, FL
Contact:

Post by Judebert »

Somewhere in the docs (we have got to reorganize that stuff; might have been a man page or AI comment) it says that FRUSTRATED happens when the AI has been trying to scoop something for more than 10 seconds.
Post Reply