Difference between revisions of "HowTo:Edit Unit Files"

From VsWiki
Jump to: navigation, search
m ([vega-bot] [replace] 5 instances of 'http://vegastrike.sourceforge.net/forums' for 'http://forums.vega-strike.org')
 
(20 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
{{NAV_Manual |
 
{{NAV_Manual |
| previous=[[HowTo:Create Ships in Wings3D|Create Ships in Wings 3D]]
+
| previous=[[HowTo:Edit units.csv|Edit units.csv]]
| up=[[HowTo]]
+
| up=[[HowTos]]
| next=[[HowTo:Edit Mesh Files|Edit Mesh Files]]
+
| next=[[HowTo:Edit HUDs|Editing HUDs]]
 
}}
 
}}
 
----
 
----
 
=EDITING UNIT FILES=
 
=EDITING UNIT FILES=
If you're wondering why you can't find any examples of xunit files in the Vegastrike data set, that's because this file format isn't used anymore. Unit information is stored in units/units.csv in the data directory instead. You can still use the information on this page to create a unit, just append it to units.csv using objconv/ucsv.py in the source directory once you're done. The result isn't guaranteed to be perfect, but if everything else is in order the unit should be flyable and viewable in-game. You can then use a spreadsheet program to handle the rest of it.
+
{{warning_text|
 +
|text=If you're wondering why you can't find any examples of xunit files in the Vegastrike data set, that's because this file format isn't used anymore. Unit information is stored in Units.csv in the data directory instead. You can still use the information on this page to create a unit, just append it to Units.csv using <code>objconv/ucsv.py</code> in the source directory once you're done. The result isn't guaranteed to be perfect, but if everything else is in order the unit should be flyable and viewable in-game. You can then use a spreadsheet program to handle the rest of it.
 +
|}}
  
==Unit File Example==
+
==File example==
Examples taken from the wayfarer ship (now named the llama), for full description see below.
+
Examples taken from the former starting ship 'wayfarer' (now named the llama), for a full description of the XML syntax see below.
<tt>
+
<pre>
 
  <Unit Scale="1">
 
  <Unit Scale="1">
 
   <Cockpit  file="heavy-cockpit.cpt" x="0" y="0" z="0" />
 
   <Cockpit  file="heavy-cockpit.cpt" x="0" y="0" z="0" />
Line 41: Line 43:
 
   <Dock x="0" y="-4.7" z="6" size="10" />
 
   <Dock x="0" y="-4.7" z="6" size="10" />
 
  </Unit>
 
  </Unit>
</tt>
+
</pre>
  
  
==Unit File XML Schema==
+
==XML schema==
The original desciption of the xunit syntax from hellcatv is located in [http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/vegastrike/data/units/description.xunit?rev=HEAD&content-type=text/plain units/description/xunit cvs] (VSD = 5400 kJ (kilojoules).
+
The original description of the xunit syntax from hellcatv is located in '''[http://vegastrike.svn.sourceforge.net/viewvc/vegastrike/trunk/data/documentation/description.xunit?content-type=text%2Fplain SVN (description.xunit)]''' (VSD = 5400 kJ (kilojoules).
  
<'''Unit''' ...> </Unit> - Marks the begin and the end of the unit(file)
+
<code><'''Unit''' ...> </Unit></code> - Marks the begin and the end of the unit(file)
*'''Scale''' - Sets the scaling of the unit in the game
+
* <code>'''Scale'''</code> - Sets the scaling of the unit in the game
*<'''Cockpit''' .../> - Defines a cockpit for the ship.
+
* <code><'''Cockpit''' .../></code> - Defines a cockpit for the ship.
**'''file''' - Points to a cockpit file. Extension <tt>.cpt</tt>
+
** <code>file</code> - Points to a cockpit file. Extension <code>.cpt</code>
**'''x''','''y''','''z''' - Coordinates where the Cockpit should be in the Unit/Ship (in meters)
+
** <code>x</code>,<code>y</code>,<code>z</code> - Coordinates where the Cockpit should be in the Unit/Ship (in meters)
 
** See also [[HowTo:Edit HUDs]].
 
** See also [[HowTo:Edit HUDs]].
*<'''Meshfile''' .../>
+
* <code><'''Meshfile''' .../></code>
**'''file''' - Points to a xmesh-file of the ship. Extension '''.xmesh'''
+
** <code>file</code> - Points to a xmesh-file of the ship. Extension <code>.xmesh</code>
**'''texturestarttime''' - ('''optional''') Defines the starting delay of a mesh animation. See [http://vegastrike.sourceforge.net/forums/viewtopic.php?p=9688#9688 forums] for more.
+
** <code>texturestarttime</code> - ('''optional''') Defines the starting delay of a mesh animation. See [http://forums.vega-strike.org/viewtopic.php?p=9688#9688 forums] for more.
***'''RANDOM''' - Random start delay.
+
*** <code>RANDOM</code> - Random start delay.
 
***time until mesh animation starts
 
***time until mesh animation starts
**'''startframe''' - ('''optional''') Defines the starting-frame of a mesh animation. See [http://vegastrike.sourceforge.net/forums/viewtopic.php?p=9688#9688 forums] for more.
+
** <code>startframe</code> - ('''optional''') Defines the starting-frame of a mesh animation. See [http://forums.vega-strike.org/viewtopic.php?p=9688#9688 forums] for more.
***'''RANDOM''' - Random start-frame.
+
*** <code>RANDOM</code> - Random start-frame.
 
*** number of start-frame
 
*** number of start-frame
*<'''~ShieldMesh'''> - ('''optional''') xmesh-file to use for the shield instead of a sphere. Extension '''.xmesh'''
+
* <code><'''ShieldMesh'''></code> - ('''optional''') xmesh-file to use for the shield instead of a sphere. Extension <code>.xmesh</code>
*<'''~RapidMesh'''> - ('''optional''') xmesh-file to load and use for collisions with other units/ships/... instead of the Meshfile from above (not drawn) Extension '''.xmesh'''
+
* <code><'''RapidMesh'''></code> - ('''optional''') xmesh-file to load and use for collisions with other units/ships/... instead of the Meshfile from above (not drawn) Extension <code>.xmesh</code>
*<'''~BspMesh'''> - ('''optional''') xmesh-file to use for beam and bolt collisions (not drawn) Extension '''.xmesh'''
+
* <code><'''BspMesh'''></code> - ('''optional''') xmesh-file to use for beam and bolt collisions (not drawn) Extension <code>.xmesh</code>
*<'''Mount''' .../> - ('''optional''')('''repeatable''') Specifies a weapon mount
+
* <code><'''Mount''' .../></code> - ('''optional''')('''repeatable''') Specifies a weapon mount
**'''weapon''' - Type of weapon (see [http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/vegastrike/data/weapon_list.xml weapon_list.xml] in the data directory)
+
** <code>weapon</code> - Type of weapon (see '''[http://vegastrike.svn.sourceforge.net/viewvc/vegastrike/trunk/data/weapon_list.xml?content-type=text%2Fplain weapon_list.xml]''' in the data directory)
**'''size''' - size class (which sizes it can hold) and if it's autotracking (goes inside the long string e.g: ''size="LIGHT MEDIUM AUTOTRACKING"'')
+
** <code>size</code> - size class(es)/type(s) and if they are capable of autotracking. The single entries are separated by spaces. e.g: <code>size="LIGHT MEDIUM AUTOTRACKING"</code>
***LIGHT
+
*** <code>LIGHT</code>
***MEDIUM
+
*** <code>MEDIUM</code>
***HEAVY
+
*** <code>HEAVY</code>
***SPECIAL
+
*** <code>SPECIAL</code>
***CAPSHIP-LIGHT
+
*** <code>CAPSHIP-LIGHT</code>
***CAPSHIP-MEDIUM
+
*** <code>CAPSHIP-MEDIUM</code>
***CAPSHIP-HEAVY
+
*** <code>CAPSHIP-HEAVY</code>
***AUTOTRACKING
+
*** <code>AUTOTRACKING</code>
***SPECIAL-MISSILE
+
*** <code>SPECIAL-MISSILE</code>
***LIGHT-MISSILE
+
*** <code>LIGHT-MISSILE</code>
***MEDIUM-MISSILE
+
*** <code>MEDIUM-MISSILE</code>
***HEAVY-MISSILE
+
*** <code>HEAVY-MISSILE</code>
***LIGHT-CAPSHIP-MISSILE
+
*** <code>LIGHT-CAPSHIP-MISSILE</code>
***MEDIUM-CAPSHIP-MISSILE
+
*** <code>MEDIUM-CAPSHIP-MISSILE</code>
***HEAVY-CAPSHIP-MISSILE
+
*** <code>HEAVY-CAPSHIP-MISSILE</code>
**'''ammo''' - how much ammo the gun holds (only needed for ammo needing weapons e.g. missiles,torpedos,...)
+
** <code>ammo</code> - how much ammo the gun holds (only needed for ammo needing weapons e.g. missiles,torpedos,...)
**'''volume''': ('''optional''' see "ammo") how much ammo the gun can hold if you refill
+
** <code>volume</code> - ('''optional''' see "ammo") how much ammo the gun can hold if you refill
**'''x''','''y''','''z''' - location of weapon (in meters ;-))
+
** <code>x</code>,<code>y</code>,<code>z</code> - location of weapon (in meters ;-))
**'''ri''','''rj''','''rk''' - ('''optional''') R-vector forward vector) of gun (assume 0,0,1)
+
** <code>ri</code>,<code>rj</code>,<code>rk</code> - ('''optional''') R-vector forward vector) of gun (assume 0,0,1)
**'''qi''','''qj''','''qk''' - ('''optional''') Q-vector (up vector) of gun (assume 0,1,0)
+
** <code>qi</code>,<code>qj</code>,<code>qk</code> - ('''optional''') Q-vector (up vector) of gun (assume 0,1,0)
*<'''Sound'''> </Sound> - '''nothing yet ???'''
+
* <code><'''Sound'''> </Sound></code> - {{Fixme}} '''nothing yet ???'''
*<'''Defense''' ...> </Defense> -
+
* <code><'''Defense''' ...> </Defense></code> - {{Fixme}}
**'''~HudImage''' - sprite file to use when targetted
+
** <code>HudImage</code> - sprite file to use when targetted {{Fixme}} ''relative to what?''
**'''~ExplosionAni''' - ('''optional''') special explosion to use
+
** <code>ExplosionAni</code> - ('''optional''') special explosion to use
**'''~RepairDroid''' - ('''optional''') strength of repair system (0-6)
+
** <code>RepairDroid</code> - ('''optional''') strength of repair system (0-6)
**'''ECM''' - ('''optional''') type of ECM (Electronic Counter Measure)
+
** <code>ECM</code> - ('''optional''') type of ECM (Electronic Counter Measure)
**<'''Armor''' .../> - Specifies the ships physical armor
+
** <code><'''Armor''' .../></code> - Specifies the ships physical armor
***'''front''' - Forward max armor in VSD
+
*** <code>front</code> - Forward max armor in VSD
***'''right''' - Right armor in VSD
+
*** <code>right</code> - Right armor in VSD
***'''left''' - Left armor in VSD
+
*** <code>left</code> - Left armor in VSD
***'''back''' - Back armor in VSD
+
*** <code>back</code> - Back armor in VSD
**<'''Shields''' .../> - Specifies the ships Shield (electric armor)
+
** <code><'''Shields''' .../></code> - Specifies the ships Shield (electric armor)
***'''front''' - Forward max shields in VSD
+
*** <code>front</code> - Forward max shields in VSD
***'''back''' - Back shields in VSD
+
*** <code>back</code> - Back shields in VSD
***'''recharge''' - Shield regeneration if not violating speed limit in VSD/s
+
*** <code>recharge</code> - Shield regeneration if not violating speed limit in VSD/s
***'''leak''' - ('''optional''') how much leak these shields have (usually 0%) between 0 and 100
+
*** <code>leak</code> - ('''optional''') how much leak these shields have (usually 0%) between 0 and 100
***'''left''' - ('''optional''') Left shields in VSD
+
*** <code>left</code> - ('''optional''') Left shields in VSD
***'''right''' - ('''optional''') Right shields in VSD
+
*** <code>right</code> - ('''optional''') Right shields in VSD
***'''top''' - ('''optional''') Top shields) in VSD
+
*** <code>top</code> - ('''optional''') Top shields) in VSD
***'''bottom''' - ('''optional''')bottom shields in VSD
+
*** <code>bottom</code> - ('''optional''')bottom shields in VSD
**<'''Hull''' .../> - Specifies the ships Hull
+
** <code><'''Hull''' .../></code> - Specifies the ships Hull
***'''strength''' - Max hull in VSD
+
*** <code>strength</code> - Max hull in VSD
**<'''Cloak''' .../> - ('''optional''') Specifies the ships cloak device
+
** <code><'''Cloak''' .../></code> - ('''optional''') Specifies the ships cloak device
***'''missing''' - if 1, then no cloak is here. also missing in abserce of optional tag
+
*** <code>missing</code> - if 1, then no cloak is here. also missing in absence of optional tag
***'''cloakmin''' - minimum percentage of cloakedness
+
*** <code>cloakmin</code> - minimum percentage of cloakedness
***'''cloakglass''' - boolean whether or not effect 2 is used
+
*** <code>cloakglass</code> - boolean whether or not effect 2 is used
***'''cloakrate''' - time per second to cloak in decimal per second
+
*** <code>cloakrate</code> - time per second to cloak in decimal per second
***'''cloakenergy''' - how much energy this takes in 100kJ
+
*** <code>cloakenergy</code> - how much energy this takes in 100kJ
*<'''Stats''' .../> -  Specifies the statics of the ship
+
* <code><'''Stats''' .../></code> -  Specifies the statics of the ship
**'''mass''' - mass in metric tonnes (kkg)
+
** <code>mass</code> - mass in metric tonnes (kkg)
**'''momentofinertia''' - mass*m*m in (metric tonnes * meter * meter)
+
** <code>momentofinertia</code> - mass*m*m in (metric tonnes * meter * meter)
**'''fuel''' - amount of fuel
+
** <code>fuel</code> - amount of fuel
*<'''Thrust'''>...</Thrust> - Specifies the ships thrust
+
* <code><'''Thrust'''>...</Thrust></code> - Specifies the ships thrust
**<'''Engine''' /> - Specifies the ships engine
+
** <code><'''Engine''' /></code> - Specifies the ships engine
***'''Afterburner''' - Thrust with afterburners in metric tonnes meters per second squared
+
*** <code>Afterburner</code> - Thrust with afterburners in metric tonnes meters per second squared
***'''Forward''' - Thrust without afterburners in kkg*m/s^2
+
*** <code>Forward</code> - Thrust without afterburners in kkg*m/s^2
***'''Retro''' - Reverse thrust in kkg*m/s^2
+
*** <code>Retro</code> - Reverse thrust in kkg*m/s^2
***'''Left''' - Left thrust  in kkg*m/s^2
+
*** <code>Left</code> - Left thrust  in kkg*m/s^2
***'''Right''' - Right thrust  in kkg*m/s^2
+
*** <code>Right</code> - Right thrust  in kkg*m/s^2
***'''Top''' - Top thrust  in kkg*m/s^2
+
*** <code>Top</code> - Top thrust  in kkg*m/s^2
***'''Bottom''' - Bottom thrust in kkg*m/s^2
+
*** <code>Bottom</code> - Bottom thrust in kkg*m/s^2
**<'''Maneuver''' .../> - Specifies the ships maneuver data
+
** <code><'''Maneuver''' .../></code> - Specifies the ships maneuver data
***'''yaw''' - Right yaw in metric tonnes degrees per second squared
+
*** <code>yaw</code> - Right yaw in metric tonnes degrees per second squared
***'''pitch''' - Right pitch in kkg*deg/s^2
+
*** <code>pitch</code> - Right pitch in kkg*deg/s^2
***'''roll''' - Right roll in kkg*deg/s^2
+
*** <code>roll</code> - Right roll in kkg*deg/s^2
*<'''Computer''' ...> ... </Computer>-
+
* <code><'''Computer''' ...> ... </Computer></code>-
**'''yaw''' - max yaw in degrees per second
+
** <code>yaw</code> - max yaw in degrees per second
**'''pitch''' - max pitch in dps
+
** <code>pitch</code> - max pitch in dps
**'''roll''' - max roll in dps
+
** <code>roll</code> - max roll in dps
**'''afterburner''' - Max safe speed with afterburners in m/s
+
** <code>afterburner</code> - Max safe speed with afterburners in m/s
**'''maxspeed''' - Max safe speed without afterburner in m/s
+
** <code>maxspeed</code> - Max safe speed without afterburner in m/s
**'''slidestart''' - ('''optional''') number of tenths of seconds before fully reacting to keyboard (smoothing)
+
** <code>slidestart</code> - ('''optional''') number of tenths of seconds before fully reacting to keyboard (smoothing)
**'''slideend''' - ('''optional''') number of tenths of seconds to stop
+
** <code>slideend</code> - ('''optional''') number of tenths of seconds to stop
**<'''Radar''' .../> - Specifies the ships radar system
+
** <code><'''Radar''' .../></code> - Specifies the ships radar system
***'''itts''' - if the unit has ability to target track with lead
+
*** <code>itts</code> - if the unit has ability to target track with lead
***'''color''' - if unit has color radar
+
*** <code>color</code> - if unit has color radar
***'''range''' - maximum range of radar
+
*** <code>range</code> - maximum range of radar
***'''error''' - ('''optional''') currently unused
+
*** <code>error</code> - ('''optional''') currently unused
***'''trackingCone''' - cosine of cone at which guns may track
+
*** <code>trackingCone</code> - cosine of cone at which guns may track
***'''lockcone''' - cosine of cone at which missiles gain locking time
+
*** <code>lockcone</code> - cosine of cone at which missiles gain locking time
***'''mintargetsize''' - unused...but supposedly minimum target this can do
+
*** <code>mintargetsize</code> - unused...but supposedly minimum target this can do
*<'''Energy'''> ...  </Energy> -
+
* <code><'''Energy'''> ...  </Energy></code> -
**<'''Reactor''' .../> - Specifies the ships poer unit (reactor)
+
** <code><'''Reactor''' .../></code> - Specifies the ships poer unit (reactor)
***'''recharge''' -  recharging of reactor in 100 MJ/s
+
*** <code>recharge</code> -  recharging of reactor in 100 MJ/s
***'''limit''' - max storage of reactor in 100 MJ/s
+
*** <code>limit</code> - max storage of reactor in 100 MJ/s
*<'''Jump''' .../> - ('''optional''')
+
* <code><'''Jump''' .../></code> - ('''optional''')
**'''delay''' - seconds before jump drive initiates
+
** <code>delay</code> - seconds before jump drive initiates
***'''jumpenergy''' - energy to jump
+
*** <code>jumpenergy</code> - energy to jump
**'''wormhole''' - forces units to teleport upon touching this one
+
** <code>wormhole</code> - forces units to teleport upon touching this one
**'''missing''' - boolean whether the jump drive is missing (assumed missing in absence of tag)
+
** <code>missing</code> - boolean whether the jump drive is missing (assumed missing in absence of tag)
*<'''description''' ...>...  </description> - ('''repeatable''')
+
* <code><'''description''' ...>...  </description></code> - ('''repeatable''')
**'''combatrole''' - combat role that the ship has (see [ai/VegaPriorities.csv|http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/vegastrike/data/ai/VegaPriorities.csv?rev=HEAD&content-type=text/plain] )
+
** <code>combatrole</code> - combat role that the ship has (see [http://vegastrike.svn.sourceforge.net/viewvc/vegastrike/trunk/data/ai/VegaPriorities.csv?content-type=text%2Fplain ai/VegaPriorities.csv] )
**'''lang''' - ('''optional''') Language code for the language the description is written in.
+
** <code>lang</code> - ('''optional''') Language code for the language the description is written in.
***e.g lang='DE' for german language
+
*** e.g <code>lang='DE'</code> for German language
***See [http://www.xs4all.nl/~margjos/langen.htm this link] for all codes:  
+
*** See [http://www.xs4all.nl/~margjos/langen.htm this link] for all codes:  
***If no lang attribute is specified the description is meant to be english. (''is this correct'?')
+
*** If no lang attribute is specified the description is meant to be English. (''is this correct'?')
**Some cool description of the ship.
+
** Some cool description of the ship.
*<'''Hold''' ...> ... </Hold>
+
* <code><'''Hold''' ...> ... </Hold></code>
**'''volume''' - volume in cargo units
+
** <code>volume</code> - volume in cargo units
**<'''Category''' ...> ... </Category> - ('''optional''')('''repeatable''') A category to use from the Vs-~MasterPartList''''.
+
** <code><'''Category''' ...> ... </Category></code> - ('''optional''')('''repeatable''') A category to use from the Vs-MasterPartList''''.
***'''file''' -
+
*** <code>file</code> -
**** e.g. file="Natural_Products/Natural_Resources"
+
**** e.g. <code>file="Natural_Products/Natural_Resources"</code>
***<'''import''' .../> ('''optional''')
+
*** <code><'''import''' .../></code> ('''optional''')
****'''price''' - price scale (multiplied by price in list)
+
**** <code>price</code> - price scale (multiplied by price in list)
****'''pricestddev''' - price scale variation (above adjusted by this)
+
**** <code>pricestddev</code> - price scale variation (above adjusted by this)
****'''quantity''' - quantity of this sort of cargo
+
**** <code>quantity</code> - quantity of this sort of cargo
****'''quantitystddev''' - quantity variation
+
**** <code>quantitystddev</code> - quantity variation
***<'''Cargo''' .../> ('''optional''')('''repeatable''')
+
*** <code><'''Cargo''' .../></code> ('''optional''')('''repeatable''')
****'''file''' - name of cargo
+
**** <code>file</code> - name of cargo
****'''price''' - price of cargo
+
**** <code>price</code> - price of cargo
****'''quantity''' - ammount of cargo
+
**** <code>quantity</code> - amount of cargo
****'''mass''' - mass in tonnes
+
**** <code>mass</code> - mass in tonnes
****'''volume''' - size of cargo in cargo units
+
**** <code>volume</code> - size of cargo in cargo units
****'''description''' - ('''optional/unused''')
+
**** <code>description</code> - ('''optional/unused''')
*<'''Light''' .../> - ('''optional''')('''repeatable''') Specifies an engine-flame/light/glow/whatever on your ship
+
* <code><'''Light''' .../></code> - ('''optional''')('''repeatable''') Specifies an engine-flame/light/glow/whatever on your ship
**'''file''' - meshfile (sans .xmesh) for this engine model
+
** <code>file</code> - meshfile (sans .xmesh) for this engine model
***e.g. "supernova.bmp"    it's actually a xmesh file
+
*** e.g. "supernova.bmp"    it's actually a xmesh file
**'''x''','''y''','''z''' - location of light (in meters ;-))
+
** <code>x</code>,<code>y</code>,<code>z</code> - location of light (in meters ;-))
**'''size''' -  size of engine (radius, in meters ;-))
+
** <code>size</code> -  size of engine (radius, in meters ;-))
**'''red''','''blue''','''green''' - ('''optional''')red/blue/green dye of engine
+
** <code>red</code>,<code>blue</code>,<code>green</code> - ('''optional''')red/blue/green dye of engine
*<'''Dock''' .../> - ('''optional''')('''repeatable''') A place where another unit can dock.
+
* <code><'''Dock''' .../></code> - ('''optional''')('''repeatable''') A place where another unit can dock.
**'''x''','''y''','''z''' - location of dock (in meters ;-))
+
** <code>x</code>,<code>y</code>,<code>z</code> - location of dock (in meters ;-))
**'''size''' - size of dock port (radius, in meters ;-))
+
** <code>size</code> - size of dock port (radius, in meters ;-))
**'''dockinternal''': ('''optional/unused''') whether the dock port makes the ship disappeared. The ship must be smaller than the size of the dock, otherwise it will remain in open space.
+
** <code>dockinternal</code> - ('''optional/unused''') whether the dock port makes the ship disappeared. The ship must be smaller than the size of the dock, otherwise it will remain in open space.
*<'''~SubUnit''' .../> - ('''optional''')('''repeatable''') A Subunt is a (not necessarily) small independant part of your unit. In fact the main unit and the subunit are two different ships (units) patched together at a certain point (x,y,z see below). If a subunit is destroyed the remaining parts will fly into space like the remainings of any other ship ... e.g turrets
+
* <code><'''SubUnit''' .../></code> - ('''optional''')('''repeatable''') A Subunit is a (not necessarily) small independent part of your unit. In fact the main unit and the subunit are two different ships (units) patched together at a certain point (x,y,z see below). If a subunit is destroyed the remaining parts will fly into space like the remainings of any other ship ... e.g turrets
**'''file''': unit file that can be referenced frmo toplevel units
+
** <code>file</code> - unit file that can be referenced from toplevel units
**'''size''': size class (which sizes it can hold)
+
** <code>siz</code> - size class (which sizes it can hold)
**'''x''','''y''','''z''' - location of subunit (in meters ;-))
+
** <code>x</code>,<code>y</code>,<code>z</code> - location of subunit (in meters ;-))
**'''ri''','''rj''','''rk''' - ('''optional''') R-vector (forward vector) of subunit (assume 0,0,1)
+
** <code>ri</code>,<code>rj</code>,<code>rk</code> - ('''optional''') R-vector (forward vector) of subunit (assume 0,0,1)
**'''qi''','''qj''','''qk''' - ('''optional''') Q-vector (up vector) of subunit (assume 0,1,0)
+
** <code>qi</code>,<code>qj</code>,<code>qk</code> - ('''optional''') Q-vector (up vector) of subunit (assume 0,1,0)
**'''restricted''' - ('''optional''') minimum dot with rj that the turret can have so it can't turn inside itself
+
** <code>restricted</code> - ('''optional''') minimum dot with rj that the turret can have so it can't turn inside itself
*<'''~CockpitDamage''' .../> - ('''optional''')('''repeatable''' up to 1+NUMGAUGES+MAXVDUS or 29)
+
* <code><'''CockpitDamage''' .../></code> - ('''optional''')('''repeatable''' up to 1+NUMGAUGES+MAXVDUS or 29)
**NOTE: If you have more, strange things may happen, as it will probably overrun the cockpitdamage buffer.
+
** NOTE: If you have more, strange things may happen, as it will probably overrun the cockpitdamage buffer.
**'''damage''' - float between 0 and 1 depending on the amount of static the vdu has.
+
** <code>damage</code> - float between 0 and 1 depending on the amount of static the vdu has.
*<'''Upgrade''' .../> - ('''optional''')('''repeatable''') an upgrade unit that adds its stats onto this unit (as if you had bought it from the shop).
+
* <code><'''Upgrade''' .../></code> - ('''optional''')('''repeatable''') an upgrade unit that adds its stats onto this unit (as if you had bought it from the shop).
**'''file''' - the file to upgrade it with.
+
** <code>file</code> - the file to upgrade it with.
  
