HowTo:Edit HUDs

From VsWiki
Revision as of 01:18, 27 January 2008 by pyramid (talk | contribs) (See also)
Jump to: navigation, search
arrow_left.png Editing Unit Files arrow_up.png HowTos Create a Cockpit in Wings3d arrow_right.png

Editing or creating a HUD

Image files

  • To display your own graphic files in the HUD you can use every image format that is supported by vegastrike (png/jpg/bmp/...).
  • The sides of the images must have a size that is a power of 2.

The cockpit directory

The cockpit directory contains all the relevant files that consist of the HUD and cockpit. These files are:

  • .cpt file - is the main cockpit definition file and links all the cockpit parts together
  • .bfxm file - FIXME PROVIDE EXPLANATION OF PURPOSE OF FILE
  • .xmesh file - FIXME PROVIDE EXPLANATION OF PURPOSE OF FILE
  • .spr files - define the size and position of cockpit elements (gauges, radars, ...) on the screen

Example

./cockpits/disabled-cockpit/disabled-cockpit.cpt

Structure

disabled-cockpit is the name of the subdirectory.

Description

All cockpit/HUD information is held under a single directory located as a subdirectory of the cockpits directory.

The ".cpt" file format

FIXME COMPLETE MISSING INFORMATION

Example

disabled-cockpit.cpt

<Cockpit r="0" g=".75" b="1">
   <Crosshairs file="crosshairs.spr" xcent="0" ycent="0" /> 
   <Radar file="radar.spr" /> 
   <RearRadar file="radarr.spr" /> 
   <Speed file="radar.spr" xcent="-.23" ycent="-.52" width=".018" height=".036" /> 
   <SetSpeed file="radar.spr" xcent=".23" ycent="-.52" width=".018" height=".036" /> 
   <WARPFIELDSTRENGTH file="radar.spr" xcent="-.23" ycent="-.58" width=".018" height=".036" /> 
<!-- 
	<ShieldF file="shieldf.spr"/>
	<ShieldB file="shieldf.spr" xcent="-.3" ycent="-.92" GaugeDown="1"/>
	<ArmorL file="armorl.spr"  GaugeLeft="1"/>
	<ArmorR file="armorl.spr" xcent="-.22" ycent="-.835" GaugeRight="1"/>
	<Hull file="hull.spr" xcent="-.3" ycent="-.835" GaugeUp="1"/>
	<ArmorF file="armorf.spr" />
	<ArmorB file="armorf.spr" xcent="-.3" ycent="-.87"  GaugeDown="1"/>
	<ArmorL file="armorl.spr"  GaugeLeft="1"/>
	<ArmorR file="armorl.spr" xcent="-.22" ycent="-.835" GaugeRight="1"/>


--> 
   <Fuel file="fuelstat.spr" GaugeRight="1" xcent="0" ycent="-.6" /> 
   <Energy file="blasterpower.spr" GaugeRight="1" /> 
   <WarpEnergy file="jumppower.spr" GaugeRight="1" xcent="0" ycent="-.55" /> 
   <Lock file="locklight.spr" xcent="0" ycent="-.7" /> 
   <MissileLock file="locklight.spr" xcent=".04" ycent="-.7" /> 
   <ECM file="locklight.spr" xcent="-.04" ycent="-.7" /> 
   <Auto file="auto.spr" /> 
   <Jump file="canjump.spr" /> 
   <Eject file="eject.spr" /> 
<!-- 	<LeftVDU TextRows="15" TextCols="25" type="Shield  Manifest" file="wvdu.spr" xcent="-.47" ycent="-.75"/>
--> 
   <VDU TextRows="30" TextCols="25" type="Weapon Manifest Damage" file="wvdu.spr" xcent="-.8" ycent=".2" /> 
   <VDU TextRows="15" TextCols="25" type="Target Comm View TargetManifest Nav" file="rvdu.spr" xcent=".775" ycent="-.75" /> 
   <VDU TextRows="15" TextCols="25" type="Shield Manifest" file="lvdu.spr" xcent="-.775" ycent="-.75" /> 
   <VDU TextRows="14" TextCols="100" type="Message" file="mvdu.spr" /> 
   <VDU TextRows="30" TextCols="30" type="Objectives" file="objvdu.spr" /> 
   <FPS file="radar.spr" xcent=".9" ycent=".8" width=".018" height=".036" /> 
</Cockpit>

XML Schema

This is the information I have gathered from looking at the files.

