Page 1 of 2

Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 10:33 am
by Shipbuilder
I am in the process of developing a new ship OXP and would like to use a variety of different ship textures for the different roles.

For example the player ship would have one texture but the OXP would then use different textures for a ship with other roles such as police, pirate etc.

I am putting together different texture files at the moment as follows:-

Myshipname.png
Myshipname_police.png
Myshipname_pirate.png

Would anyone be able to post an example of Openstep code that I can use to achieve this ?

Any help with this would be much appreciated. :wink:

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 10:41 am
by cim
The easiest way to do this is with [EliteWiki] like_ship.

Code: Select all

"myship" = {
   ...
   roles = "pirate";
   materials = "myship_pirate.png";
   ...
};

"myship-police" = {
   like_ship = "myship";
   scan_class = "CLASS_POLICE";
   roles = "police";
   materials = "myship_police.png";
   ...
}

"myship-player" = {
   like_ship = "myship";
   materials = "myship_player.png";
   ...
}

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 10:44 am
by Shipbuilder
cim - Thank you for your very prompt response and detailed example. :D

Much appreciated.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 10:50 am
by Smivs
You need to like_ship them. Try this and just fill in the gaps with the correct specs.

Code: Select all

{
	"myship" =
	{
		aft_eject_position = "0.0 -4.5 -23.0";
		ai_type = "route1traderAI.plist";
		auto_ai = yes;
                *** other code **
                materials = 
		{ 
	        "myship.png" = 
                               {  
                               emission_map = "myship_em-map.png";s
                               shininess = 10;
                               specular_color = ( 0.3, 0.3, 0.3, 0.5 );  
                               };  
		};
		model = "myship_redux.dat";
		name = "Myship";
		roles = "trader";           
                ***other code ***
        };
        "myship_police" =
	{
		like_ship = "myship";
		ai_type = "route1patrolAI.plist";    
		auto_ai = yes;         
                *** other code ***
                materials = 
		{ 
		"myship.png" = 
                               {  
                               diffuse_map = "myship_police.png";
                               emission_map = "myship_police_em-map.png";
                               shininess = 10;
                               specular_color = ( 0.3, 0.3, 0.3, 0.5 ); 
                               };  
		};
		model = "myship_redux.dat";
		name = "Myship Police";
		roles = "police";   
                *** other code ***
	};
        "myship_pirate" =
	{
		like_ship = "myship";
		ai_type = "pirateAI.plist";
		auto_ai = yes;
                *** other code ***
                materials = 
		{ 
		"myship.png" = 
                               {  
                               diffuse_map = "myship_pirate.png";
                               emission_map = "myship_pirate_em-map.png";
                               shininess = 10;
                               specular_color = ( 0.3, 0.3, 0.3, 0.5 ); 
                               };  
		};
		model = "myship_redux.dat";
		name = "Myship Pirate";
		roles = "pirate";
                *** other code ***
	};
}
Aaaargh! Ninja'd by cim :roll: I made the standard an NPC - if its a player ship then just remove the AI references and add 'Player' as the role, like this

Code: Select all

	"myship-player" =
	{             
like_ship = "myship";
                *** other code **
                materials = 
		{ 
	        "myship.png" = 
                               {  
                               emission_map = "myship_em-map.png";
                               shininess = 10;
                               specular_color = ( 0.3, 0.3, 0.3, 0.5 );  
                               };  
		};
		model = "myship_redux.dat";
		name = "Myship";
		roles = "player";           
                ***other code ***
        };
which will give the player the same texture/em-map as the trader. Of course it can also use a unique texture (as per the pirate and police versions).

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 11:00 am
by Shipbuilder
Cheers Smivs - I have been busily putting together some alternative textures that I am pretty pleased with.

I would post a teaser screenshot or two but I appear to be having problems uploading to Photobucket this morning.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 11:14 am
by Smivs
Look forward to seeing them :)

Re the code above, just to be clear, this will allow you to use just one model for all the varieties. The .dat file will have 'myship.png' (the trader version) as the specified texture, then the police, pirate and player versions will have the correct textures applied.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 11:31 am
by Knotty
Velove e appuntita has a separate Pirate and Police roles textures if you want to have a look

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 3:48 pm
by Tricky
Don't forget to use is_template = yes for the base used by like_ship

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 4:22 pm
by Smivs
Tricky wrote:
Don't forget to use is_template = yes for the base used by like_ship
I don't think this is required/necessary if the 'base' ship (the one you are 'like_ship'-ing to) is an actual ship used in the game, as in my example above.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 4:27 pm
by Tricky
Smivs wrote:
Tricky wrote:
Don't forget to use is_template = yes for the base used by like_ship
I don't think this is required/necessary if the 'base' ship (the one you are 'like_ship'-ing to) is an actual ship used in the game, as in my example above.
Sorry. Was only a quick look on my part. Thought it was a layout for all ships.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 4:47 pm
by Smivs
No worries...it's a good point to make. 'is_template' is essential if the base is purely a template which is not an actual ship used in the game, and we don't know exactly how shipbuilder is structuring his OXP.

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 4:52 pm
by Tricky
Smivs wrote:
No worries...it's a good point to make. 'is_template' is essential if the base is purely a template which is not an actual ship used in the game, and we don't know exactly how shipbuilder is structuring his OXP.
:lol:

Hopefully in a properly structured way. Helpful when it comes to debugging. :wink:

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 10:16 pm
by Rorschachhamster
short related question: Is there a way to make a ship take on a random texture, or would I have to randomize wich ship is used after having all possible textures defined via shipdata.plist?

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 11:28 pm
by Shipbuilder
Thanks gents for your advice and suggestions. I have almost completed the various textures the aim then is to set up a shipdata.plist which will define the player ship with the standard texture then set up in detail one of the npc roles including the alternative option. The remaining npc ships can then be set up using the like_ship method.

Once I've got everything set up and have carried out some play-testing would anyone be willing to take a look at a pre-release version of this oxp as it is the first one I have looked at using Openstep ?

Re: Alternative ship texture for different ship roles

Posted: Sat Nov 17, 2012 11:33 pm
by Shipbuilder
Rorschachhamster wrote:
short related question: Is there a way to make a ship take on a random texture, or would I have to randomize wich ship is used after having all possible textures defined via shipdata.plist?
As far as I am aware this is not possible but I'm sure one of the noggins will be along shortly to confirm either way.

I do think that this would be a great option.

A question to the development team - If this is not currently an option would there be any chance that this could be looked at for a future release ?