Goodluck doesn't have version numbers; each commit is the latest release of the template from which you can generate a new project.
However, we do distinguish between generations of Goodluck. The core API changes between generations and there's a significant chance that systems written for one generation will not compatible with other generations. Adapting a system to a newer generation is usually easy, though.
World.Mask
was renamed toWorld.Signature
in #39.
- New directory layout. Each example is now an independent Goodluck project,
with its own copy of
core.ts
,game.ts
, etc. Some game-agnostic code has been moved to the top-levelcommon
directory.
-
Entity masks and component data are stored in
World
instances.class World { public Mask: Array<number> = []; public Animate: Array<Animate> = []; public AudioSource: Array<AudioSource> = []; // ... public Render: Array<Render> = []; public Transform: Array<Transform> = []; } class Game { public World = new World(); }
-
The
Get
enum has been removed. -
Component checks are performed with bitwise operations between the
World.Mask
array and theHas
enum.if (game.World.Mask[entity] & Has.Transform) ...
-
Component data is retrieved from
game.World
.let transform = game.World.Transform[entity];
-
Names of all properties are PascalCase for better naming mangling and minification.
-
Component masks are defined with a
const enum
, and are typically sorted alphabetically.export const enum Get { Animate, AudioSource, // ... Render, Transform } export const enum Has { Animate = 1 << Get.Animate, AudioSource = 1 << Get.AudioSource, // ... Render = 1 << Get.Render, Transform = 1 << Get.Transform, }
-
Game
is a regular class. Component data is stored under computed properties based on theGet
enum.class Game { public World: Array<number> = []; public [Get.Animate]: Array<Animate> = []; public [Get.AudioSource]: Array<AudioSource> = []; // ... public [Get.Render]: Array<Render> = []; public [Get.Transform]: Array<Transform> = []; }
-
Entity checks are performed with bitwise operations using the
Has
enum.if (game.World[entity] & Has.Transform) ...
-
Source code is written in TypeScript.
-
Names of all properties are lowercase snake_case.
-
Component masks are defined as constants.
export const TRANSFORM = 1 << 0; export const RENDER = 1 << 1; // ...
-
Game extends Array
. Component data is accessed with indices equal to component masks. The returned element must be asserted as the interface corresponding to requested component.let transform = game[TRANSFORM][entity] as Transform;
-
Entity checks are performed with bitwise operations using the component masks.
if (game.world[entity] & TRANSFORM) ...
- Early experiments with ECS.