Experimental canvas 2D engine for tile-based sidescroller/sandbox games, created strictly for educational purposes.
entity-component-system
game-engine
canvas-2d
1# Cosmic
2
3The experimental engine for tile-based 2D games, created strictly for educational purposes.
4
5## Requirements
6
7To run the demo project and experiment with the engine, the following tools are required.
8
9- Bun v1.3+
10
11## Try it out!
12
13You can try out the ever evolving demo project at any time, by running the following commands.
14
15```sh
16bun install
17```
18
19```sh
20bun dev
21```
22
23## Architecture
24
25The following will explain the data-flow and general architecture of the engine, including the main class, the ECS and more!
26
27### The `Cosmic` class
28
29### The `Pipeline` class
30
31Pipelines are singular, scoped and enqueue-able looping directives.
32
33For example, there might be a "rendering" pipeline, which draws the state of various entities onto the screen, on each frame, using drawing APIs.
34
35These 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.
36
37### The `Layer` class
38
39### The `EntityComponentSystem` class
40
41### The `Store` class
42
43Stores are utilized as a means of shared state throughout the engine.
44
45They are defined as static DTO-like (data transfer object) classes that extend the `Store` class.