Overview IxScript is compiled from plain text to JS objects in a single-pass, using Ohm to represent grammar, handle tokenization, and provide a base (recursive) visitor for parsing. If parsing fails (either due to a user syntax error or bug in the mapping), the error's coerced to a standard format for return. If successful, the root program node is returned, ready to run.
After checking for…
More →
Traits Traits are similar to attributes and annotations of other languages - user-land additional data and functionality attached to language elements such as function definitions or statements.
Traits are added in a double-prefixed tuple and referred to by element label. The VM handles some traits specifically - such as onBefore/onAfter interceptors - but for others, they can be retrieved at run…
More →
Conditions Conditions make effects... conditional.
Conditions can have sourceConditions and targetConditions, each an array of SimpleIxCondition. These lightweight types are part of the core ix-script library, and share logic for checking conditions, ensuring compatibility between the lighter (and faster-to-parse/run) condition subset and the full scripting language.
They use simple type-value…
More →
Effects are plain JSON data objects that describe what should happen, without encoding specific targets and other run-time behavior. They're a core part of the game's systems, acting as the lowest layer of functionality for game data & scripting. Effect Structure
Effects have a few core properties:
an ID, from a hardcoded list of supported effects an optional explicit target, overriding the…
More →
UI in React I've long used React in my professional work and at this point find it natural to think in. Going back to imperative UI models, especially for games, was quite painful - having to keep track of state differences, or emit lots of events.
A few years back I started using React for my web-based games - both as a primary control (incrementals), and as an in-game toolbar/window/modal…
More →
Entities are one of two in-world object types (the other being Tiles; actually tightly-packed bitmaps), representing a given archetype in a convenient and strongly-typed object structure. While entities are state-only and have composable data, they don't use a typical components array (or lookup structures). Instead, the entity system makes heavy use of TypeScript's type inference, narrowing, and…
More →
Ix Script I started IxScript to have a simple, safe in-game scripting language for my projects - easy to extend in both plain TS and in the language itself. IxScript favors less code and syntax, with commas and parentheses optional in many cases.
IxScript uses the Ohm library to define its grammar and parse the text into in-memory program objects. The program can then be run step-by-step as a…
More →
Ix Game Engine - Templates As mentioned, Ix has both a low-level system layer (runGameUpdate), a higher-level DSL through Effects, and Entities of different types (player, enemy, hero, area, block, etc). Bridging these layers, and forming the meat of the game content, is the template system.
Template Shapes
Templates are largely plain JSON objects, loaded at game startup (both new game and upon…
More →
Ix Game Engine I use a custom engine for my games' logic. At a high level, the engine:
Entities
Uses Entities, but not Components or Systems I use archetype-based entities in a sum type AnyEntity:
type HasPos = {pos: XYPos};
type HasInventory = {inventory: InventoryState};
// ...
export type HeroEntity = BaseEntity<'hero'> & HasPos & HasInventory;
export type EnemyEntity = BaseEntity<'enemy'> &…
More →
Motivation Tech
Extensive use of TypeScript for type safety ReactJS for UI ExcaliburJS for rendering break-eternityjs for large number support (Decimal) an NPM workspaces-based monorepo setup
Components
Common
The common package is my core library that I carry from project to project, containing helper functions and structures for web-based games. It houses game data structures (grids, FSMs, etc…
More →