Difference between revisions of "Classic Elite ships wireframe"

From Elite Wiki
(Created page with "In Classic Elite the ship geometries are limited to convex hulls to aid in rendering the wire-frame graphics as quickly as possible with hidden line removal. Each vertex is us...")
 
Line 90: Line 90:
 
|}
 
|}
  
Each vertex has 6 bytes of data.  
+
Each vertex has 6 bytes of data. Bytes X,Y,Z are the magnitudes. The signs for each axis are stored in bits 7,6,5 of Byte S. The lower 5 bits are a visibility distance, with a maximum value of 31 ensuring the vertex is processed for all distances until the ship is plotted as a large dot.
 
{| class="wikitable"
 
{| class="wikitable"
 
! style="text-align:left;"| Byte X
 
! style="text-align:left;"| Byte X
! Byte Y | ! Byte Z | Byte S | Byte F1 | Byte F2
+
!| Byte Y  
 +
!| Byte Z  
 +
!| Byte S  
 +
!| Byte F1  
 +
!| Byte F2
 
|-
 
|-
 
   
 
   
Line 101: Line 105:
 
|5F
 
|5F
 
|01
 
|01
|59  
+
|59
 +
|-
 +
 
 +
|28
 +
|0E
 +
|04
 +
|FF
 +
|12
 +
|99
 
|-
 
|-
  
 
|...
 
|...
||||||
+
|||||||
 
|}
 
|}
  

Revision as of 03:39, 10 June 2018

In Classic Elite the ship geometries are limited to convex hulls to aid in rendering the wire-frame graphics as quickly as possible with hidden line removal. Each vertex is usually associated with 4 faces, each edge joining 2 vertices is associated with 2 faces. The maximum number of faces is 14, as is the case for the asteroid model. Face 15 is reserved to indicate a vertex is always visible regardless of the objection's orientation, e.g. more than 4 faces meet at that vertex. The (time consuming) 3D projection calculations for that vertex should always be performed, if the vertex is close enough to the player, else if the face is not visible then further tests are done to see if any visible face is associated with that vertex. An edge is only rendered if both faces associated with it are visible.

Ship data file format

An initial header of 20 bytes is followed by the vertex data, in groups of 6 bytes, then the edge data in groups of 4 bytes, and finally the face normal data in groups of 4 bytes.

Byte (in Hex) Ship header information (example ship)
03 hi nibble is cargo type if scooped (0 is not scoopable). lo nibble is max pieces of debris if destroyed.
E9 lo byte of ship area for target hit decision
07 hi byte of ship area for target hit decision
86 lo byte of offset to edge data.
F2 lo byte of offset to face data.
5D maximum size of heap reserved for processed line plotting data (1+4*max visible edges)
00 vertex id for laser gun (*4), used for firing laser lines
1A number of vertices(*4 + 6), used for explosion dust origin(s)
72 number of vertices*6, used for vertex loop counter
1B number of edges
2C lo byte of bounty (in units of 0.1 Cr) if awarded
01 hi byte of bounty (in units of 0.1 Cr) if awarded
28 number of faces*4, used for face loop counter
1E distance away when wireframe rendering replaced by large dot
A0 Maximum ship energy
1E Maximum ship speed
00 hi byte of offset to edge data.
00 hi byte of offset to face data.
01 Scale factor for ship size when calculating whether face normal is visible
22 Laser firepower*8 plus maximum number (7) of missiles.

Each vertex has 6 bytes of data. Bytes X,Y,Z are the magnitudes. The signs for each axis are stored in bits 7,6,5 of Byte S. The lower 5 bits are a visibility distance, with a maximum value of 31 ensuring the vertex is processed for all distances until the ship is plotted as a large dot.

Byte X Byte Y Byte Z Byte S Byte F1 Byte F2
00 0E 6C 5F 01 59
28 0E 04 FF 12 99
...

Source code for the BBC tape and TUBE versions of BBC Elite can be found at Ian Bell's web site and were used to disassemble and interpret the Disk version described here.