CSM Simulator Scenery Graphics files... How to...

CSM Simulator Scenery Graphics files... How to...

Post by NMVS » Mon, 29 Sep 1997 04:00:00

Well, I've had quite a few requests for my scenery files and a couple
queries how to go about writing them too, so...

The SIM uses three main file types for scenery construction...

.VTX files are lists of relative distance co-ordinates of 'salient points'
in an object... (Plotted X,Y,Z)

Eg... These are coordinates for a barn with a pointed roof... "BARN.VTX"

Barn - vertex file
k       N       E       D
1       0       0       0
2       0       0      -3
3       2       0      -4
4       4       0      -3
5       4       0       0
6       0       6       0
7       0       6      -3
8       2       6      -4
9       4       6      -3
10     4       6       0

..GRF files construct the object using planes & lines between numbered
points from the .VTX files and colours from another file list... An object,
or any part of it, can be selected to cause a crash or not when you fly
through it...

Eg... This is the .GRF file constructing the barn... "BARN.GRF"

Barn - plotting data table
No. Type  Cors.   I1      I2      I3      I4     ColOpt
1       1       4       1       2       4       5       17
2       1       3       2       3       4       0       17
3       1       4       6       7       9       10     17
4       1       3       7       8       9       0       17
5       2       4       4       3       8       9       17
6       2       4       2       3       8       7       17

Type (1) doesn't cause a crash & type (2) does...
"Cors" is the number of corners...  
I1~I4 are corresponding points from the .VTX file...  
ColOpt is the colour option, brown here...

Thus only the roof causes a crash here...  Saves processor time again I
think but means you can 'cheat' and fly right through the end walls !!!  

[I tried changing some of the colours with rather mixed results so I just
settled for the rather limited but already available list eventually...
There is a file containing my notes on how the colour lists work in with my
scenery files...]

FIELD?.FLD files construct a flying area 'diorama' from these objects.
Again plotted X,Y,Z where X = N/S, Y=E/W & Z = altitude plus rotation
around a verticle line...  +ve altitude is always entered -ve in these
files for some reason...  Preset green ground + grey sky...

Eg...  Small segment from a field?.fld file positioning the barn relative
to the centre of our circle plus a few other objects...

INFO in the form:- item file name (CR)
North,East,and Vert. Loc. (space sep)(CR), then rotation & NO (CR) !
   30  -27   0
   43  -10    0
   45  -15   0
   39  -17   0
   51.4  -41.3   -0.5

reen is a small winding river, dungheap is exactly what it says it is (Just
been removed in reality.) gategrid is a cattle grid and the gate + fence
next to it, bridge is our access bridge across the reen & barn is the
object drawn by .vtx & .grf above...

NB1: Nearly all data files are in simple ASCII...  You can use the DOS
'EDIT' command or a word processor but you must save the files in DOS ASCII
from a word processor, if you've 'mucked one up' just don't save it !!!

NB2: You have to be really neat and especially careful with line feeds... I
found the .VTX and other files aren't 'space dependent', you can space them
out to suit 'tabs' for easier data entry in DOS EDIT, that's why my files
look somewhat different from the originals BUT you should leave CSM's notes
the same, although I changed internal titles for easier reference later...

NB3: .VTX, .GRF & names in FIELD?.FLD files must match exactly or it won't
work...  I advise writing a single object at a time so it is esier to trace
where you've made any errors as the SIM program crash error codes don't


I measured out our flying field by pacing out some distances (SIM uses
metres...) then drew it out, roughly to scale...

I then selected things for objects that affect you when you're flying, Eg.
tall hedges, a barn Etc., and various orientation aids...  

[I have added coloured 'aerial circles' at set angles in the sky too as
there isn't much indication of your height so the ground can 'arrive rather
fast' toward the end of an auto' or fast descent...  Not cheating really as
you can tell how far your neck is bent back in reality !!!   I did draw out
some rather Dalinesque trees too but hadn't enough processor speed to
manage them on my old machine so they 'went west' in a huff...]

Draw your object out on paper, (Graph paper makes it easier.) again,
roughly to scale. Pick a point as 0,0,0 then list co-ordinates relative to
that point for the rest of the object...  Don't use too many; The more you
use, the more processor time the graphics take to the point of slowing down
the heli !!!    Eg. For the barn, which has a rounded roof in reality, I
just used 10 points to give it a 'pointed' roof and rectangular ends...
Hedges are just flat planes with no depth...   The most complex object in
my files is an 'openwork' footbridge...  I originally put in barbed wire
fences, roads and more gates too but they 'went west' with the trees...

NB4: You can get some weird effects if a complete object isn't in view,
especially really close by objects, thus, for instance, a hedge is split up
into very many small segments that get smaller as it approaches the viewer
and larger as it recedes again...  [This one drove me nuts with
intermittantly disappearing graphics until I figured out what was

EDIT an extant .VTX file, change the title & 'Save as' straight away so you
don't forget later and mangle an original file (!), delete all the unwanted
data (ONLY) and enter your own... Then I'd advise printing it for future
reference !

EDIT an extant .GRF file the same way...  Column Title line tells you what
to enter for each position...  One column selects crash~no crash...  You
get a line on screen by entering two .VTX numbers, a triangle entering
three and a rectangle entering four on any one line...  Can't remember the
colour listing off hand but it's 1~16 inclusive I thought but there's a
'17' above,
easy enough to test when you have an object to play with anyway...  Some
different colour numbers come out the same colour on-screen, I don't know

EDIT an extant FIELD?.FLD file, save it with another number (In place of
<?>) and you won't affect the original...  Just add in your object at the
end of the list and test run...  If the object's really complex I bet it
aint right first time !!!  Then comes the real fun, de-bugging the damn
thing !!!  (Don't worry about the <field?.ppi> file, that is inaccessible
and just holds the viewing positions plus other data specific to a
particular field I think...  A new one is written for your new field when
you run the program...)

One thing I remember... (I wrote my files quite a while back...) Watch out
for an extra line feed at the end of the files, as noted in the FIELD?.FLD
file above...  The SIM program crashes if there are any (Too many ?) at the
end of a field?.fld file I think...

I used the 'variable viewpoint' option to move around and checkout the
relative sizes and orientation of objects from altitude...

Now I've got a new machine, Pentium 166MHz versus the 'old' 486 DX2 66MHz,
I'll write some more I think...  There are already some un-used objects in
amongst my scenery files, Eg. An 'Automat' for spot landing practice & a
'H' for the centre of the circle that was just a 'pretty' embellishment...

NB5: This is all seems rather ***y complex but once you've written one
object into a field succesfully it comes a lot easier and eventually
becomes plain tedious but 'tis more fun flying on a reasonably realistic
field to my mind...

Ciao & let me know how you all get on, it'd be fun flying someone else's
field too...


Nick M.V.Salmon.      Southwest UK.

R&D on MH Design's Extant Helicopters
               Competition Flying.

Web Pages:  http://www.FoundCollection.com/~nick