Difference between revisions of "HowTo:Add Ships"

From VsWiki
Jump to: navigation, search
(moved page as primary model page - this guide was the intended design type for initial reading.)
m (links)
Line 1: Line 1:
 
{{NAV_Manual |
 
{{NAV_Manual |
| previous=[[HowTo:Texture in Wings3d|Texture in Wings3d]]
+
| previous=[[Database]]
 
| up=[[HowTos]]
 
| up=[[HowTos]]
| next=[[HowTo:Add LODs|Add Levels Of Detail]]
+
| next=[[HowTo:Create_Models|Create Models]]
 
}}
 
}}
 
----
 
----
Line 108: Line 108:
 
----
 
----
 
{{NAV_Manual |
 
{{NAV_Manual |
| previous=[[HowTo:Texture in Wings3d|Texture in Wings3d]]
+
| previous=[[Database]]
 
| up=[[HowTos]]
 
| up=[[HowTos]]
| next=[[HowTo:Add LODs|Add Levels Of Detail]]
+
| next=[[HowTo:Create_Models|Create Models]]
 
}}
 
}}
  
 
[[Category:HowTos|Add Ships]]
 
[[Category:HowTos|Add Ships]]

Revision as of 06:59, 18 July 2005

arrow_left.png Database arrow_up.png HowTos Create Models arrow_right.png

(General FIXME notice: I was kinda tired when I wrote this article, please keep an eye out for and correct my flagrant spelling mistakes, capitilization inconsistencies, etc. I wrote almost the entire thing from memory, so there may be a few factual errors as well, sorry.)


Introduction

So you want to create a new ship for Vega Strike do you? While virtually all models are welcome, well before you start cranking out wonderfully designed models we request that you first check what models are still required. Refer to this link or contact the Minister of Information to find out what ships need to be modelled.

This article is a general guide on how to take your ship mesh all the way from your modelling suite of choice into the bowels of Vega Strike. Feel free to use any modelling program, but it must be able to export models in either .obj or .xmesh format.

Before we begin, here are the files/executables you need to know about:

  • .obj+.mtl - the standard alias wavefront mesh format.
  • .wings - Wings3D file format. see Creating a 3D-model using Wings3D for detailed information on using Wings3D to create your model.
  • .xmesh - XML-Mesh format. A simple, manually editable file format designed for Vega Strike.
  • .bfxm - (Binary Formatted XMesh) A compiled .xmesh. Loads much faster than an .xmesh, and can contain multiple xmeshes (for LODs, animations, or models consisting of multiple components).
  • mesher - A command-line utility for converting between .obj+.mtl, .bfxm, and .xmesh formats.
  • units.csv - A comma seperated value spreadsheet which contains information on units that can be used by the game.

Lastly, we recommend following the processes below in order, until you know what you're doing.

Part One:Creating Your Model

The first (and most enjoyable) job is to design and draw your model (the geometrical object) within your program.

First off, do yourself a favor and line your model up correctly before you begin. For the purposes of Vegastrike, Z+ is forwards and Y+ is up. The model's nose should be pointing forwards along the Z+ axis (so that the Z+ axis would theoretically be visible from the cockpit). The mesh should also be properly centered.

Main article: HowTo:Create_Models

Part Two: From Modelling Suite File Format to BFXM

Now, it's go time! The first step in getting your cool new model into Vega Strike is to export it to a format that Vega Strike understands. Currently, Vega Strike is able to read .obj, .xmesh, and .bfxm files. However, it is best to use the BFXM format, so this guide is written with that in mind. It also assumes that you're running Vega Strike under windows, although Linux-specific information will hopefully be added at some point.

OBJ is a standard, widely supported mesh format. Nearly all modern 3D suites support some form of OBJ import/export. If your modeller can't export to OBJ, see if it can export to some other standard format (like 3ds). You will have to find a 3d converter that can go from that format to OBJ. However, the assumption is that your modeller can export to OBJ.

Okay, so now you've got an .obj file (and probably an .mtl file as well). Move these files into the "bin" folder inside the main Vega Strike directory. Now, start up a command prompt or terminal of some sort, and change your directory to WHEREVER\bin\ . If you run mesher.exe without any arguments, it will print a list of available commands.

Mesher does not try to detect what kind of file you're feeding it, so you need to specify a three-character conversion code as part of the argument. You just want to go from .obj+.mtl to .bfxm right now, so run mesher with the following arguments:

mesher whatever.obj whatever.bfxm obc

The command obc means "obj to bfxm, create output file".

Okay, so now you've got a bfxm. Great! The problem with BFXM is that you can't really edit it by hand, which you need to be able to do in order to add the additional functionality Vega Strike supports (like specularity, damage, or glow maps). These tasks are easily accomplished by converting your BFXM to XMESH. Run mesher with these arguments to do so:

mesher whatever.bfxm whatever.xmesh bxc