==Turret Directions==
+
==Turret directions==
! #[Turret-Directions] - [Link|#Turret-Directions]
 
  
There are 2 vectors for turrets: '''r''' and '''q'''
+
There are 2 vectors for turrets: <code>r</code> and <code>q</code>
  
 +
<code>'''r'''</code> is the '''forward vector''':
 +
*x component = <code>ri</code>
 +
*y component = <code>rj</code>
 +
*z component = <code>rk</code>
  
'''r''' is the '''forward vector''':
+
When forward is pointing in the +z direction then <code>rk</code> is 1 and <code>ri</code> and <code>rj</code> are zero (0)
*x component = ri
+
hence <BR/><code>ri*ri+rj*rj+rk*rk = 0*0+0*0+1*1 = 1</code>
*y component = rj
 
*z component = rk
 
  
When forward is pointing in the +z direction then rk is 1 and ri and rj are zero
+
<code>'''q'''</code> is the '''up vector''':
hence ri*ri+rj*rj+rk*rk = 0*0+0*0+1*1=1
+
*x component = <code>qi</code>
 +
*y component = <code>qj</code>
 +
*z component = <code>qk</code>
  
'''q''' is the '''up vector''':
+
When forward is pointing in the +z direction then <code>qj</code> is 1 and <code>qi</code> and <code>qj</code> are zero (0)
*x component = qi
+
hence <BR/><code>qi*qi+qj*qj+qk*qk = 0*0+1*1+0*0 = 1</code>
*y component = qj
 