<Cockpit ...> </Cockpit> Marks the beginning and end of the cockpit definition

  • r="#" g="#" b="#" Specifies percentages of color used for generated elements (text and radar). Numbers between 0 and 1. Example is for cyan.
  • mesh="" - Mesh file to use for 3D cockpits
  • front="" - Sprite file to use for forward-facing view of 2D cockpits
  • left="" - Sprite file to use for left-facing view of 2D cockpits
  • right="" - Sprite file to use for right-facing view of 2D cockpits
  • back="" - Sprite file to use for rear-facing view of 2D cockpits
  • ViewOffset="#" - FIXME Horizontal offset within cockpit
  • CockpitOffset="#" - FIXME Not certain of the purpose of this option
  • The following options are supported in cockpit_xml.cpp (In CVS as of 5/18/2005) and may or may not be functional in the game.
    • font="" - Specify the font file to be used
    • file="" - FIXME Unknown
    • soundfile="" - FIXME Unknown
  • Sprite definitions
    • Common parameters:
      • file="" - SPR file to use
      • xcent="#" ycent="#" - center along x or y at # (range is -1.0 to 1.0)
      • width="#" height="#" - Set width and height
      • For gauges: GaugeRight, GaugeLeft, GaugeDown, GaugeUp(Default) = "1" - Sets direction that gauges clear from (Only one tag possible?).
    • <Crosshairs ... /> - Crosshairs sprite
      • To tell the engine to actually draw bitmap/sprite crosshairs you need to define
        <var name="draw_rendered_crosshairs" value="false" />
        in the vegastrike.config file.
    • <Radar ... /> - Forward radar
    • <RearRadar ... /> - Rear radar
    • <Speed ... /> - Current speed
    • <SetSpeed ... /> - Set speed
    • <WARPFIELDSTRENGTH ... /> - Current SPEC multiplier.
    • <Fuel ... /> - Fuel (Gauge)
    • <Energy ... /> - Main (reactor) capacitor level. (Gauge)
    • <WarpEnergy ... /> - Warp capacitor level. (Gauge)
    • <Lock ... /> - Someone has locked onto you.
    • <MissileLock ... /> - Someone has gained a missile lock on you
    • <ECM ... /> - ECM activated (Is this when your ECM stops a missile or when an enemy stops your missile?)
    • <Auto ... /> - Timeless Autopilot or SPEC mode indicator
    • <Jump ... /> - Jump point in range indicator
    • <Eject ... /> - Critical failure indicator
    • <VDU ... /> - Video Display Unit (multiple entries allowed)
      • Additional parameters:
        • TextRows = "#" - Number of rows displayed (Note: If sprite is not large enough, the maximum number of rows possible is displayed)
        • TextCols = "#" - Number of characters across displayed
        • Type = "" - VDU types to display separated by spaces
          • Weapon - Displays active guns and missiles
          • Manifest - Displays the content of your cargo hold
          • Damage - Displays the status of your ship and it's systems
          • Target - Displays your target's shields, hull and distance from your ship
          • Comm - Displays your communications options
          • View - Displays a camera view of your target
          • TargetManifest - Displays your target's cargo
          • Nav - Another camera view
          • Shield - Your shield status
          • Message - Incoming and outgoing message display
          • Objectives - Mission objectives
    • <FPS ... /> - Simulated Frames per Second
    • <ShieldF ... /> - Front Shield Gauge
    • <ShieldB ... /> - Rear Shield Gauge
    • <ShieldL ... /> - Left Shield Gauge
    • <ShieldR ... /> - Right Shield Gauge
    • <ArmorF ... /> - Front Armor Gauge
    • <ArmorB ... /> - Rear Armor Gauge
    • <ArmorL ... /> - Left Armor Gauge
    • <ArmorR ... /> - Right Armor Gauge
    • Additional elements found in cockpit_xml.cpp that may or may not be implemented
      • <LeftVDU ... /> - FIXME Left VDU
      • <RightVDU ... /> - FIXME Right VDU
      • <Panel ... /> - FIXME Unknown (Appears to be related to Crosshairs)
      • <Collision ... /> - FIXME Sprite indicating a collision has occurred.

FIXME CORRECTIONS AND ADDITIONAL INFORMATION REQUESTED

New gauges have been implemented into SVN as of revision 11767, explanation is required:

  • TCNT ==> Turret CoNTrol (OFF/ACTIVE/FAW (FireAtWill) )
  • GCNT ==> Governor CoNTrol (Maneuver vs. Travel mode)
  • ...

Description

This is the .cpt file, using the same name as per the directory name. FIXME INFORMATION ON STRUCTURE REQUIRED

The ".spr" file format

FIXME REDEFINE INTO EASY TO FOLLOW INSTRUCTIONS

Example

./cockpits/disabled-cockpit.cpt/blasterpower.spr

cockpit/blasterpower.png cockpit/blasterpower.png
.25 .09
0 -.5

Structure

imagename alphaname
scaleX scaleY
positionX positionY

Description

  • imagename - path to the image to be used (e.g ./cockpit/blasterpower.png ... this will search in ./textures/cockpit/ for the file blasterpower.png)
  • alphaname - This is the alpha map for the image. It must either be a greyscale .bmp, or a .png (where the png's alpha map is used), even if you are using the alpha-map from the first png, it must also be listed here as the source of the alphamap!
  • scaleX - Scales the image on the X-Axis (1 = Fullsize, 0.5 = Halfsize, 2 = Doublesize etc)
  • scaleY - Scales the image on the Y-Axis (see scaleX)
  • positionX - Start drawing the image on a relative position specified by positionX
  • positionY - Start drawing the image on a relative position specified by positionY

The last four options require some explanation on how Vega Strike 4.01 draws its sprites. First of all, you have to know that the resolution of the image is absolutely irrelevant, as Vega Strike works with relative coordinates and scaling, with (0,0) being the center of the screen. Imageine a picture of exactly one red pixel (1x1) in size, with scaleX=scaleY=1 ,positionX=positionY=0. The result is a red square, whose center is on the center of the screen. It fills the left, the right, the upper and the lower half of the screen. scaleX=scaleY=2 would make it exactly fullscreen. The same applies to positionX and positionY. PositonY=-1 whould start drawing it on the lower half from the center of the screen, whereas PositionY=2 whould completely draw it offscreen.

One note regarding negative values in scaleX and scaleY : Vega Strike flips the sprite on that axis, but in the case of gauges like Blasterpower will also start decreasing it flipped (not from the right, but from the left).

See also


arrow_left.png Editing Unit Files arrow_up.png HowTos Create a Cockpit in Wings3d arrow_right.png