44
55[ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/hiddentao/clockwork-engine/ci.yml?branch=main )] ( https://github.com/hiddentao/clockwork-engine/actions )
66[ ![ Coverage Status] ( https://coveralls.io/repos/github/hiddentao/clockwork-engine/badge.svg?branch=main )] ( https://coveralls.io/github/hiddentao/clockwork-engine?branch=main )
7- [ ![ NPM Version] ( https://img.shields.io/npm/v/@hiddentao/ clockwork-engine.svg )] ( https://www.npmjs.com/package/@hiddentao/ clockwork-engine )
7+ [ ![ NPM Version] ( https://img.shields.io/npm/v/@clockwork-engine/core .svg )] ( https://www.npmjs.com/package/@clockwork-engine/core )
88[ ![ TypeScript] ( https://img.shields.io/badge/TypeScript-5.3.3-blue.svg )] ( https://www.typescriptlang.org/ )
99
10- ** A TypeScript game engine for deterministic, replayable games with built-in recording, replay, and rendering capabilities .**
10+ ** A TypeScript game engine for deterministic, replayable games with platform-agnostic rendering.**
1111
12- [ Documentation] ( ./docs )
12+ [ Documentation] ( ./packages/core/ docs )
1313
1414</div >
1515
1616---
1717
18- ## 🎮 Live Demo
18+ ## Live Demo
1919
2020** [ Try the Interactive Demo →] ( https://hiddentao.github.io/clockwork-engine ) **
2121
22- ## ✨ Features
22+ ## Features
2323
24- - 🎯 ** Deterministic Gameplay** - Frame-based updates with seeded PRNG for perfect reproducibility
25- - 📹 ** Record & Replay** - Built-in recording system for gameplay sessions with frame-accurate playback
26- - 🎮 ** Game Object System** - Type-safe game entities with automatic grouping and lifecycle management
27- - 🎨 ** Built-in PIXI.js Renderer ** - Built-in [ pixi.js ] ( https://pixijs.com/ ) integration with viewport management, event handling, and rendering abstractions
28- - 🏃♂️ ** High-Performance Collision Detection** - Spatial partitioning with BSP trees for efficient collision queries
29- - ⚡ ** Event-Driven Architecture** - Flexible event system with custom event sources and managers
30- - 🔄 ** Universal Serialization** - Automatic serialization for all game data with custom type support
31- - ⏱️ ** Frame-Based Timers** - Deterministic timing system replacing JavaScript's native timers
32- - 🔧 ** TypeScript First** - Full type safety with comprehensive interfaces and generics
24+ - ** Deterministic Gameplay** - Frame-based updates with seeded PRNG for perfect reproducibility
25+ - ** Record & Replay** - Built-in recording system for gameplay sessions with frame-accurate playback
26+ - ** Game Object System** - Type-safe game entities with automatic grouping and lifecycle management
27+ - ** Platform-Agnostic Rendering ** - Separate rendering implementations (PIXI.js for web, headless for testing)
28+ - ** High-Performance Collision Detection** - Spatial partitioning with BSP trees for efficient collision queries
29+ - ** Event-Driven Architecture** - Flexible event system with custom event sources and managers
30+ - ** Universal Serialization** - Automatic serialization for all game data with custom type support
31+ - ** Frame-Based Timers** - Deterministic timing system replacing JavaScript's native timers
32+ - ** TypeScript First** - Full type safety with comprehensive interfaces and generics
3333
34- ## 🚀 Quick Start
34+ ## Packages
35+
36+ This monorepo contains the following packages:
37+
38+ | Package | Description |
39+ | ---------| -------------|
40+ | [ ` @clockwork-engine/core ` ] ( ./packages/core ) | Core engine with game objects, recording/replay, serialization, and platform abstraction |
41+ | [ ` @clockwork-engine/platform-web-pixi ` ] ( ./packages/platform-web-pixi ) | Web platform with PIXI.js 2D rendering |
42+ | [ ` @clockwork-engine/platform-memory ` ] ( ./packages/platform-memory ) | Headless platform for testing and replay validation |
43+
44+ ## Quick Start
3545
3646### Installation
3747
3848``` bash
39- npm install @hiddentao/clockwork-engine
40- # or
41- bun add @hiddentao/clockwork-engine
49+ # Install core engine and web platform
50+ bun add @clockwork-engine/core @clockwork-engine/platform-web-pixi
51+
52+ # For testing/headless use
53+ bun add @clockwork-engine/platform-memory
4254```
4355
4456### Basic Usage
4557
4658``` typescript
47- import { GameEngine , GameObject , Vector2D , GameCanvas } from ' @hiddentao/clockwork-engine'
59+ import { GameEngine , GameObject , Vector2D , GameCanvas } from ' @clockwork-engine/core'
60+ import { WebPlatformLayer } from ' @clockwork-engine/platform-web-pixi'
4861
62+ // 1. Define your game engine
4963class MyGame extends GameEngine {
5064 setup() {
51- // Initialize your game world
5265 const player = new Player (new Vector2D (100 , 100 ))
5366 this .registerGameObject (player )
5467 }
5568}
5669
70+ // 2. Define your game canvas
5771class MyGameCanvas extends GameCanvas {
58- protected initializeGameLayers (): void {
72+ protected setupRenderers (): void {
5973 // Set up your game rendering layers
6074 }
6175
6276 protected render(deltaFrames : number ): void {
63- // Custom rendering logic (optional)
77+ // Custom rendering logic
6478 }
6579}
6680
67- const game = new MyGame ()
68- game .reset (" my-seed" )
69-
70- // Create canvas with built-in PIXI.js integration
71- const container = document .getElementById (' game-container' )
72- const canvas = await MyGameCanvas .create (container , {
73- width: 800 ,
74- height: 600 ,
81+ // 3. Initialize the platform and canvas
82+ const container = document .getElementById (' game-container' )!
83+ const platform = new WebPlatformLayer (container , {
84+ screenWidth: 800 ,
85+ screenHeight: 600 ,
7586 worldWidth: 800 ,
76- worldHeight: 600
87+ worldHeight: 600 ,
7788})
89+ await platform .init ()
90+
91+ // 4. Create and initialize the canvas
92+ const canvas = new MyGameCanvas (
93+ { width: 800 , height: 600 , worldWidth: 800 , worldHeight: 600 },
94+ platform
95+ )
96+ await canvas .initialize ()
7897
98+ // 5. Create game engine and connect to canvas
99+ const game = new MyGame ()
100+ await game .reset ({ seed: ' my-seed' })
79101canvas .setGameEngine (game )
80102game .start ()
81103```
82104
83- ## 📚 Documentation
105+ ## Documentation
84106
85- Comprehensive documentation is available in the [ docs] ( ./docs ) directory:
107+ Comprehensive documentation is available in the [ docs] ( ./packages/core/ docs ) directory.
86108
87- ## 🛠️ Development
109+ ## Development
88110
89111### Prerequisites
90112
@@ -101,7 +123,7 @@ cd clockwork-engine
101123# Install dependencies
102124bun install
103125
104- # Build the project
126+ # Build all packages
105127bun run build
106128
107129# Run in watch mode
@@ -134,9 +156,9 @@ bun run format
134156### Demo Application
135157
136158``` bash
137- # Run the demo (from project root)
159+ # Run the demo
138160cd demo
139- bun i
161+ bun i
140162bun run dev
141163```
142164
@@ -173,9 +195,8 @@ The release process will:
173195
174196## Changelog
175197
176- See [ CHANGELOG.md] ( CHANGELOG.md )
198+ See [ CHANGELOG.md] ( ./ CHANGELOG.md)
177199
178- ## 📄 License
200+ ## License
179201
180202This project is licensed under the MIT License - see the [ LICENSE.md] ( LICENSE.md ) file for details.
181-
0 commit comments