This folder contains the new Typescript implementation of Eastern Front 1941.
Source files are in *.ts
and Jest unit tests are in *.test.ts
.
README.md
is this file.
CHANGES.md
captures a history of many of the cartridge-specific features
that were implemented after I had the base APX code mostly working.
It might have useful context as to how and why I made particular design choices.
TODO.md
tracks a running list of future tasks which might or might not get implemented.
Various static configuration choices are parameterized in config.ts
.
Also see the implementation notes with more background on the design.
The app is split into three components, described in more detail below:
engine/
- the headless game engineantic/
- a generic Atari-like character-based display windowapp/
- the UX for the game itself
The core game engine is a headless EventEmitter
rooted in game.ts
.
The "public" API across all engine modules is exposed in index.ts
for bundling purposes.
Much of the cartridge storage budget is taken up by the various maps and tables
needed to play the game, just like a physical wargame.
These tables are directly extracted from the original binaries via scripts/
and
expressed in a more accessible form here.
defs.ts
- Core data type definitions, enums and so forthscenarios.ts
- Definitions for each of the difficult levels and scenariosmap-data.ts
- ascii representations of the game map derived from the binary dataoob-data.ts
- Orders of battle (lists of unit data) used in the various scenarios, extracted from binary data
The game and AI logic are defined in:
game.ts
- the core game engine, managing the map (map.ts
) and order of battle (oob.ts
)map.ts
- manages the game board which contains units and citiesgrid.ts
- a generic system to manage the cartesian grid upon which the map sitsoob.ts
- manages the order of battle, little more than a specialized array of unitsunit.ts
- manage an individual unit and its interactions with other units like combatthink.ts
- implements the original APX AI systemcodec.ts
- a suite of integer coding and decoding utilities used primarily to encode and decode compact game staterng.ts
- replaces Atari's truly random byte generator with a simple reproducible random number generator. This makes the game a pure function of an initial seed value, making it easier to test and reason about.
The display is based on a simple model/view/controller implementation in app/
,
which leverages a generic Atari-like 'video terminal' window provided by antic/
.
antic/
:
palettes.ts
- Various options for converting from Antic to RGB coloranticmodel.ts
- models a variable size character display, with vt52-like formatting codesanticview.ts
- maps a display region to HTML
app/
:
app.ts
- the main external entry point, simply instantiates an app controllerappctrl.ts
- the app controller which manages game state between setup, order and turn resolutionappkeys.ts
- key handlers for the app controller, mapping key presses to controller actions by game stateappmodel.ts
- the app display model, which maps the game state into a set of antic windowsappview.ts
- the app view, a declarative mapping of the model to HTML with MithrilJShelp.ts
- implements the help popover with some display scrambling for fun