Firstly, I want to thank Inzane for this.
INZANE'S step-by-step tutorial: "How to get your ship in-game properly, using Maya"
Before you begin, you have to scale the ship correctly. You must export a ship from the game and load it into Maya. Then, scale your ship to the size of the imported game ship.
If you don't, your ship will be huge and as big as the world map. This is where you start to get it in game. I will guide you to the next step.
The next step is to split the main model into separate model files:
The path model is a one-sided mesh of the parts of the deck which the player can walk around in 1st Person mode at sea. Its polygons are inverted so it is invisible in-game.
Without this, the game will crash when you try to enter 1st Person sailing. Also, make sure it has a texture mapped to it, just like a normal model, or it won't convert to GM format.
We will now move onto adding the first set of locators, and then do a test convert to check the ship in-game.
We also figure out some of Maya's functions, but it may take a few tries to get the model to work correctly.
Step 1
Got to the create tab and click: "Create a locator". This will be named 'locator1'. Place this locator where you want the ship's waterline without cargo and other excess weight.
This because the ship, when loaded with cargo, will settle deeper into the water. Cool and realistic.
Step 2
First go to your General tab. Click the 'Hypergraph' sub-tab. This will open a new screen where you will see your new locator and your mesh.
Now we have to make two more locators, but this time one named "Path". Move this locator to line up with the deck. Name the other locator "Camera", and place it where you want the player to see from during 1st Person mode.
Note this position is where the camera starts off in-game, and the player can move it around the path model freely. They also should show up in your hypergraph sub-tab.
Take note in the 'General' tab there are four sub-tab icons of blue squares and balls. If you look at them, they are 'Group, Ungroup, Parent and Unparent'. We will be using them in Step 3.
Step 3a
You should at this point have your 'Hypergraph' open. We should see all the new locators you have created so far.
In hypergraph, click the 'Path' locator so it becomes highlighted yellow, and then click the 'Group' icon. Now it should have created a white box that says 'Group1'.
Right click it and rename it to 'Geometry'.
Now you have to click the names in the following order (and only in this order, or it will screw everything up!)
Hold down your 'shift' key and select: Camera, Geometry and your 3d model, and then locator1. All these should be highlighted yellow.
Now, click the sub-tab "Parent". Everything should now be connected in a tree, and should show up connected in the reverse order that you clicked them. Locator1, 3d model, Geometry-->path, Camera.
Step 3b
Open your path model, and make a new locator named 'locator1'. Line it up as close to the model as you can, dead centre, and open the Hypergraph window.
Click, holding shift again, in this order: 3d model, then locator1. Both should be yellow; now hit sub-tab 'Parent'. It should have locator1 on top and 3d model on the bottom. Save the file.
Step 4
Now we shall convert the model as a test. Open the plug-in and save as a GM file. This may take a few minutes. Also, convert your path model to GM. If it converts, that's a good sign.
Next, convert all the textures to TGA.TX if you haven't already done so. Put them in RESOURCE/Textures/Ships. Next, make a new folder for the ship, called "[shipname]". This MUST match the ship name used for all the individual model files.
Now we are going to do a quick test. Open your ship model in GM Viewer. If it loads and looks good with the textures, check to see if the locators are there. Then, we are in good shape.
We should be able to do a test in-game, if all has gone well so far. The quickest method of getting the ship coded in is to copy the stats of a similar existing ship in 'ships_init.c', and replace the necessary lines specific to your ship.
Once finished, start the game and you should know right away if something is wrong. The game will crash if the conversion was not entirely successful, or is the coding wasn't done correctly. If not, then things are going well.
If your ship looks too big/small relative to ships of a similar size, re-size the model in Maya and re-convert it again. Make sure the locators stay where they should be, though.
Step 5
We shall now add the cannon locators.
Firstly, create the locators one by one, and place them at the opening of each gun. They need to be named "_1", "_2", "_3" etc.
After you have that done, you need to create groups for each side. Select all the gun locators on the right side, group them, and name the group "cannonr".
Each side has to be done in the same way, in the format: left = cannonl, front = cannonf, back = cannonb. Make sure all the locators are facing the same direction that the cannon will fire in.
Once you have all the gun locators grouped neatly, you need to parent them to the main locator1. First, click 'cannonr' and then 'locator1', and hit 'Parent'. After that been done for all four sides, convert the mesh for another test in-game.
If you notice some weird firing in-game, make note of the sides having the problem and go back to Maya to adjust the locators' directions. Save, test again, and repeat until all guns fire in the correct direction.
Step 6
Next, we must add the mast locators.
These locators go on the hull model, and are named 'mast#', with # being the mast number. You will need to parent these locators to the 'Geometry' group which was made earlier.
You have to put them where you want the masts to be placed on the hull (mast1 is the front of the ship, followed by mast2, etc).
Next, save the file and open the 'mast1' model. The first thing to do is centre the bottom of the mesh at (0,0,0). Then, add a locator named 'mast1', and place it where the mast will meet the hull.
Parent the model to the mast1 locator, and you're done! Convert it and place it in the folder. The same thing has to be done for the rest of the masts.
Next, do another test in-game. If there are any problems, the game will crash. You may also have a problem with the direction the masts face. Go back into the Maya and rotate the locators to face forward.
Step 7
Now we need to add the yards (rey models).
Open each mast mesh in turn, and make the necessary locators for every yard on that mast. Name them "rey_a#", "rey_b#" etc.
Place them where you want them on the mast, put them in a group named 'Geometry', and parent them to the corresponding mast locator.
Now open every rey mesh individually, centre the mesh on the grid, and create a locator with the rey's exact name. Move it to where you want it, and parent the mesh to it. Save the files.
Step 8
Time to add sails to every rey model. (Again, you may have to rotate locators if placement of reys is not right.)
First open one of the rey files. Make four locators and name them 'sail1',' sail2', 'sail3' and 'sail4'. Place them as they would be at full sail, in this format (seen from the front):
sail2--------------sail1
------------------------
------------------------
------------------------
sail3--------------sail4
Group the locators and name the group "saild", then parent it to the rey locator. Note that 'saild' corresponds to normal square sails, 'sailf' is for spankers, lateens and four-sides stays, and 'sailt' is for triangular stays.
Use this format for triangular sails:
sail2
------
------------------
-----------------------
sail3--------------------sail1
Step 9
Finally, we need to add ropes, ratlines, and flags.
Making ropes is like drawing a line; you have a beginning and an end. It works like this: ropeb1------------------ropee1. Rope beginning/ends can be on the same model, or they can belong to separate models; they will still link up either way.
To add more ropes you just change the number (ropeb2---ropee2 etc), and just parent them to the main locator of their respective models.
The ratlines ('vants') are made up of 3 locators: one for the top (vant1u) and two for the bottom (vant1l and vant1r). The two bottom locators go onto the hull mesh, while the top locator goes on to the mast.
Once you have all the vants placed, you have to group them and you name the group "vants". Then, parent them to the main locator. To add more vants, just change the number, as with ropes.
Flags are added in the same way as the sails. Make four locators named "f1, f2, f3, and f4". Place them where you want, in this format:
f2-------------f1 [mast]
----------------- [mast]
----------------- [mast]
f3-------------f4 [mast]
Once done, put them in a group called "flag1" and parent it the the main locator.
Important: to get the flags to work properly with all versions of Build 14, you must make two versions of all flag locators.
One set is the 'flag' group, and the other is the 'penn' group. In 'ships_init.c', find the lines for the flags in your ship's entry, and set the pennants and ensigns there.
Convert all files once more to test in-game. If all works well, the whole process was a success!
INZANE'S step-by-step tutorial: "How to get your ship in-game properly, using Maya"
Before you begin, you have to scale the ship correctly. You must export a ship from the game and load it into Maya. Then, scale your ship to the size of the imported game ship.
If you don't, your ship will be huge and as big as the world map. This is where you start to get it in game. I will guide you to the next step.
The next step is to split the main model into separate model files:
- The hull is simply "[shipname].gm";
- The masts, from bow to stern, are: "[shipname]_mast1.gm", "[shipname]_mast2.gm"... etc;
- The horizontal yards are, in ascending height on the mast: "[shipname]_rey_a#.gm", "[shipname]_rey_b#.gm"... etc, where # is the number of the mast to which the yard is attached. It is important to note that the lowest yard on each mast must be 'rey_a#', as the game recognises these as the sails to strike in the 'Battle Sails' state. Usually, 'rey_c#' is the topmost yard, but ships with more yards can also go up to 'rey_d#'. Also, spankers or lateen rudder sails are usually named 'rey_aX', where X is the number of the mast closest to the stern.
- Any extra parts which must be attached to the model can be called anything in the format: "[shipname]_[anything].gm".
The path model is a one-sided mesh of the parts of the deck which the player can walk around in 1st Person mode at sea. Its polygons are inverted so it is invisible in-game.
Without this, the game will crash when you try to enter 1st Person sailing. Also, make sure it has a texture mapped to it, just like a normal model, or it won't convert to GM format.
We will now move onto adding the first set of locators, and then do a test convert to check the ship in-game.
We also figure out some of Maya's functions, but it may take a few tries to get the model to work correctly.
Step 1
Got to the create tab and click: "Create a locator". This will be named 'locator1'. Place this locator where you want the ship's waterline without cargo and other excess weight.
This because the ship, when loaded with cargo, will settle deeper into the water. Cool and realistic.
Step 2
First go to your General tab. Click the 'Hypergraph' sub-tab. This will open a new screen where you will see your new locator and your mesh.
Now we have to make two more locators, but this time one named "Path". Move this locator to line up with the deck. Name the other locator "Camera", and place it where you want the player to see from during 1st Person mode.
Note this position is where the camera starts off in-game, and the player can move it around the path model freely. They also should show up in your hypergraph sub-tab.
Take note in the 'General' tab there are four sub-tab icons of blue squares and balls. If you look at them, they are 'Group, Ungroup, Parent and Unparent'. We will be using them in Step 3.
Step 3a
You should at this point have your 'Hypergraph' open. We should see all the new locators you have created so far.
In hypergraph, click the 'Path' locator so it becomes highlighted yellow, and then click the 'Group' icon. Now it should have created a white box that says 'Group1'.
Right click it and rename it to 'Geometry'.
Now you have to click the names in the following order (and only in this order, or it will screw everything up!)
Hold down your 'shift' key and select: Camera, Geometry and your 3d model, and then locator1. All these should be highlighted yellow.
Now, click the sub-tab "Parent". Everything should now be connected in a tree, and should show up connected in the reverse order that you clicked them. Locator1, 3d model, Geometry-->path, Camera.
Step 3b
Open your path model, and make a new locator named 'locator1'. Line it up as close to the model as you can, dead centre, and open the Hypergraph window.
Click, holding shift again, in this order: 3d model, then locator1. Both should be yellow; now hit sub-tab 'Parent'. It should have locator1 on top and 3d model on the bottom. Save the file.
Step 4
Now we shall convert the model as a test. Open the plug-in and save as a GM file. This may take a few minutes. Also, convert your path model to GM. If it converts, that's a good sign.
Next, convert all the textures to TGA.TX if you haven't already done so. Put them in RESOURCE/Textures/Ships. Next, make a new folder for the ship, called "[shipname]". This MUST match the ship name used for all the individual model files.
Now we are going to do a quick test. Open your ship model in GM Viewer. If it loads and looks good with the textures, check to see if the locators are there. Then, we are in good shape.
We should be able to do a test in-game, if all has gone well so far. The quickest method of getting the ship coded in is to copy the stats of a similar existing ship in 'ships_init.c', and replace the necessary lines specific to your ship.
Once finished, start the game and you should know right away if something is wrong. The game will crash if the conversion was not entirely successful, or is the coding wasn't done correctly. If not, then things are going well.
If your ship looks too big/small relative to ships of a similar size, re-size the model in Maya and re-convert it again. Make sure the locators stay where they should be, though.
Step 5
We shall now add the cannon locators.
Firstly, create the locators one by one, and place them at the opening of each gun. They need to be named "_1", "_2", "_3" etc.
After you have that done, you need to create groups for each side. Select all the gun locators on the right side, group them, and name the group "cannonr".
Each side has to be done in the same way, in the format: left = cannonl, front = cannonf, back = cannonb. Make sure all the locators are facing the same direction that the cannon will fire in.
Once you have all the gun locators grouped neatly, you need to parent them to the main locator1. First, click 'cannonr' and then 'locator1', and hit 'Parent'. After that been done for all four sides, convert the mesh for another test in-game.
If you notice some weird firing in-game, make note of the sides having the problem and go back to Maya to adjust the locators' directions. Save, test again, and repeat until all guns fire in the correct direction.
Step 6
Next, we must add the mast locators.
These locators go on the hull model, and are named 'mast#', with # being the mast number. You will need to parent these locators to the 'Geometry' group which was made earlier.
You have to put them where you want the masts to be placed on the hull (mast1 is the front of the ship, followed by mast2, etc).
Next, save the file and open the 'mast1' model. The first thing to do is centre the bottom of the mesh at (0,0,0). Then, add a locator named 'mast1', and place it where the mast will meet the hull.
Parent the model to the mast1 locator, and you're done! Convert it and place it in the folder. The same thing has to be done for the rest of the masts.
Next, do another test in-game. If there are any problems, the game will crash. You may also have a problem with the direction the masts face. Go back into the Maya and rotate the locators to face forward.
Step 7
Now we need to add the yards (rey models).
Open each mast mesh in turn, and make the necessary locators for every yard on that mast. Name them "rey_a#", "rey_b#" etc.
Place them where you want them on the mast, put them in a group named 'Geometry', and parent them to the corresponding mast locator.
Now open every rey mesh individually, centre the mesh on the grid, and create a locator with the rey's exact name. Move it to where you want it, and parent the mesh to it. Save the files.
Step 8
Time to add sails to every rey model. (Again, you may have to rotate locators if placement of reys is not right.)
First open one of the rey files. Make four locators and name them 'sail1',' sail2', 'sail3' and 'sail4'. Place them as they would be at full sail, in this format (seen from the front):
sail2--------------sail1
------------------------
------------------------
------------------------
sail3--------------sail4
Group the locators and name the group "saild", then parent it to the rey locator. Note that 'saild' corresponds to normal square sails, 'sailf' is for spankers, lateens and four-sides stays, and 'sailt' is for triangular stays.
Use this format for triangular sails:
sail2
------
------------------
-----------------------
sail3--------------------sail1
Step 9
Finally, we need to add ropes, ratlines, and flags.
Making ropes is like drawing a line; you have a beginning and an end. It works like this: ropeb1------------------ropee1. Rope beginning/ends can be on the same model, or they can belong to separate models; they will still link up either way.
To add more ropes you just change the number (ropeb2---ropee2 etc), and just parent them to the main locator of their respective models.
The ratlines ('vants') are made up of 3 locators: one for the top (vant1u) and two for the bottom (vant1l and vant1r). The two bottom locators go onto the hull mesh, while the top locator goes on to the mast.
Once you have all the vants placed, you have to group them and you name the group "vants". Then, parent them to the main locator. To add more vants, just change the number, as with ropes.
Flags are added in the same way as the sails. Make four locators named "f1, f2, f3, and f4". Place them where you want, in this format:
f2-------------f1 [mast]
----------------- [mast]
----------------- [mast]
f3-------------f4 [mast]
Once done, put them in a group called "flag1" and parent it the the main locator.
Important: to get the flags to work properly with all versions of Build 14, you must make two versions of all flag locators.
One set is the 'flag' group, and the other is the 'penn' group. In 'ships_init.c', find the lines for the flags in your ship's entry, and set the pennants and ensigns there.
Convert all files once more to test in-game. If all works well, the whole process was a success!