Destiny Project Notebook, Folio 2

Representing Terrain

Terrain Index in map layer is mapped through a lookup table to the following elements:

Terrain pattern, per windows brush pattern, is an 8 x 8 monochrome bitmap. (Represented in lut file as 16 hex chars?) Actually, with a pattern, no icon is necessary (may want for points of interest, but do not need for terrain. It is unclear from the documentation whether multicolor bitmaps can be used as patterns.

Terrain Palette Editor used to establish and edit the terrain lookup table. Pick lut index, fg and bg colors, and edit pattern (displayed in chosen colors), as well as specifying name(s) and movement cost.

Terrain Palette Editor -- Implementation notes for Borland C++ Builder

8 June 1997

TBitmap holds a bitmap

Constructor takes no args, so load from file or initial setting of properties must be done afterward.

Properties: Width Height Monochrome
TPE values: 8 8 true


LoadFromStream( TFileStream( "filename", mode ) ) where mode is fmOpenRead | fmShareDenyNone (or fmShareCompat??) [see TFileStream for other modes]


SaveToStream( TFileStream( "filename", mode ) ) where mode is fmCreate | fmShareCompat

Apparently, one can load / save many components to / from stream in succession (e.g. all 256 bitmap patterns of the palette into / out of same file).


TBitmap has a Canvas property which is a TCanvas*. TCanvas has a host of drawing methods: lines, polygons, elipses, arcs, rects, and fills, etc. (even text) and properties for a Pen (outlines), a Brush (fills), and a Font (text). TCanvas also has a Pixels property which is a TColor** (i.e. reference as Pixels[x][y]=0x00FF0000 or Pixels[x][y]=clBlack). Not clear how Pixels works with monochrome TBitmap, but could draw on canvas using one of the supplied methods, then examine Pixels[x][y] to see the effect. For that matter, not sure how to set the Pen and / or Brush to draw for monochrome TBitmap (not covered in documentation) since they seem to need a Color property too.


Want to display as drawn in fg, bg colors but bitmap is monochrome, so keep monochrome bitmap as an off-screen bitmap (i.e. no associated control). When editing, perform load, save, draws onto the off-screen bitmap, then reassign the off-screen bitmap to the patterns of the canvas brushes, then re-draw the display canvases.

Three displays, shown simultaneously: isolated, clustered, and enlarged, with fg, bg colors as chosen and pattern per monochrome bitmap.


The enlarged view is editable (clicks invert a pixel from fg to bg or vice versa), though clicks are handled rather indirectly, as described above.


classs TerrainPalette
    TerrainPalette( char* filename );

    SavePalette( char* filename );

    std::vector< std::string > name;
    std::vector< TBitmap > pattern;
    std::vector< TColor > fgColor;
    std::vector< TColor > bgColor;
    std::vector< double > movementCost;

    bool dirty;
    std::string paletteName;
    std::string paletteDescription;

Initialize vectors at size 256 in constructors.

Note: cannot use vector because vectored class must have a default constructor. VCL classes do not work because they must be instantiated using operator new, which the STL vector code does not do.

11 June 1997 3 AM

At this point have form for main window laid out. All file functions working (New, Open, Save, SaveAs, Exit). Clicking on fg, bg color areas invokes color picker.

4 July 1997

With the completion of the pattern editor about 2 weeks ago, its time to get serious about a map display class.

Convert elevation to map units (m->Km), then apply vertical exaggeration factor (typically 100).

Perspective, isometric, and top-down displays:

Where is a tile? Elevation and location are at center, but drawing routines will want vertices.

By dividing each tile into four triangular facets, continuity of elevation can be maintained. If we need to use only one polygon instead of four, can use quadrilateral based on mid-edge locations.

What to do now that I have an isometric display class

25 July 1997


Have a type index (like terrain, but perhaps only 4 bits). Type is used to indicate how the barrier is displayed:

Have a height (in meters) so display knows how to draw them. Other game implications as well, e.g. if player has a 4m ladder, can they go over the barrier?

Have permeability flags or parameters indicating whether the barrier is permeable to:

Permeability Examples Controlling Parameter(s)
Energy light, heat, radar frequency bands, attenuation
Pressure sound, force of explosion minimum pressure, maximum pressure
Missiles arrows, thrown rocks maximum size
Flying Creatures birds, insects maximum size
Magic especially line of sight spells, but also clairvoyance, etc. attenuation
Fluid water, gasses density, flow rate
Fire specialization of chemical reaction attenuation

Have a state which is open or shut. Doors and gates are barriers too, and fences and walls can be destroyed and rebuilt.

Have a force which when applied is sufficient to open a barrier. Force may be applied in several blows (i.e. need not be all at once).

May be locked, requiring a key, lock picking, or the application of sufficient force. If barred, keys or lock picking are ineffective.

May be visible of invisible.

May weather (take damage) at a fixed (usually low) rate.

Creature attributes from SimLife (Maxis)




Food Sources (yes / no flags for various sources)







Max Size


Also has a prefer - avoid - ignore array of creatures / plants in order of importance (8 slots in the array). For predators, this array controls which creatures are considered food.

Gene pool diversity: variation in initial genetic makeup of a population

Mating difference: maximum allowable genetic difference for mating to succeed

% Genes from Father: As the name indicates; the rest are from mother

Plant attributes from SimLife (Maxis)

Back to the Destiny documents

Back to the Previous Folio of the Notebook

Onward to the Next Folio of the Notebook