Multiple Ship Variants

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

Moderators: winston, another_commander

Post Reply
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Multiple Ship Variants

Post by Killer Wolf »

Not sure if i'm missing something obvious but this is something i've come across w/ my Venom, that i meant to bring up during testing my Dominatrix, and forgot :-|

anyways, i've noticed Oolite seems to take the skin texture listed in the DAT over the shipdata entry - what's the reason for that? it's increased the size of my OXP (perhaps negligably, but still) as i now need multiple copies of the dat. i've got, eg, a red skin, blue skin and green skin. if i set up the shipdata as all using simply "venom.dat", as they're all the same ship obviously, they all get the standard skin in the DAT : to get around this i had to copy the DAT and search/replace the texture name in each, and set the shipdata to point at "redvenom.dat", "bluevenom.dat" etc.

just seems a roundabout way of doing things? how come the shipdata doesn't override this?
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

You can use the materials shipdata key to "dye" a given ship texture a different colour, or to chose which texture file gets used. Not ideal either, but can be quite useful if you set things up correctly.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

An example makes it probably more clear:

Code: Select all

	"ups-barrel1" = {
		"like_ship" = "ups-barrel";
		materials = {
			"upsRedBarrel.png" = {
				"diffuse_map" = "upsGreenBarrel.png";
				shininess = 10;
				specular = ("0.3", "0.3", "0.33", "1.0");
			};
		};
		roles = "cargopod(0.11)";
	};
In ups I only have one .DAT file for the ups-barrel, defining a "upsRedBarrel.png" texture. Than, for the other barrels I use a definition in materials to replace upsRedBarrel.png by upsGreenBarrel.png for that barrel.
User avatar
Killer Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 2278
Joined: Tue Jan 02, 2007 12:38 pm

Post by Killer Wolf »

well y'bugger. another whole aspect of the game i didn't know about!

cheers for that info, i'll play around w/ the next OXP i do.
User avatar
ADCK
---- E L I T E ----
---- E L I T E ----
Posts: 771
Joined: Thu Dec 24, 2009 12:30 am
Location: Sydney
Contact:

Post by ADCK »

Killer Wolf wrote:
well y'bugger. another whole aspect of the game i didn't know about!

cheers for that info, i'll play around w/ the next OXP i do.
What eric listed is one way of overwriting the texture,
if you're using shaders it's pretty much the same thing, only lengthier cause of more options. eg:
(shaders can be tricky to work with, i suggest reading up on the wiki about shaders in oolite... if you can't use shaders on your comp, ignore this post) :P

Code: Select all

shaders =
{
	"original_texture.png" =
	{
		"vertex_shader" = "insert-vertex-filename-here";
		"fragment_shader" = "insert-fragment-filename-";
		textures =
		(
			"new_texture.png",
			"new_textures_effectsmap.png",
			"new_textures_normalmap.png"
		);
		uniforms =
		{
			uColourMap = { type = texture; value = 0; };
			uFXMap = { type = texture; value = 1; };
			uNormalMap = { type = texture; value = 2; };
			SpecularRGB = { type = vector; value = "1.0 0.7 0.5 1.0";};
			uTime = "universalTime";
			uEngineLevel = "speedFactor";
			uHullHeatLevel= "hullHeatLevel";
		};
	};
};
(the utime/uengine/uhull stuff is for the effects, shaders, not really relevant here)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Interestingly enough, I did the same thing in Oolite’s own shipdata.plist just a few weeks ago, e.g.:

Code: Select all

    "cobramk1-alt" =
    {
        like_ship = "cobramk1";
        ai_type = "pirateAI.plist";
        energy_recharge_rate = 3.75;
        forward_weapon_type = "WEAPON_BEAM_LASER";
        has_fuel_injection = 0.25;
        has_shield_booster = 0.25;
        max_energy = 200;
        materials =
        {
            "cobra1_redux.png" = { diffuse_map = "cobra1_redux1.png"; };
        };
        roles = "pirate";
        thrust = 30;
    };
This is possible thanks to the materials model introduced in 1.69, which also allows you to add a variety of effects without writing your own shaders.
Post Reply