[WIP] Tetra Yacht - a glitter ship

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

Moderators: another_commander, winston

Post Reply
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

[WIP] Tetra Yacht - a glitter ship

Post by submersible »

Work in progress , experimenting with modelling and shaders for ships. The Glitter ship 'Tetra Yacht' , preferred vessel of the incredibly vain.

http://swarm.perlide.org/static/Glitter-beta.oxp.zip

If anyone can tell me why the ballturret is only working for system populated ships and not the player... that would be great.
Edit: thank you Commander McLane for pointing out how this happened.

Image
Last edited by submersible on Thu Mar 07, 2013 3:08 pm, edited 1 time in total.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

submersible wrote:
If anyone can tell me why the ballturret is only working for system populated ships and not the player... that would be great.
That mainly depends on what do you mean by "not working".

Doesn't it show up at all on the player ship? - Check that the subentity is defined and assigned correctly.

Doesn't it appear to fire? - Ball turrets only fire at your current target, and only if that target is within their firing range (6000m). Therefore check that you're actually targeting another ship, and that this ship is (a) hostile and (b) closer than 6000 meters.
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: [WIP] Tetra Yacht - a glitter ship

Post by submersible »

Commander McLane wrote:
submersible wrote:
If anyone can tell me why the ballturret is only working for system populated ships and not the player... that would be great.
That mainly depends on what do you mean by "not working".
Sorry - that was poorly explained. The turret appears in the shipyard, and on ships encountered in system. If I buy one and launch with it , no turret appears and no plasma bolts appear to fire at my target when at range.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Smivs »

Nothing in the log, presumably?
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

Wild guess: have you any OXP installed that manipulates subentities? If the turret is clearly visible on the shipyard, but not when you launch, it must have been removed in-between. Some OXPs could do that.
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: [WIP] Tetra Yacht - a glitter ship

Post by submersible »

Commander McLane wrote:
Wild guess: have you any OXP installed that manipulates subentities? If the turret is clearly visible on the shipyard, but not when you launch, it must have been removed in-between. Some OXPs could do that.
:oops: yup - that was it. Another testing OXP. Right On Commander McLane - thankyou.
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

Having downloaded the OXP I am wondering, however, why anything is working for you at all.

First of all, shipdata.plist is not even a valid plist. Therefore no ship should appear in the game at all. There are numerous problems with it: (1) all keys with underscores in their names need quotation marks around them; (2) the shaders directory seems to be totally botched, I can't make any sense of it; (3) as a result I'm not totally sure that the number of closing brackets in the end is correct, it seems too high. I'm not even able to fix it in PlistEdit Pro.