*z component = qk
 
  
When forward is pointing in the +z direction then qj is 1 and qi and qj are zero
+
==Fileextension differences==
hence qi*qi+qj*qj+qk*qk = 0*0+1*1+0*0=1
 
  
==Unit Differences==
+
See also this [http://forums.vega-strike.org/viewtopic.php?t=1811 forum thread].
! #[Unit-Differences] between the various unit files - [Link|#Unit-Differences]
 
See also this [this|http://vegastrike.sourceforge.net/forums/viewtopic.php?t=1811 thread].
 
 
* '''<file without extension>'''
 
* '''<file without extension>'''
 
** default unit file
 
** default unit file
* '''.blank''' file
+
* <code>'''.blank'''</code> file
 
** As the name already says, this is the 'blank' unit file. This ship doesn't have any weapons or upgrades on it.
 
** As the name already says, this is the 'blank' unit file. This ship doesn't have any weapons or upgrades on it.
* '''.template''' file
+
** {{Fixme}}
** The template basically defines the maximum values for a ship/unit. e.g:
+
* <code>'''.template'''</code> file
*** max speed
+
** The template basically defines the maximum and minimum values for a [[Vessels & Installations|ship/unit]]. e.g:
*** max yaw
+
*** maximum speed
*** max power
+
*** max. yaw
*** ...
+
*** max. power
 +
*** ... {{Fixme}}
 
** The upgrades available to a ship are also located in this file.
 
** The upgrades available to a ship are also located in this file.
 
*** The actual upgrades and how they behave are defined by unit files located in the units/factions/upgrades directory. Just look at a few of the files in there and it should be pretty straightforward. ''There need to be a section in the wiki for the description of this :-)''
 
*** The actual upgrades and how they behave are defined by unit files located in the units/factions/upgrades directory. Just look at a few of the files in there and it should be pretty straightforward. ''There need to be a section in the wiki for the description of this :-)''
*** A (not always up to date) list of upgrades is under VsManualDbShipUpgrades.
+
*** A (not always up to date) list of upgrades is under [[Upgrades]].
 
 
 
