Page 9 of 22

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 9:53 am
by another_commander
Shipbuilder wrote:
[Sorry to be a pain and I'm sure it is easy to find but I don't know where to locate oolite.app/Resources to find the above AI.plists :? If anyone could point me in the right direction it would be much appreciated.
If you are on Windows, the AIs are located in <Folder where you installed Oolite>/oolite.app/Resources/AIs.

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 9:53 am
by Thargoid
Shipbuilder wrote:
If you look in the AI for the police ships (usually route1patrolAI.plist - found in the AI folder under oolite.app/Resources)
Sorry to be a pain and I'm sure it is easy to find but I don't know where to locate oolite.app/Resources to find the above AI.plists :? If anyone could point me in the right direction it would be much appreciated.
In your oolite install directory - that will depend on where you put it and which OS you are on.

Edit - Ninja'd by A_C in a role reversal from normal stylie.

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 9:59 am
by Capt. Murphy
Thargoid wrote:
Capt. Murphy wrote:
Smiv's shipset is an example of where it's done via script. The JS equivalent is ship.lightsActive (read/write boolean). There is an advantage to doing it via script in that if you have flashers attached to a ships sub entities they can be controlled independently of each other or flashers attached to the main entity using JS.
Except for the minor point that you can't actually attach flashers to sub-entities?
Oh....the wiki entry for lightsActive suggested you can hence my post. Maybe it's just for shaders on sub-ents?
Setting this property to true turns on all the entity’s flashers, and setting it to false turns them off. Setting it sets the lightsActive property for all subentities, but subentities’ setting can also be manipulated separately. In addition to affecting flashers, the value can be used by shaders.

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 10:09 am
by Shipbuilder
Thanks guys - I'll check it out later and give it a go.

Looks like being my first steps in to a hopefully very simply AI exercise (Something that I have been putting off but definitely something that I need to get in to in order to develop more specific behaviour for future OXPs I intend to work on) :wink:

EDIT
- I intend to write a specific AI for the Cylon Raider Mark 1 so this will be the first big test ! :?

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 10:24 am
by Thargoid
Capt. Murphy wrote:
Oh....the wiki entry for lightsActive suggested you can hence my post. Maybe it's just for shaders on sub-ents?
Unless I'm missing something or we have a special case, it would be a sub-ent of a sub-ent, which I don't think is allowed. There's possibly no reason why it couldn't be for flashers (as there would be no recursion risk), but unless it's already been made an exception could possibly be requested there?

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 12:10 pm
by Commander McLane
Capt. Murphy wrote:
Oh....the wiki entry for lightsActive suggested you can hence my post. Maybe it's just for shaders on sub-ents?
Setting this property to true turns on all the entity’s flashers, and setting it to false turns them off. Setting it sets the lightsActive property for all subentities, but subentities’ setting can also be manipulated separately. In addition to affecting flashers, the value can be used by shaders.
I think the entry is clear and exact. Nowhere does it claim that a subentity can have a flasher (= can have another subentity). It speaks about affecting subentities of an entity, namely those subentities that are flashers. lightsActive will de-/activate subentities that are flashers and entities/subentities that use shaders. I find that quite clear to understand.

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 7:47 pm
by Shipbuilder
I'm still struggling to get police ships with flashers turned on before I have attacked them. :(

I have updated the section in the shipdata.plist for the police version as follows: -

Code: Select all

		<key>ai_type</key>
		<string>colonial_viper_mark1_policeAI.plist</string>
		<key>auto_ai</key>
		<string>no</string>		
I then created a new subfolder in the .oxp folder named AIs and placed a copy of both route1patrolAI and policeInterceptAI in to this folder.

I renamed the route1patrolAI to colonial_viper_mark1_policeAI, changed the GLOBAL switchLightsOff to switchLightsOn and replaced any references to setAITo: interceptAI to setAITo: colonial_viper_mark1_InterceptAI.

I renamed the policeInterceptAI to colonial_viper_mark1_InterceptAI and changed all references to switchLightsOff to switchLightsOn.

Once I'd done this I thought that I had it........But unfortunately not.

Any ideas ?

Re: New ships under developemnt

Posted: Tue Jun 05, 2012 9:10 pm
by Thargoid
Hold down shift when you restart the game (until the spinning cobbie). Until you do, the changes in the OXP won't get recognised as the cached version will be used (ie with the original trunk AIs).

You can check by looking in the latest.log (it should tell you near the start that the cache was flushed due to shift being pressed), or by targetting one of the ships and using the console command PS.target.AI and PS.target.AIState to show the current AI and AI state of your target ship.

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 6:51 am
by Shipbuilder
Thanks for the suggestions.
Hold down shift when you restart the game (until the spinning cobbie). Until you do, the changes in the OXP won't get recognised as the cached version will be used (ie with the original trunk AIs).
I have tried this and also removed the oxp from the addons folder reloaded Oolite then closed down put the oxp back in the addons folder and restarted but still no joy.
You can check by looking in the latest.log (it should tell you near the start that the cache was flushed due to shift being pressed), or by targeting one of the ships and using the console command PS.target.AI and PS.target.AIState to show the current AI and AI state of your target ship.
I will have a look at the log file tonight (I assume that it is in the Oolite folder where Oolite is installed).

With regard to the console command how do i use this ?

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 7:28 am
by another_commander
Shipbuilder wrote:
With regard to the console command how do i use this ?
The Debug Console is a must if you are doing OXP development or writing code for the core game. Using it lets you generate test conditions in the game in real-time in order to test OXPs, spawn ships you have created, change the AIs of entities on the fly, inject JavaScript code directly into the game and much more. It even allows for remote debugging sessions between two computers, where one is running the console and the other is running the game.

To enable it, you need to have Basic-debug.oxp installed in your AddOns folder. If you are using Windows, then Basic-debug.oxp is offered during installation of the game and by default it is installed, so unless you have changed the setting, you should have it already present.

Then you need to download the console program itself. It is found here: http://developer.berlios.de/project/sho ... e_id=18953.

To use it, you must run the OoDebugConsole.exe program before running Oolite. When run, the console window will open and report that it is waiting for connection. Starting up Oolite with the Basic-debug.oxp installed will establish this connection. From that point onwards, you can issue commands like the ones Thargoid mentioned earlier to the game via the console and see the responses/output in its window.

A simple search for "debug console" and "debug oxp" in the wiki yields some useful more in-depth information.

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 11:36 am
by Shipbuilder
Thanks for the info another commander - It'll give me something to get my teeth in to this week :D

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 6:33 pm
by Shipbuilder
I have managed to install the Debug Console which has opened a connection with Oolite.

As a trial run I have started a new game, armed the ident computer and locked the computer on to a standard Galcop Viper.

I have typed the following 2 commands in to the Debug Console (with the reply from the debug also noted).

Code: Select all

>:PS.target.AIState
Macro :PS.target.AIState is not defined

>:PS.target.AI
Macro :PS.target.AI is not defined

Am I doing this correctly as I was expecting the Debug to report a particular AI ? (I get the same result if I fire at the Galcop Viper).

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 6:47 pm
by SandJ
Remove the colon from before the PS.

Re: New ships under developemnt

Posted: Wed Jun 06, 2012 7:14 pm
by Shipbuilder
SandJ wrote:
Remove the colon from before the PS.
Thanks SandJ I've got the debug console working fine now thanks :D

So getting back to the original topic i.e. trying to specify a police ship where the flashers are on before being attacked I have checked that the cache has been flushed by holding shift down in the latest log file.

I have also checked using the PS.target.AI command in the debug console which has confirmed that the OXP is using the standard planetPatrolAI.plist for the AI hence the reason that flashers are off until attacked.

At least now I understand why the ship is not behaving in the way I want I just don't understand why the OXP is not using the colonial_viper_mark1_policeAI file :?

I'll have a double check through to make sure that I don't have any silly typos but I reckoned to have done this yesterday evening.

Re: New ships under developemnt

Posted: Thu Jun 07, 2012 7:06 pm
by Shipbuilder
Thanks to the advice I have recieved by using the Debug Console I have established that if I spawn ships using the debug console or if I encounter them in general play, i.e. flying between planets, they are using my colonial_viper_mark1_policeAI and colonial_viper_mark1_InterceptAI AI.

The issue where the Colonial Viper doesn't use my tweaked AI seems to be only when the ships launch from a station. In this case they use the standard route1patrolAI and policeInterceptAI AI.

Does anyone have any ideas how I can get the ships launching from stations to use the tweaked AI ?