Page 1 of 1

Lost begginer

Posted: Wed Mar 17, 2021 6:26 am
by Vorm
Hello all. :)

I want to start creating my first OXP. I run OSX on my Mac and a competent blender user. I am however completely lost when it comes to encoding. :P I am also new to these forums. I wish to create a new ship as my first OXP. I was wondering if you would all be so kind as to point me in the direction of relevant material related to creating ship OXPs from blender models in OSX?

Thank you. :)

Re: Lost begginer

Posted: Wed Mar 17, 2021 6:40 am
by maik
Vorm wrote: Wed Mar 17, 2021 6:26 am
Hello all. :)

I want to start creating my first OXP. I run OSX on my Mac and a competent blender user. I am however completely lost when it comes to encoding. :P I am also new to these forums. I wish to create a new ship as my first OXP. I was wondering if you would all be so kind as to point me in the direction of relevant material related to creating ship OXPs from blender models in OSX?

Thank you. :)
Welcome to the BB, Vorm! Have you had a chance to look at the two threads about building ships and using Blender for this yet?

Re: Lost begginer

Posted: Wed Mar 17, 2021 7:45 am
by Cholmondely
Vorm wrote: Wed Mar 17, 2021 6:26 am
Hello all. :)

I want to start creating my first OXP. I run OSX on my Mac and a competent blender user. I am however completely lost when it comes to encoding. :P I am also new to these forums. I wish to create a new ship as my first OXP. I was wondering if you would all be so kind as to point me in the direction of relevant material related to creating ship OXPs from blender models in OSX?

Thank you. :)

Welcome, fellow Mac user! I can't help with the oxp end of things (I can't even get Oolite to recognise the existence of my "new OXP", never mind run it!) ... but if I can help in any other way, I'd be delighted!

Cholmondeley

Re: Lost begginer

Posted: Wed Mar 17, 2021 7:53 am
by another_commander
Welcome Vorm. The wiki has a few helpful pages about how to set up expansion packs. You can start from here: http://wiki.alioth.net/index.php/OXP_howto

Re: Lost begginer

Posted: Wed Mar 17, 2021 8:08 pm
by tsoj
Hi,
You said you already know Blender, so I'll try to fill in the bits from there.

Once you finished creating a model (including UV maps and textures), you export the model as .obj file ("Wavefront OBJ"). This file needs to be converted to a .dat file. To do this you can download these tools: https://github.com/OoliteProject/oolite-mesh-converters then you can execute 'Obj2DatTexNorm.py' with python2 like this to get an Obj file:

Code: Select all

python2 ./Obj2DatTexNorm.py ./yourmodelfile.obj
(I use Linux, so it might be different on Mac).

Now you can open the .dat file in a text editor. When you search for "NAMES" you should find a list of predefined names of the objects in your original blender model. For the sake of simplicity I suggest you start by only having a single object, just because the "encoding" stuff is a bit simpler. So assuming you have only one object in your model, you delete every line below "NAMES" until the next section (for example "NORMALS"). Then you instead write something there like "hull" that basically describes your single object.

Okay, now we're done with the dat file. Now you need to create the file structure for your OXP. For a simple ship it should probably be just this:

Code: Select all

folder: youroxpname.oxp
    folder: Textures
        yourtexture.png
    folder: Models
        yourmodelfile.dat
    folder: Config
        shipyard.plist
        shiplibrary.plist
        shipdata.plist
    requires.plist
 
.plist files are just simple text files with different file-suffix

In requires.plist you only write this:

Code: Select all

{ version="1.90"; }
This will be the minimal version of Oolite that your OXP requires.

shipdata.plist is the most complex file. In fact, I don't 100% know everything about it. There's a wiki article about it that will definitely be helpful: http://wiki.alioth.net/index.php/Shipdata.plist

Here is an example on how it could look like:

Code: Select all

