Oolite : Create Your Own Ship

This tutorial uses Meshwork, the low-poly modeler used to create Oolite's ships.

The files and the DropMesh2DatTex tool used in this tutorial are available here (800Kb).

Click the thumbnails for larger versions of the pictures.
picture_1
Open up Meshwork and change a couple of settings - we'd like to see the grid, so click that, and select Blueprint view.
picture_2
Our ship is going to be based on a simple 8 sided cone, which we create with height 60, and diameter 40, and a closed base.
picture_3
Here's the cone, we've zoomed in a bit so it's easier to see.

Oolite ships are aligned to point along the z-axis, so we need to rotate this 90 degrees.
We need to have all the points selected (red) before we do this.
picture_4
Choose to rotate about the origin (0,0,0), 90 degrees around the x-axis.
picture_5
Here's our basic cone ready to become a ship.
picture_6
We want to stretch out the base a bit, so we select the central point...
picture_7
... and pull it along the z-axis a little. Now our cone is more of a 'spinning-top' shape.
picture_8
We want to flatten the shape somewhat (as if it has been sat upon), this will affect the whole shape so we need to select all the points again.
picture_9
And apply a 50% scale in the y dimension. Note that once again we are scaling from the origin (0,0,0).
picture_10
The result is a flattened spinning top shape. We're through changing the geometry at this stage. If you haven't done so yet, now's a good time to save!
picture_11
We saved as oogie.mesh, now we can consider texturing.
First we select points that will be part of the top of the ship and will have a single texture file. Here we use the front top quarter of the ship.
picture_12
We assign these points and triangles one of the material colors, in this case dark blue, by clicking the dark blue materials box in the top-right.
picture_13
Now the same, but on the underside.
picture_14
We assign these points and triangles the light blue material.
picture_15
Thirdly, the rear section of the ship. This will be all one texture.
picture_16
We assign these to the green material, and save the file again.
Now we can choose how those materials will be applied, which will set our basic texture coordinates.

Deselect all the points (or we'll end up assigning materials to points we don't necessarily want), then double click the blue material box...
picture_17
First, we supply a texture name oogie_top.png then select a way for it to be applied.
We choose planar projection along the Y axis and hit 'Set:' to place the texture mapped pints as wide as possible. Then press 'OK'
picture_18
The bottom material, light blue, gets oogie_bottom.png, but the same projection as the top.
picture_19
The green, rear materal, gets oogie_rear.png, but this time we choose a planar projection along the Z axis.

That's set all the points projections but it hasn't set any 'u-v' coordinates for the textures. We do this by taking each material in turn again and setting the Mapping to Pinned
picture_20
Pinned top,
picture_21
pinned bottom,
picture_22
and pinned at the rear.
picture_23
picture_24
At this stage I like to open the texture map window for each material and take a snapshot (command-shift-4 then press space, move the camera over the window and press space again), so I have a reference for when I create the textures.
picture_25
The model is complete at this stage, and we can use 3d preview to look at how the untextured model will appear.
picture_25
Next, we have to convert the model for use in Oolite.

Before going on we may want to tidy up the Meshwork file a little.
Open up the saved Meshwork file by dragging it into TextEdit. There you can round values that are close to integers to their integer equivalents (for example, -0.0000006 should become 0).
picture_25
When you are ready you can drag the Meshwork file to DropMesh2DatTex, which will produce the equivalent oogie.dat file.
You can open this file in TextEdit too, to make any changes you feel necessary at this stage, or just to examine the file structure.
picture_25
To create the textures, I took the snapshots I had from the Texture Map earlier, trimmed off the top and bottom, and dragged them into my art package. I use Omnigraffle for creating skins, but Photoshop, The Gimp, Painter or any other art package should* do just as well.

This is the Omnigraffle file for this tutorial.

*It seems Meshwork has some problems with png files from Photoshop, causing parts of ships to disappear. If this happens, try a different file format when copying art into Meshwork. The Photoshop png files should still work just fine with Oolite
oogie_top
oogie_bottom
oogie_rear
Once I was happy with the textures, I exported them as oogie_top.png, oogie_bottom.png and oogie_top.png, all at 256x256 pixels.

You'll notice that the textures have been flipped in the vertical axis from the arrangement in Meshwork's texture map. This is because the texture 'u-v's created by DropMesh2DatTex are flipped (a feature I haven't yet corrected).
picture_26
Then I could re-open the Meshwork file and copy and paste the textures into the material dialogs.

With the textures imported back into the Meshwork model, we can take snapshots of it at will. This is a final test of the model before it can be used in Oolite.
The final stage is to move the files into the appropriate places and create a shipdata.plist entry for the new ship.

oogie.dat should go in AddOns/Models/
oogie_top.png, oogie_bottom.png and oogie_top.png should go in AddOns/Textures/

The entry in shipdata.plist should look something like this:
<key>my_oogie_ship</key> <dict> <key>ai_type</key> <string>pirateAI.plist</string> <key>bounty</key> <integer>150</integer> <key>cargo_type</key> <string>CARGO_NOT_CARGO</string> <key>energy_recharge_rate</key> <real>4</real> <key>exhaust</key> <array> <string>0.0 0.0 -6.5 8.0 8.0 12.0</string> </array> <key>forward_weapon_type</key> <string>WEAPON_PULSE_LASER</string> <key>has_ecm</key> <true/> <key>has_escape_pod</key> <true/> <key>has_scoop</key> <false/> <key>likely_cargo</key> <integer>0</integer> <key>max_cargo</key> <integer>0</integer> <key>max_energy</key> <real>300</real> <key>max_flight_pitch</key> <real>1</real> <key>max_flight_roll</key> <real>1.75</real> <key>max_flight_speed</key> <real>250</real> <key>missiles</key> <integer>0</integer> <key>model</key> <string>oogie.dat</string> <key>name</key> <string>Oogie Boogie Ship</string> <key>roles</key> <string>pirate</string> <key>thrust</key> <real>20</real> <key>weapon_energy</key> <real>25</real> </dict>
If this entry is added to shipdata.plist, in AddOns/Config then because it has the roles key set to 'pirate', when pirates are added to a system the oogie ship will be among the ships that are considered.

This concludes the design your own ship tutorial.

The files used in this tutorial are available here (800Kb).