Second, it contains no entry for a player variant. There is only an NPC variant with roles = "hunter(5.0) trader(1.0) pirate(2.0) tetra". (This sole entry nevertheless features custom_views, which don't make sense for an NPC.) So the ship shouldn't even appear in a shipyard.

I have no idea why this OXP works for you at all. Or have you perhaps uploaded an old, buggy version?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

Okay, after much trial and error I finally managed to create an actually working plist. There were also lots of semicolons missing, and a comma too much.

This doesn't fix the problem that there is no player flyable ship, though:

Code: Select all

{
    "tetra-glitter" =     {
        accuracy = 8;
        "ai_type" = "route1patrolAI.plist";
        "custom_views" =         (
                        {
                "view_description" = "Rear View";
                "view_orientation" = "1.0 0.0 0.0 0.0";
                "view_position" = "5.0 30.0 -250.0";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Rear Right View";
                "view_orientation" = "0.9239 0.0 0.3827 0.0";
                "view_position" = "191.42 30.0 -191.42";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Right View";
                "view_orientation" = "0.7071 0.0 0.7071 0.0";
                "view_position" = "250.0 30.0 5.0";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Front Right View";
                "view_orientation" = "0.3827 0.0 0.9239 0.0";
                "view_position" = "191.42 30.0 191.42";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Front View";
                "view_orientation" = "-5.0 0.0 1.0 0.0";
                "view_position" = "0.0 30.0 250.0";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Front Left View";
                "view_orientation" = "0.3827 0.0 -0.9239 0.0";
                "view_position" = "-191.42 30.0 191.42";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Left View";
                "view_orientation" = "0.7071 0.0 -0.7071 0.0";
                "view_position" = "-250.0 30.0 0.0";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Rear Left View";
                "view_orientation" = "0.9239 0.0 -0.3827 0.0";
                "view_position" = "-191.42 30.0 -191.42";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Top View";
                "view_orientation" = "-0.7071 0.7071 0.0 0.0";
                "view_position" = "0.0 290.0 0.0";
                "weapon_facing" = FORWARD;
            },
                        {
                "view_description" = "Bottom View";
                "view_orientation" = "0.0 0.0 0.7071 0.7071";
                "view_position" = "0.0 -290.0 0.0";
                "weapon_facing" = FORWARD;
            }
        );
        "energy_recharge_rate" = "3.5";
        exhaust =         (
            "0.0 -1.0  -12.3 4.0 5.0 9.0",
            "-5.0 -7.7  -12.3 4.0 5.0 9.0",
            "5.0 -7.7  -12.3 4.0 5.0 9.0"
        );
        "forward_weapon_type" = "WEAPON_MILITARY_LASER";
        "laser_color" = "1.0 0.8 0.3";
        materials =         {
            "tetrahedron2_auv.png" =             {
                "emission_and_illumination_map" = "tetrahedron2_emission.png";
                normalmap = "tetrahedron2_normal.png";
                "specular_map" = "tetrahedron2_auv.png";
            };
        };
        "max_cargo" = 5;
        "max_energy" = 280;
        "max_flight_pitch" = "1.5";
        "max_flight_roll" = "2.0";
        "max_flight_speed" = 480;
        "max_missiles" = 2;
        "missile_launch_position" = "0.0 -19.0 11.0";
        model = "tetra_16.dat";
        name = "Tetra Yacht";
        roles = "hunter(5.0) trader(1.0) pirate(2.0) tetra";
        shaders =         {
            "tetrahedron2_auv.png" =             {
                "fragment_shader" = "glitter.fragment";
                textures =                 (
                    "tetrahedron2_auv.png",
                    "tetrahedron2_normal.png",
                                        {
                        "mag_filter" = nearest;
                        "min_filter" = nearest;
                        name = "tetrahedron2_normal_flake.png";
                        "repeat_s" = yes;
                        "repeat_t" = yes;
                    },
                                        {
                        "cube_map" = yes;
                        name = "small_environment_cube.png";
                    },
                                        {
                        name = "tetrahedron2_emission.png";
                    },
                    "tetrahedron2_spectrum.png"
                );
                uniforms =                 {
                    orientation =                     {
                        binding = orientation;
                        type = binding;
                    };
                    position =                     {
                        binding = position;
                        type = binding;
                    };
                    uCameraPos =                     {
                        binding = relativePosition;
                        type = binding;
                    };
                    uDiffuseMap =                     {
                        type = texture;
                        value = 0;
                    };
                    uEmission =                     {
                        type = texture;
                        value = 4;
                    };
                    uEnvironment =                     {
                        type = texture;
                        value = 3;
                    };
                    uFlake =                     {
                        type = texture;
                        value = 2;
                    };
                    uNormalMap =                     {
                        type = texture;
                        value = 1;
                    };
                    uSpectrum =                     {
                        type = texture;
                        value = 5;
                    };
                };
                "vertex_shader" = "glitter.vertex";
            };
        };
        subentities =         (
                        {
                "fire_rate" = "0.75";
                orientation = "0.5 0.0 0.8666 0.0";
                position = "0.0 45.60 -26.26";
                "subentity_key" = ballturret;
                type = "ball_turret";
            }
        );
        thrust = 120;
        "view_position_aft" = "0.0 15.0 -13.0";
        "view_position_forward" = "0.0 31.9375 16.0";
        "view_position_port" = "-16.0 4.0 0.0";
        "weapon_position_forward" = "0.0 8.7 53.0";
        "weapon_position_port" = "44.087 -29.471 -12.307";
    };
}
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

I also got lots of these in my log:

Code: Select all

  17:31:09.277 [shader.compile.failure]: ***** ERROR: GLSL vertex shader compilation failed for glitter.vertex:
>>>>> GLSL log:
ERROR: 0:2: '' :  #version must occur before any other statement in the program


17:31:09.277 [shader.load.fullModeFailed]: ----- WARNING: Could not build shader glitter.vertex/glitter.fragment in full complexity mode, trying simple mode.
  17:31:09.278 [shader.compile.failure]: ***** ERROR: GLSL vertex shader compilation failed for glitter.vertex:
>>>>> GLSL log:
ERROR: 0:2: '' :  #version must occur before any other statement in the program


17:31:09.278 [shader.load.failed]: ***** ERROR: Could not build shader glitter.vertex/glitter.fragment.
And some of these:

Code: Select all

17:33:23.078 [exception]: ***** Exception during [update:entity [<ShipEntity 0x102906a00>{"Tetra Yacht" position: (5845.52, -17434.8, 402348) scanClass: CLASS_NEUTRAL status: STATUS_IN_FLIGHT}]] in [Universe update:] : NSGenericException : *** Collection <NSCFSet: 0x11aacfcb0> was mutated while being enumerated.<CFBasicHash 0x11aacfcb0 [0x7fff70bb6ee0]>{type = mutable set, count = 1,
entries =>
	1 : <ShipEntity 0x12331d400>{"Missile" position: (5831.51, -17417.3, 402431) scanClass: CLASS_MISSILE status: STATUS_DEAD}
}
 *****
Finally, one observation from shipyard.plist: What is "EQ_GOLIATH_SUPPLIES" doing among the optional equipment? Doesn't make any real sense, methinks.
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Smivs »

Sounds like you've been borrowing bits from other work to compile this. That's OK, we all do it (well I do anyway :P ), but I'd suggest keeping it simple to begin with and then build on what you have.
In other words start with a straight-forward player or NPC version but wihout the turret and all the fancy materials and shaders. Just get the complete ship working in game, then add bits in, maybe the turret to start with. Make sure that is OK, then work on the materials, then the shaders.
Check each additional element is working before moving on. This cuts down the complexity and makes bug-fixing much easier.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: [WIP] Tetra Yacht - a glitter ship

Post by submersible »

Wow. Big thanks and my apologies to Commander McLane , this should teach me not to post after midnight and a few drinks.

It has struck me before that in linux the plist parsing seems to be very forgiving of key quoting , dictionary semicolons and dangling commas in arrays. I'll keep up the reading and try to get all these ducks in a row before posting in future.
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: [WIP] Tetra Yacht - a glitter ship

Post by cim »

submersible wrote:
It has struck me before that in linux the plist parsing seems to be very forgiving of key quoting , dictionary semicolons and dangling commas in arrays. I'll keep up the reading and try to get all these ducks in a row before posting in future.
Much more so than the Mac parser, certainly. If you update to more recent GNUstep libraries then you'll get Latest.log warnings on parsing for that sort of thing, though not particularly helpful ones (they give line and character of the parse warning ... but not the file)
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Commander McLane »

Glad to be of help. :D

One final suggestion: you should remove the test script for the final release. Not all players may want to find four Tetras every time they launch from a station.

*************

There's one issue left, though, on which I'd like to hear something from the developers. It's the NPC vs. player ship entry in shipdata.

Traditionally (and most obviously in the in-built shipdata.plist), NPC and player variant are kept apart, with the NPC variant defining the keys that are relevant for NPCs, and the player variant defining the keys that are relevant for player ships. In shipyard.plist, there's of course only a reference to the player variant.

In this OXP submersible has (consciously or not) chosen a different approach: there is only one variant in shipdata.plist, defining the keys for both NPC and player ship. Notably it's lacking the "player" role which is otherwise the hallmark of the player variant of any ship. In shipyard.plist, there's a reference to this sole shipdata-entry. Apparently, this works (despite the lack of a "player" role), at least on Linux and Mac. NPCs are created correctly, and the ship can be bought and flown as player ship.

Therefore now my question: are there any non-obvious disadvantages or flaws in this approach? If not, why has Oolite always separated NPC and player shipdata so strictly and is continuing to do so? (There are of course those cases where the player ship has different specs from the NPC variant, like the different top speed for the Cobby; these need separate shipdata entries of course. But that's not true for all ships.) Is keeping the shipdata entries separated the recommended approach, and why?
User avatar
submersible
Commodore
Commodore
Posts: 264
Joined: Thu Nov 10, 2011 7:49 am

Re: [WIP] Tetra Yacht - a glitter ship

Post by submersible »

Commander McLane wrote:
In this OXP submersible has (consciously or not) chosen a different approach: there is only one variant in shipdata.plist, defining the keys for both NPC and player ship.
Un-conscious - almost in a coma actually. I've since adjust it into a -template , -player and -npc and placed in -player definition in shipdata.plist and it seems to be working . The glsl #version requirement is tricky, casting mat4 to mat3 requires that #version 120 is declared, however this declaration strictly should be the very first line of the shader and I think oolite adds some boilerplate at the top.

Cheating being a favorite practice of mine, I think doing this in the fragment shader is equivalent.

Code: Select all

   //mat3 EnvOrient = mat3(orientation); // casting m4 to m3 requires #version 120
   mat3 EnvOrient = mat3( orientation[0] , orientation[1],  orientation[2] );
User avatar
Cholmondely
Archivist
Archivist
Posts: 4977
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: [WIP] Tetra Yacht - a glitter ship

Post by Cholmondely »

submersible wrote: Thu Mar 07, 2013 1:06 pm
Work in progress , experimenting with modelling and shaders for ships. The Glitter ship 'Tetra Yacht' , preferred vessel of the incredibly vain.

http://swarm.perlide.org/static/Glitter-beta.oxp.zip

If anyone can tell me why the ballturret is only working for system populated ships and not the player... that would be great.
Edit: thank you Commander McLane for pointing out how this happened.

Image
I've listed this as a lost oxp. If there is a working .oxp anywhere, I'd be happy to create a page for it.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
Post Reply