make2d is a lightweight game framework for building 2D WebGL games in JavaScript.
It provides a Unity-inspired architecture on top of PIXI.js, focusing on:
👉 https://nenjack.github.io/make2d/demo/?fps&debug
import { Scene, GameObject } from 'make2d'
import { takeUntil } from 'rxjs'
const scene = new Scene({
visible: true,
autoSort: true
})
// scene-level update loop
scene.update$.pipe(takeUntil(scene.destroy$)).subscribe(() => {
scene.physics.separate()
})
const gameObject = new GameObject('Entity Name')
scene.addChild(gameObject)
// game object update loop
gameObject.update$
.pipe(takeUntil(gameObject.destroy$))
.subscribe((deltaTime) => {
gameObject.update(gameObject, deltaTime)
})
[HTML5 Canvas + WebGL]
└── [Scene]
└── [Collision System]
└── [GameObject x 50]
├── [Body]
└── [Animator]
└── [StateMachine]
The hierarchy and API are intentionally similar to Unity, making it easy to reason about complex scenes.
When building multiple indie and HTML5 WebGL games, a few recurring problems show up:
make2d addresses these by design, using a strict hierarchy and lifecycle model inspired by Unity.
Every object in make2d participates in a tree-based lifecycle.
Examples:
tank → turret → ammohouse → furniture → propsAll framework classes implement Lifecycle
Destroying any object:
destroy$RxJS subscriptions can safely bind to destroy$
update$ observabledeltaTime is provided each frameThis makes it easy to compose behavior without manual bookkeeping.
make2d provides a small but complete set of building blocks:
PIXI.Container + lifecyclePIXI.Sprite + lifecyclePIXI.AnimatedSpriteyarn add make2d
MIT