*** Example:
 
*** Example:
<verbatim>
+
<pre>
 
<Upgrade file="reactor_level_3"/>
 
<Upgrade file="reactor_level_3"/>
 
<Upgrade file="mult_gun_cooler"/>
 
<Upgrade file="mult_gun_cooler"/>
 
<upgrade file="add_reactor_capacitance"/>
 
<upgrade file="add_reactor_capacitance"/>
</verbatim>
+
</pre>
* '''.<factionname>'''
+
* <code>'''.factionname'''</code>
** unit file for the named faction ... e.g ''dodo.confed''
+
** unit file for the named [[Factions|faction]] ... e.g <code>dodo.confed</code>
 +
 
 +
=See also=
 +
* [[HowTo:Edit units.csv]]
 +
* [[HowTo:Edit HUDs]]
 +
* Forum posts
 +
** [http://forums.vega-strike.org/viewtopic.php?t=1811 Unit Differences]
 +
** [http://forums.vega-strike.org/viewtopic.php?p=9688#9688 XML Format]
 +
 
 +
 
  
 
----
 
----
 
{{NAV_Manual |
 
{{NAV_Manual |
| previous=[[HowTo:Create Ships in Wings3D|Create Ships in Wings 3D]]
+
| previous=[[HowTo:Edit units.csv|Edit units.csv]]
| up=[[HowTo]]
+
| up=[[HowTos]]
| next=[[HowTo:Edit Mesh Files|Edit Mesh Files]]
+
| next=[[HowTo:Edit HUDs|Editing HUDs]]
 
}}
 
}}
[[Category:HowTo|Edit Unit Files]]
+
 
 +
[[Category:HowTos|Edit Unit Files]]

Latest revision as of 23:29, 8 January 2013

arrow_left.png Edit units.csv arrow_up.png HowTos Editing HUDs arrow_right.png

EDITING UNIT FILES

File example

Examples taken from the former starting ship 'wayfarer' (now named the llama), for a full description of the XML syntax see below.

 <Unit Scale="1">
   <Cockpit  file="heavy-cockpit.cpt" x="0" y="0" z="0" />
   <Meshfile file="rescue-hull-e.xmesh" />
   <Mount weapon="Ion" size="Light Medium Heavy" x="9.8108" y="1.757" z="11.8091" />
   <Sound>    </Sound>
   <Defense HudImage="wayfarer-hud.spr" >
     <Armor front="250" right="225" left="225" back="240" />
     <Shields front="150.000000" back="150.000000" recharge="30.000000" />
     <Hull strength="200.000000" />
   </Defense>
   <Stats mass="1096" momentofinertia="1096" fuel="40000000" />
   <Thrust >
     <Engine Afterburner="117007" Forward="22523" Retro="27935" Left="22231" Right="22231" Top="22231" Bottom="22231"  />
     <Maneuver yaw="289943" pitch="239988" roll="399637" />
   </Thrust>   <Computer yaw="60.400002" pitch="50.600006" roll="80.400002" afterburner="85" maxspeed="30" />
   <Energy >
     <Reactor recharge="60" limit="400" />
   </Energy>
   <Jump delay="2" jumpenergy="150" />
   <description combatRole="SHUTTLE" >
   Some cool description of the ship.
   </description>
   <Hold volume="125" >
     <Category file="Natural_Products/Natural_Resources" >
       <import price=".8" pricestddev=".2" quantity="0" quantitystddev="5"  />
     </Category>
   </Hold>
   <Light file="supernova.bmp" x="-10.24" y="-2.759" z="-18.302" size="6" />
   <Dock x="0" y="-4.7" z="6" size="10" />
 </Unit>


XML schema

The original description of the xunit syntax from hellcatv is located in SVN (description.xunit) (VSD = 5400 kJ (kilojoules).

<Unit ...> </Unit> - Marks the begin and the end of the unit(file)

  • Scale - Sets the scaling of the unit in the game
  • <Cockpit .../> - Defines a cockpit for the ship.
    • file - Points to a cockpit file. Extension .cpt
    • x,y,z - Coordinates where the Cockpit should be in the Unit/Ship (in meters)
    • See also HowTo:Edit HUDs.
  • <Meshfile .../>
    • file - Points to a xmesh-file of the ship. Extension .xmesh
    • texturestarttime - (optional) Defines the starting delay of a mesh animation. See forums for more.
      • RANDOM - Random start delay.
      • time until mesh animation starts
    • startframe - (optional) Defines the starting-frame of a mesh animation. See forums for more.
      • RANDOM - Random start-frame.
      • number of start-frame
  • <ShieldMesh> - (optional) xmesh-file to use for the shield instead of a sphere. Extension .xmesh
  • <RapidMesh> - (optional) xmesh-file to load and use for collisions with other units/ships/... instead of the Meshfile from above (not drawn) Extension .xmesh
  • <BspMesh> - (optional) xmesh-file to use for beam and bolt collisions (not drawn) Extension .xmesh
  • <Mount .../> - (optional)(repeatable) Specifies a weapon mount
    • weapon - Type of weapon (see weapon_list.xml in the data directory)
    • size - size class(es)/type(s) and if they are capable of autotracking. The single entries are separated by spaces. e.g: size="LIGHT MEDIUM AUTOTRACKING"
      • LIGHT
      • MEDIUM
      • HEAVY
      • SPECIAL
      • CAPSHIP-LIGHT
      • CAPSHIP-MEDIUM
      • CAPSHIP-HEAVY
      • AUTOTRACKING
      • SPECIAL-MISSILE
      • LIGHT-MISSILE
      • MEDIUM-MISSILE
      • HEAVY-MISSILE
      • LIGHT-CAPSHIP-MISSILE
      • MEDIUM-CAPSHIP-MISSILE
      • HEAVY-CAPSHIP-MISSILE
    • ammo - how much ammo the gun holds (only needed for ammo needing weapons e.g. missiles,torpedos,...)
    • volume - (optional see "ammo") how much ammo the gun can hold if you refill
    • x,y,z - location of weapon (in meters ;-))
    • ri,rj,rk - (optional) R-vector forward vector) of gun (assume 0,0,1)
    • qi,qj,qk - (optional) Q-vector (up vector) of gun (assume 0,1,0)
  • <Sound> </Sound> - FIXME nothing yet ???
  • <Defense ...> </Defense> - FIXME
    • HudImage - sprite file to use when targetted FIXME relative to what?
    • ExplosionAni - (optional) special explosion to use
    • RepairDroid - (optional) strength of repair system (0-6)
    • ECM - (optional) type of ECM (Electronic Counter Measure)
    • <Armor .../> - Specifies the ships physical armor
      • front - Forward max armor in VSD
      • right - Right armor in VSD
      • left - Left armor in VSD
      • back - Back armor in VSD
    • <Shields .../> - Specifies the ships Shield (electric armor)
      • front - Forward max shields in VSD
      • back - Back shields in VSD
      • recharge - Shield regeneration if not violating speed limit in VSD/s
      • leak - (optional) how much leak these shields have (usually 0%) between 0 and 100
      • left - (optional) Left shields in VSD
      • right - (optional) Right shields in VSD
      • top - (optional) Top shields) in VSD
      • bottom - (optional)bottom shields in VSD
    • <Hull .../> - Specifies the ships Hull
      • strength - Max hull in VSD
    • <Cloak .../> - (optional) Specifies the ships cloak device
      • missing - if 1, then no cloak is here. also missing in absence of optional tag
      • cloakmin - minimum percentage of cloakedness
      • cloakglass - boolean whether or not effect 2 is used
      • cloakrate - time per second to cloak in decimal per second
      • cloakenergy - how much energy this takes in 100kJ
  • <Stats .../> - Specifies the statics of the ship
    • mass - mass in metric tonnes (kkg)
    • momentofinertia - mass*m*m in (metric tonnes * meter * meter)
    • fuel - amount of fuel
  • <Thrust>...</Thrust> - Specifies the ships thrust
    • <Engine /> - Specifies the ships engine
      • Afterburner - Thrust with afterburners in metric tonnes meters per second squared
      • Forward - Thrust without afterburners in kkg*m/s^2
      • Retro - Reverse thrust in kkg*m/s^2
      • Left - Left thrust in kkg*m/s^2
      • Right - Right thrust in kkg*m/s^2
      • Top - Top thrust in kkg*m/s^2
      • Bottom - Bottom thrust in kkg*m/s^2
    • <Maneuver .../> - Specifies the ships maneuver data
      • yaw - Right yaw in metric tonnes degrees per second squared
      • pitch - Right pitch in kkg*deg/s^2
      • roll - Right roll in kkg*deg/s^2
  • <Computer ...> ... </Computer>-
    • yaw - max yaw in degrees per second
    • pitch - max pitch in dps
    • roll - max roll in dps
    • afterburner - Max safe speed with afterburners in m/s
    • maxspeed - Max safe speed without afterburner in m/s
    • slidestart - (optional) number of tenths of seconds before fully reacting to keyboard (smoothing)
    • slideend - (optional) number of tenths of seconds to stop
    • <Radar .../> - Specifies the ships radar system
      • itts - if the unit has ability to target track with lead
      • color - if unit has color radar
      • range - maximum range of radar
      • error - (optional) currently unused
      • trackingCone - cosine of cone at which guns may track
      • lockcone - cosine of cone at which missiles gain locking time
      • mintargetsize - unused...but supposedly minimum target this can do
  • <Energy> ... </Energy> -
    • <Reactor .../> - Specifies the ships poer unit (reactor)
      • recharge - recharging of reactor in 100 MJ/s
      • limit - max storage of reactor in 100 MJ/s
  • <Jump .../> - (optional)
    • delay - seconds before jump drive initiates
      • jumpenergy - energy to jump
    • wormhole - forces units to teleport upon touching this one
    • missing - boolean whether the jump drive is missing (assumed missing in absence of tag)
  • <description ...>... </description> - (repeatable)
    • combatrole - combat role that the ship has (see ai/VegaPriorities.csv )
    • lang - (optional) Language code for the language the description is written in.
      • e.g lang='DE' for German language
      • See this link for all codes:
      • If no lang attribute is specified the description is meant to be English. (is this correct'?')
    • Some cool description of the ship.
  • <Hold ...> ... </Hold>
    • volume - volume in cargo units
    • <Category ...> ... </Category> - (optional)(repeatable) A category to use from the Vs-MasterPartList'.
      • file -
        • e.g. file="Natural_Products/Natural_Resources"
      • <import .../> (optional)
        • price - price scale (multiplied by price in list)
        • pricestddev - price scale variation (above adjusted by this)
        • quantity - quantity of this sort of cargo
        • quantitystddev - quantity variation
      • <Cargo .../> (optional)(repeatable)
        • file - name of cargo
        • price - price of cargo
        • quantity - amount of cargo
        • mass - mass in tonnes
        • volume - size of cargo in cargo units
        • description - (optional/unused)
  • <Light .../> - (optional)(repeatable) Specifies an engine-flame/light/glow/whatever on your ship
    • file - meshfile (sans .xmesh) for this engine model
      • e.g. "supernova.bmp" it's actually a xmesh file
    • x,y,z - location of light (in meters ;-))
    • size - size of engine (radius, in meters ;-))
    • red,blue,green - (optional)red/blue/green dye of engine
  • <Dock .../> - (optional)(repeatable) A place where another unit can dock.
    • x,y,z - location of dock (in meters ;-))
    • size - size of dock port (radius, in meters ;-))
    • dockinternal - (optional/unused) whether the dock port makes the ship disappeared. The ship must be smaller than the size of the dock, otherwise it will remain in open space.
  • <SubUnit .../> - (optional)(repeatable) A Subunit is a (not necessarily) small independent part of your unit. In fact the main unit and the subunit are two different ships (units) patched together at a certain point (x,y,z see below). If a subunit is destroyed the remaining parts will fly into space like the remainings of any other ship ... e.g turrets
    • file - unit file that can be referenced from toplevel units
    • siz - size class (which sizes it can hold)
    • x,y,z - location of subunit (in meters ;-))
    • ri,rj,rk - (optional) R-vector (forward vector) of subunit (assume 0,0,1)
    • qi,qj,qk - (optional) Q-vector (up vector) of subunit (assume 0,1,0)
    • restricted - (optional) minimum dot with rj that the turret can have so it can't turn inside itself
  • <CockpitDamage .../> - (optional)(repeatable up to 1+NUMGAUGES+MAXVDUS or 29)
    • NOTE: If you have more, strange things may happen, as it will probably overrun the cockpitdamage buffer.
    • damage - float between 0 and 1 depending on the amount of static the vdu has.
  • <Upgrade .../> - (optional)(repeatable) an upgrade unit that adds its stats onto this unit (as if you had bought it from the shop).
    • file - the file to upgrade it with.

