Page 8 of 22
Re: New ships under developemnt
Posted: Thu May 31, 2012 11:09 pm
by Shipbuilder
Shipbuilder wrote:Thargoid wrote:The texture will be fine, presuming you just rescale without modifying in detail.
Indeed there is a datscale.py script which can make a model uniformly bigger (or smaller) - you can grab it from Berlios in the same place as obj2dat and it's bretheren.
Editted to add - see here
Can anyone explain how I can use the datscale.py script to resize a 3D wings model in layman’s terms ?
I'm sure it's easy when you know how but I have been fiddling around trying to work out what to do for a while and haven't made much progress.
I've just discovered this evening that the python 2.7 program had got corrupted somehow so this hopefully will explain why I have been struggling to rescale my dat model. Anyway I should find out tomorrow when I have another go at resizing!
Re: New ships under developemnt
Posted: Fri Jun 01, 2012 9:46 pm
by Shipbuilder
Ok I think the Constitution Class Heavy Cruiser is almost ready to be released.
I have upscaled the model after reinstalling python, (It is now 245m wide x 122m high x 524m long), and repositioned all of the flashers, launch positions etc to suit,
I have made the ship an npc ship by removing the player role in the shipdata.plist file and have removed the shipyard.plist file altogether.
So I now have a Config file containing demoships, descriptions and shipdata Plists, a Models folder containing the rescaled model dat file, a Textures file with the .png texture file and the Bigships_1.0.2 folder (The readme file needs to be written).
I have been test playing Oolite for a couple of hours or so but have not come across the ship in game. Hopefully this is just due to chance (The ship is displayed when I scroll through installed ships on the opening screen before starting the game).
I was wondering if anyone with experience of designing an npc ship using the BigShips AI would be able to have a quick look through what I have put together to make sure I haven’t made any mistakes prior to me releasing. The oxp worked fine as a player ship before I took the player role out but I’m not 100% sure it is working as an npc only ship (Simply because I haven't come across it in game).
If anyone is able to assist send me a PM and I will send you a link to download the pre-release test version.
EDIT - Looks like the oxp seems to be working. I have just come across an NPC Constitution Class Heavy Cruiser in the Rexebe system. I'll post some screenshots shortly and should be able to make an official release this weekend
Re: New ships under developemnt
Posted: Fri Jun 01, 2012 10:01 pm
by Cody
Shipbuilder wrote:I have been test playing Oolite for a couple of hours or so but have not come across the ship in game.
Sounds like you need a simple spawning script.
Re: New ships under developemnt
Posted: Sat Jun 02, 2012 12:21 am
by Shipbuilder
The oxp seems to be working ok. Below I have some in game screenshots of the NPC Constitution Class Heavy Cruiser due to be released this weekend.
EDIT - This OXP has now been released.
Download it here:
https://www.box.com/s/545bdb5a4e543049e61f
The ship flying alongside the Constitution Class Heavy Cruiser is a pre-release version of a Chimera Gunship I am working on.
Re: New ships under developemnt
Posted: Sun Jun 03, 2012 11:58 pm
by Shipbuilder
Can anyone tell me how I can define flashers on non players ships that are turned on before being attacked ? I have come across some ships where the flashers are not activated until I take a shot at them at which point they appear.
The screenshot below shows an npc ship at the front with no engine flasher while the player ship following has its engine flashers visible.
I referred to the info in the Shipdata.plist relating to subentities which reads as follows:-
Specifies whether a flasher is turned on when created. Ignored for non-flashers. Default yes.
With the note stating the default is yes I assumed that the flasher would always be on.
The code I have for the flashers in question is: -
Code: Select all
<key>subentities</key>
<array>
<string>*FLASHER* 0.0 4.2 -10.0 175 0 1 3.5</string>
<string>*FLASHER* 4.0 0.2 -10.0 175 0 1 3.5</string>
<string>*FLASHER* -4.0 0.2 -10.0 175 0 1 3.5</string>
</array>
However I have recently started to use the new style subentity definition style i.e.
Code: Select all
<key>subentities</key>
:?
<array>
<dict>
<key>type</key>
<string>flasher</string>
<key>position</key>
<string>0.0 -34.6 68.4</string>
<key>color</key>
<string>cyanColor</string>
<key>frequency</key>
<string>0</string>
<key>phase</key>
<string>1.0</string>
<key>size</key>
<string>28.8</string>
</dict>
Is anyone able to confirm what code I need to use to ensure npc ships have flashers initially on ?
Would it be as below
Code: Select all
<key>initially_on</key>
<string>true</string>
Re: New ships under developemnt
Posted: Mon Jun 04, 2012 5:54 am
by Capt. Murphy
Looking at the wiki, it appears that whether they are on or off by default depends on whether they are defined in the new or old style format. Certainly in my experience, with the new style they are definitely on by default so if that's what you want then you shouldn't need to explicitly set initially_on
in shipdata.plist.
Turning flashers off or on in response to game events is controlled by the entities AI and/or a Javascript shipScript. See the core games interceptAI.plist for a good example of how it works from AI. Having a quick look this morning it appears that the core game AI for traders and pirates don't change flashers at all. You are looking for the AI commands switchLightsOff
and switchLightsOn
.
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.
Re: New ships under developemnt
Posted: Mon Jun 04, 2012 11:46 am
by Shipbuilder
Thanks for getting back to Capt Murphy.
I have changed the flasher code from the old style to the new style but flashers to NPC ships are still off until I shoot at them
I then tried to adapt the code using the key initially on and string true, (Not sure if this is the correct way to write this part of the code), as follows but also to no avail: -
Code: Select all
<key>subentities</key>
<array>
<dict>
<key>type</key>
<string>flasher</string>
<key>initially_on</key>
<string>true</string>
<key>position</key>
<string>0.0 4.2 -10.0</string>
<key>color</key>
<string>cyanColor</string>
<key>frequency</key>
<string>0</string>
<key>phase</key>
<string>1.0</string>
<key>size</key>
<string>3.5</string>
</dict>
Does anyone know where I am going wrong ?
EDIT - This issue looks like it may perhaps only apply to police ships as the ship I was checking was a system vessel. The Constitution Class Heavy Cruisers shown in the screenshots earlier in this thread is also a NPC ship but the flashers are all on! (I had not taken at shot at it either
).
Re: New ships under developemnt
Posted: Mon Jun 04, 2012 11:54 am
by another_commander
<string>true</string>
is incorrect.
It should be just <true/>
Re: New ships under developemnt
Posted: Mon Jun 04, 2012 11:56 am
by Eric Walch
Shipbuilder wrote:I have changed the flasher code from the old style to the new style but flashers to NPC ships are still off until I shoot at them
When they switch to ON by shooting at the ship, it is a strong sign that they are controlled by the AI itself. The AI for police ships (route1patrolAI) explicitly sets the flashers off at startup. (That overrules the initial shipData settings). Police and escorts use the interceptAI for attacking. That one sets it on at the start and off again when leaving the AI.
another_commander wrote:<string>true</string>
is incorrect.
It should be just <true/>
You are right, but when I remember correctly, Oolite will also accept the strings 'true', 'yes' or 'on' in this case.
Re: New ships under developemnt
Posted: Mon Jun 04, 2012 9:38 pm
by Shipbuilder
Thanks for your feedback. I have had a little play to check things out (Just an excuse to have a couple of ours playing Oolite really).
It seems that Eric is spot on. The only ships which I have come across with this issue are police ships. Any other NCP ship has all flashers fully lit at all times.
Perhaps when I have developed my knowledge of scripting I will have a go at writing something to try to get the flashers permanently on for police ships.
Re: New ships under developemnt
Posted: Tue Jun 05, 2012 8:24 am
by Thargoid
If you look in the AI for the police ships (usually route1patrolAI.plist - found in the AI folder under oolite.app/Resources) you'll see why it happens. When the ship is first spawned, the AI starts in the GLOBAL state and performs the ENTER operation. In the AI that is defined as:
Code: Select all
GLOBAL =
{
ENTER = (switchLightsOff, "setStateTo: HEAD_FOR_WITCHPOINT");
};
Hence the first thing it does is turn the lights (flashers) off.
Similarly when they attack, it switches its AI to interceptAI.plist (found in the same folder), whose GLOBAL state is
Code: Select all
GLOBAL =
{
ENTER = (switchLightsOn, "setStateTo: ATTACK_SHIP");
};
And lo, we light up again.
If you want to know more about how the AI's work, there are some details
in the wiki.[/color]
Re: New ships under developemnt
Posted: Tue Jun 05, 2012 8:39 am
by Shipbuilder
Thanks Thargoid
Presumably to do this I could copy the standard police AI, rename to for example colonial_viper_mark1_policeAI and alter the section of the code to read
Code: Select all
GLOBAL =
{
ENTER = (switchLightsOn, "setStateTo: HEAD_FOR_WITCHPOINT");
};
Then alter the code in the shipdata.plist to read
Code: Select all
<key>ai_type</key>
<string>colonial_viper_mark1_policeAI .plist</string>
Re: New ships under developemnt
Posted: Tue Jun 05, 2012 8:44 am
by Thargoid
Yes you could, although by default the flasher lights should be on (unless you define them as initially off) so you could also just remove the switchLightsOff command completely. But setting it to on won't hurt.
Re: New ships under developemnt
Posted: Tue Jun 05, 2012 9:49 am
by Shipbuilder
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.
Re: New ships under developemnt
Posted: Tue Jun 05, 2012 9:52 am
by Thargoid
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?