Now Prepare to get your hands dirty. Whip out your favorite text editor, cause it's XMESH time!

Note that when using Wings3D, the file format saved is .wings, which is not supported by Vega Strike. However, a Wings3D plugin by pontiac is available to convert .wings to .xmesh when saving the file.

Part Three: XMESHin'

Under ideal conditions, you won't have to hack the xmesh much. To assign specularity maps (which you must do, unless you want your ship to look like a giant mirror), all you need to do is add an attribute to the <Mesh> tag at the beginning of the file. Your basic xmesh header looks like this:

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000" 
blend="ONE ZERO" texture="mycoolship.png" >

The attributes you can add are texture1, texture2, and/or texture3, which correspond to specularity map, damage map, and glowmap respectively.

<Mesh scale="1.000000" reverse="0" forcetexture="0" sharevert="0" polygonoffset="0.000000"
blend="ONE ZERO" texture="mycoolship.png" 
texture1="mycoolshipPPL.png" texture2="mycoolshipDMG.png" texture3="mycoolshipGLO.png" >

(FIXME : PPL is correct nomenclature for specmaps, but I made up DMG and GLO. What should these files be named?)

Main article: HowTo:Add Per Pixel Lighting

Damage maps and glowmaps are optional. If you don't want to make a specmap, or if you want your ship to be completely matte (nonreflective), simply create a 1x1 black image and assign it as texture1.

While you have your imaging tools out, now is a good time to cope with a little bug in mesher. It inverts the UV coordinates of your mesh, so you'll need to flip your texture vertically and re-save it. If your texture is in a lossy format like JPEG, work from the master if possible. PNG shouldn't be an issue.

Once you have all your additional maps referenced in the <Mesh> tag, you're ready to go back to BFXM. Run mesher with the following argument:

mesher whatever.xmesh whatever.bfxm xbc

Your mesh is now primed and ready for insertion into Vega Strike!

Multiple Xmeshes

In some cases, mesher will generate multiple xmeshes from a single bfxm. If this is the case, you'll need to reconstruct the bfxm by first converting the main xmesh file to bfxm normally, and then running mesher as many times as needed with the following argument:

mesher #_#.xmesh whatever.bfxm xba

Where xba means "xmesh to bfxm, append". Usually, #_# will be something like 1_0. (FIXME - What do the numbers signify? Is the second number a corresponding LOD?) Once you have appended all the additional xmeshes to the bfxm file, you should be good to go.

FIXME - Need info on how to append LODs to a mesh.

Main article: HowTo:Add LODs

Part Four: Units.csv

Now comes the time to get into the real nitty gritty and associate some data with your mesh that will tell the game how it should be used. Most spreadsheet programs can open .csv files. You can use popular software such as Microsoft Excel or OpenOffice.org Calc to edit units.csv. As an alternative, GAlex has written a nice, lightweight .csv editor tailored to work well with units.csv. (Download here.)

Once you've loaded up units.csv, start by looking in the first column for a ship that you think is reasonably similar to your own. If you're not sure, llama.begin is a good place to start. The data for each ship occupy a single row, so once you've found it, select the entire line and duplicate it. Change the unit name to whatever your shipname is. Avoid spaces and special characters in column one, since it is a name used internally by vegastrike. (FIXME - Is that even true?)

In column two, change the pathname to whatever directory you want to place your ship in. "./whatever" Means "VSINSTALLDIR\units\whatever\", so you'll want to make a new folder called "whatever" in the units directory and copy your BFXM and textures into it.

Main article: HowTo:Edit units.csv

You probably want to specify what types of mount points your ship has (various missiles, guns, turrets, etc.) These can be edited in the "Mounts" column. On the left of the mounts column is the "Light" column, which gives the location and type of your ship's engine flare graphics. Light, mount, and even cockpit positions are specified with X,Y,Z coordinates on your mesh.

Main article: HowTo:Add Engine Glow

Part Five: Testin' Time

Okay, that's enough to test your ship in-game. (Note: if you just want to quickly test how your mesh looks in-game without mucking about in units.csv, try swapping it out with the llama mesh, or the mesh of whatever ship you happen to be flying in VS currently).

Since your new ship isn't yet listed as a purchaseable item (and doing so is beyond the current scope of this article), you'll have to hack a save file to test it. Start by going into your VSINSTALLDIR\.vegastrike\save\ directory and copying one of your save files. Then, open the copy up in a text editor. The first line should resemble this:

Crucible/Cephid_17^13500000.000000^whatever 209160449.772106 -62167111.692738 193000385.631824

After the second caret (^) symbol, you should see a ship name. Change this to whatever you named your ship in the first column of its units.csv row, and save.

You are now ready to see your ship in action! Load up Vega Strike and load your new save game file.

Now, you can either stop, satisfied with your achievement, or return to units.csv and toil endlessly to balance your ships' stats correctly. Which will it be? :-P


arrow_left.png Database arrow_up.png HowTos Create Models arrow_right.png