Turret directions

There are 2 vectors for turrets: r and q

r is the forward vector:

  • x component = ri
  • y component = rj
  • z component = rk

When forward is pointing in the +z direction then rk is 1 and ri and rj are zero (0) hence
ri*ri+rj*rj+rk*rk = 0*0+0*0+1*1 = 1

q is the up vector:

  • x component = qi
  • y component = qj
  • z component = qk

When forward is pointing in the +z direction then qj is 1 and qi and qj are zero (0) hence
qi*qi+qj*qj+qk*qk = 0*0+1*1+0*0 = 1

Fileextension differences

See also this forum thread.

  • <file without extension>
    • default unit file
  • .blank file
    • As the name already says, this is the 'blank' unit file. This ship doesn't have any weapons or upgrades on it.
    • FIXME
  • .template file
    • The template basically defines the maximum and minimum values for a ship/unit. e.g:
      • maximum speed
      • max. yaw
      • max. power
      • ... FIXME
    • The upgrades available to a ship are also located in this file.
      • The actual upgrades and how they behave are defined by unit files located in the units/factions/upgrades directory. Just look at a few of the files in there and it should be pretty straightforward. There need to be a section in the wiki for the description of this :-)
      • A (not always up to date) list of upgrades is under Upgrades.
      • Example:
<Upgrade file="reactor_level_3"/>
<Upgrade file="mult_gun_cooler"/>
<upgrade file="add_reactor_capacitance"/>
  • .factionname
    • unit file for the named faction ... e.g dodo.confed

See also



arrow_left.png Edit units.csv arrow_up.png HowTos Editing HUDs arrow_right.png