{
	"nameofyourship" = 
	{
		name = "Name Of Your Ship";

		ai_type = "route1traderAI.plist";
		auto_ai = yes;
		auto_weapons = yes;
		cargo_type = "CARGO_NOT_CARGO";
		frangible = no;

		energy_recharge_rate = 4.6;
		fuel = 70;
		likely_cargo = 5;
		max_cargo = 9;
		max_energy = 200;
		max_flight_pitch = 1.5;
		max_flight_yaw = 1.2;
		max_flight_roll = 2.0;
		max_flight_speed = 330;
		thrust = 30;
		max_missiles = 4;

		roles = "
			player
			assassin-medium(0.1)
			escort-medium(0.08)
			hunter-medium(0.2)
			hunter-heavy(0.1)
			pirate(0.04)
			pirate-medium-fighter(0.08)
			pirate-heavy-fighter(0.1)
			pirate-light-freighter(0.05)
			trader(0.1)
			trader-courier(0.06)
			trader-smuggler(0.15)
		";
			
		has_ecm = 0.2;
		has_escape_pod = 0.7;
		has_scoop = 0.8;

		materials =
		{
			"hull" =
			{
				gloss = 1.0;
				specular_color = (0.2, 0.2, 0.2);
				shininess = 42;
				emission_map = "youremmisiontexture.png";
				normal_map = "yournormaltexture.png";
				specular_map = "yourspeculartexture.png";
				diffuse_map = "yourdiffusetexture.png";
			};
		};

		model = "yourmodelfile.dat";

		exhaust = 
		(		
			"0.0 4.04 -25.4		5.5 3.0 1.0",
			"9.84 -4.76 -15.0	1.3 1.3 1.0", 
			"-9.84 -4.76 -15.0	1.3 1.3 1.0"
		);
		scoop_position = "0.0 24.0 -5.0";
		aft_eject_position = "0.0 -5.0 -20";
		missile_launch_position = "0.0 -4.0 -18";
		view_position_aft = "0.0 11.8 -28.3";
		view_position_forward = "0.0 6.0 20.0";
		view_position_port = "-7.0 6.0 20.0";
		view_position_starboard = "7.0 6.0 20.0";
		weapon_facings = 3;
		weapon_position_aft = ("0.0 10.52 -28.0");
		weapon_position_forward = ("11.4 -8.11 4.0");		
	};
}
It is important, that the name of the material (i.e. "hull") is the same as the name you specified in your .dat file under NAMES.
Oolite uses specular glossy pbr rendering. The gloss values are encoded as the alpha values of the specular map. If you don't know what this is, it might be a good idea, to only use diffuse texture (basically the color) and have a single value for specular/gloss.
Basically everything that look like "7.0 6.0 20.0" is specific for your model. I.e. weapon_position_forward must be at the point where you want the laser to start. You can try to find the x,y,z values for a specific point in blender, they should be the same here.

shipyard .plist describes, where a player can buy this ship and how much it costs or which equipment can be fitted. An example:

Code: Select all

{
	"nameofyourship" =
	{
		chance = 0.1;
		"optional_equipment" =
		(
			"EQ_ECM",
			"EQ_FUEL_SCOOPS",
			"EQ_PASSENGER_BERTH",
			"EQ_ESCAPE_POD",
			"EQ_ENERGY_BOMB",
			"EQ_ENERGY_UNIT",
			"EQ_NAVAL_ENERGY_UNIT",
			"EQ_DOCK_COMP",
			"EQ_WEAPON_PULSE_LASER",
			"EQ_WEAPON_BEAM_LASER",
			"EQ_WEAPON_MINING_LASER",
			"EQ_WEAPON_MILITARY_LASER",
			"EQ_FUEL_INJECTION",
			"EQ_SCANNER_SHOW_MISSILE_TARGET",
			"EQ_MULTI_TARGET",
			"EQ_GAL_DRIVE",
			"EQ_ADVANCED_COMPASS",
			"EQ_SHIELD_BOOSTER",
			"EQ_NAVAL_SHIELD_BOOSTER",
			"EQ_HEAT_SHIELD"
		);
		price = 226000;
		"standard_equipment" =
		{
			extras = "";
			"forward_weapon_type" = "EQ_WEAPON_PULSE_LASER";
			missiles = 3;
		};
		techlevel = 7;
		"weapon_facings" = 3;
	};
}
In the wiki there is a page about "shipdata.plist" aswell.
I don't know if shiplibrary.plist is even necessary, but it lets you view your ship when you visit the "View Ship Library" from the start menu (so it provides a quick check if your model renders correctly). It could look like this:

Code: Select all

(
	{
		ship = "nameofyourship";
		class = "ship";
		ship_data = true;
		description = "Name Of Your Ship is a very fast ship that provides luxury to its rich passengers."
	}
)

I know, this is all only a very rough guide, so I don't expect at all that you don't have any question, if you're stuck at any point feel free to ask :)

Re: Lost begginer

Posted: Thu Mar 18, 2021 12:34 am
by montana05
tsoj wrote: Wed Mar 17, 2021 8:08 pm
I don't know if shiplibrary.plist is even necessary, but it lets you view your ship when you visit the "View Ship Library" from the start menu (so it provides a quick check if your model renders correctly). It could look like this:
shiplibrary.plist isn't essential for the ship OXP, it just offers additional information to the player.