Cosmic#
The experimental pixi.js based engine for tile-based 2D games, created strictly for educational purposes.
Requirements#
To run the demo project and experiment with the engine, the following tools are required.
- Bun v1.3+
Try it out!#
You can try out the ever evolving demo project at any time, by running the following commands.
bun install
bun dev
Architecture#
The following will explain the data-flow and general architecture of the engine, including the main class, the ECS and more!
The Cosmic class#
The Pipeline class#
Pipelines are singular, scoped and enqueue-able looping directives.
For example, there might be a "rendering" pipeline, which draws the state of various entities onto the screen, on each frame, using drawing APIs.
These are enqueued separately, rather than having one hard-coded main loop, to allow varying execution speeds, like a rendering pipeline running on every frame, and a physics pipeline running at a calculated interval of 60 FPS.
The Layer class#
The EntityComponentSystem class#
The Store class#
Stores are utilized as a means of shared state throughout the engine.
They are defined as static DTO-like (data transfer object) classes that extend the Store class.