Page 1 of 1

Multiple Ship Variants

Posted: Thu Dec 24, 2009 11:41 am
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?

Posted: Thu Dec 24, 2009 12:21 pm
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.

Posted: Thu Dec 24, 2009 1:01 pm
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.

Posted: Thu Dec 24, 2009 2:14 pm
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.

Posted: Fri Jan 01, 2010 12:58 pm
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)

Posted: Fri Jan 01, 2010 4:17 pm
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.