TREADS Logo
by Steve Hardt

Module Listing

The C++ files in TREADS are grouped in distinct modules. This page lists the modules, files composing each module, and file contents. Accurate as of TREADS version 0.2.32.

<Module Name>

<file name>
File description.
<file name>
File description.

Top-level Application

application.h,cpp
Event-loop, timing, switching forms, top-level menu commands, start/stop/load/save game.
game_pad.h,cpp GPDLib.h
Wrapper for the shared library for the GamePad device.
app_prefs.h,cpp
Load/save application preferences.

User Interface

ui_callback.h
Interface for passing a menu commands along until the appropriate object handles it. Similar to the way event handling is implemented.
widgets.h,cpp
UI widgets for the form objects. ControlPanel displays health bar, weapon icons, and other status. Joystick converts the users pen input into movement commands.
init_frm.h,cpp
Form displayed at startup when loading graphics.
intro_frm.h,cpp
Form displaying the intro screen.
scene_frm.h,cpp
Parent of StoryFrm and ActionFrm, the forms associated with a Scene in the Plot.
action_frm.h,cpp
Form for ActionScenes, the actual game play. Draws Physical objects and ControlPanel, and handles user input.
story_frm.h,cpp
Form for StoryScenes, the text between gameplay with multiple choice buttons.

Graphics

gfx.h,cpp
Abstraction layer for all PalmOS graphics tricks. Includes custom GfxBitmap object. Gfx has two subclasses, GfxPalmBlt which uses PalmOS built-in graphics, and GfxRawBlt which uses custom blitting code. GfxPalmBlt is slower and requires OS >= 3.5, but works on 320x320 displays. GfxRawBlt is much faster and requiers only OS >= 3.0, but it only works on 160x160 displays.
depth_handler.h,cpp
All graphic code specific to a bit-depth. DepthHandler has child classes for black&white, greyscale, and 8-bit color. Custom high-speed blitting code.
page_handler.h,cpp
Implementation of backbuffer, if device supports true page flipping, use that.
gfx_owner.h,cpp
All graphics data is owned by the GfxOwner. Allows us to change color mode at run-time by deleting and reloading the GfxOwner.
bmp_set.h,cpp
A collection of related bitmaps, eg. all animation frames in all directions for the Tank. DirBmpSet will auto-generate all 16, 8, or 4 directions from a single prototype bitmap.
bmp_writer.h,cpp
Used by BmpSet/GfxBitmap to create rotated versions of a bitmap.
db_pool.h,cpp
DBPool manages the persistent database used for GfxBitmaps. This allows us to create all graphics data once the first time TREADS is run and reuse it later. And, since GfxBitmap data is in PalmOS database memory we avoid the heap memory limitations of PalmOS.

Input/Output

io.h,cpp
Loader and Saver objects that control loading and saving the game.

Physical Objects

physical.h,cpp controllable.cpp
The hierarchy of Physical objects (Tank, Missile, Wall, Building, Explosion, etc.) that actually appear in the game. Controllable objects are those that can be controlled by an Intel object (vehicles, people, and TREADS itself).
meta.h,cpp
Meta-classes for the Physical classes. Used to store graphics and as factories.
ability.h,cpp
Controllable objects can have various Abilities like User (use weapons/items) or Parasite (take over empty vehicles). To simplify the Physical hierarchy and avoid using multiple inheritance I chose a one-to-many, has-a relationship between Controllable and Ability instead of trying to insert all Ability classes into the Physical hierarchy.
item.h,cpp
A Controllable with the "User" Ability can hold and use Items. Each Item shows up as an icon in the ControlPanel.

Artificial Intelligence

intel.h,cpp
The intelligence object and artifical intelligence. All intelligences are computer-controlled except TreadsIntel which is a wrapper for user commands.
strategy.h,cpp
Each AI has a prioritized list of strategies that determine its behavior. Strategies are run in priority order until one triggers and sets the Command for the current turn. Example strategies are FollowRoads, ShootTreads (shoot at TREADS if possible), ToTreads (move toward the TREADS robot), and DuckNCover (run away from violence).

Object Locator

locator.h,cpp
The list of all Physical and Intel objects. Collision and proximity detection. Updates (clocks) objects each turn. Draws all Physicals on screen in correct z-order.
grid.h,cpp grid_test.h,cpp
Used internally by Locator. Partition world into discrete grid-squares to enable fast collision and proximity detection.
locator_data.h,cpp
Every Physical contains this opaque object that Locator/Grid uses for its internal management.
terrain.h,cpp
The map of roads and the little spots on the ground. Draws the background and roads.

Plot

plot.h,cpp scene.h,cpp
A Plot is a collection of Scenes much like a finite state machine. There is a start scene, end scene, current scene, and each scene has a fixed set of possible next scenes. The existence of a Plot object means a game is in play. Saving/loading the Plot saves/loads the game.
action_scene.h,cpp
A fast-action gameplay scene, various criteria for choosing the next scene, e.g. end the scene when TREADS gets to a building or when all enemies are dead. Coupled with the ActionFrm.
action_arcade.cpp
All ActionScenes in the ArcadePlot ("Action Game" in the menu).
action_adventure.cpp
All ActionScenes in the AdventurePlot ("Story Game" in the menu).
story_scene.h,cpp
Text-based scenes between regular gameplay. User clicks on one of several choices to determine next scene. Coupled with the StoryFrm.
story_common.cpp
StoryScenes common to both ArcadePlot and AdventurePlot.
story_arcade.cpp
StoryScenes for ArcadePlot.
story_adventure.cpp
StoryScenes for AdventurePlot.

Utilities

base.h,cpp
Included by all files. Constants, basic data types, memory handling, geometric primitives.
allocator.h,cpp
Fixed size memory pool for quick allocation.
word.h
Some constants for word size on 68000 chip.
containers.h,cpp
Generic container classes, like a mini-version of C++ STL. Vector, HashTable, WeakPointer.
mmath.h,cpp
Math routines mostly concerned with 2D rotation matrices.
exception.h,cpp
Exceptions and error handling.

© 2002 - 2004. Steve Hardt. All rights reserved.