Skip to content

Repository files navigation

GWEN (Game Web Engine)

CI Status npm version Docs License: MPL-2.0 TypeScript

Composable web game framework with a Rust/WASM ECS core and TypeScript-first DX.

GWEN helps you build games with a clear structure:

  • scenes for game flow
  • systems for logic
  • components for data
  • prefabs for reusable entities
  • UI modules for menus/HUD

Quick Start · Documentation · Project Structure · CLI


Why GWEN?

  • Config-first workflow via gwen.config.ts
  • CLI scaffolding for fast project creation
  • Plugin architecture (input, audio, renderer, debug, html-ui)
  • High-performance ECS powered by Rust + WASM
  • Type-safe APIs for systems, scenes, services, and plugins

Quick Start

1) Scaffold a game project (recommended)

pnpm create@djodjonx/gwen-app my-game
cd my-game
pnpm dev

2) Open the dev server

# Usually
http://localhost:3000

3) Build for production

gwen build

CLI

GWEN ships with a CLI designed around the same workflow as the playground.

# Create project
pnpm create@djodjonx/gwen-app my-game

# Development
gwen dev

# Prepare generated typing/runtime files
gwen prepare

# Production build
gwen build

# Code quality
gwen lint
gwen format --check

See full command reference in docs/CLI.md.


Project Structure

GWEN targets a structure like the playground app:

src/
  components/   # ECS component definitions
  prefabs/      # reusable entity blueprints
  scenes/       # game flow and scene lifecycle
  systems/      # gameplay logic (runs every frame/event)
  ui/           # HUD/menu UI modules

This structure is intentional: it keeps gameplay code discoverable as the project grows.


Core Workflow

  1. Configure engine and plugins in gwen.config.ts
  2. Define components in src/components
  3. Implement systems in src/systems
  4. Compose scenes in src/scenes
  5. Reuse entities via src/prefabs
  6. Start with gwen dev

Example config shape:

import { defineConfig } from '@djodjonx/gwen-kit';
import { InputPlugin } from '@djodjonx/gwen-plugin-input';
import { AudioPlugin } from '@djodjonx/gwen-plugin-audio';
import { Canvas2DRenderer } from '@djodjonx/gwen-renderer-canvas2d';

export default defineConfig({
  engine: { maxEntities: 2000, targetFPS: 60, debug: false },
  plugins: [
    new InputPlugin(),
    new AudioPlugin(),
    new Canvas2DRenderer({ width: 480, height: 640 }),
  ],
});

Architecture (high level)

Your Game (Scenes / Systems / Components / UI)
  -> GWEN Plugins (Renderer, Input, Audio, Debug, ...)
    -> GWEN Core (Rust/WASM ECS)

For technical details, see docs/ARCHITECTURE.md.


Documentation

Full Documentation: https://djodjonx.github.io/gwen/

Reference files:


For Maintainers: Publishing to npm

Quick start:

# 1. Build
./scripts/build-wasm.sh && pnpm build:ts

# 2. Publish
pnpm publish -r --access public

See docs/QUICK_RELEASE.md for complete workflow with Changesets.


Contributing

We welcome issues, ideas, and PRs.


License

GWEN is licensed under Mozilla Public License 2.0 (MPL-2.0). See LICENSE.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages