bobsgameweb (okgame) is a high-performance TypeScript/PIXI.js reimplementation of the "bob's game" engine. It bridges retro 2D gameplay with modern web tech (WebGPU, Wasm, AI) to support massive regional clustering (MMO) and high-fidelity effects while maintaining 1:1 legacy parity.
- Centralized Logic:
src/renderer/engine/ecs/decouples data (Components) from logic (Systems). - Core Systems:
RenderSystem,BehaviorSystem,Physics,PathfindingSystem, andWeatherSystem. - Standard Components:
Transform,Sprite,Combat,Interaction,Quest,Inventory.
- StateManager: A self-contained scene stack (e.g.,
WorldScene,BattleScene,MenuScene). - Transition Layer:
SceneTransitionprovides visual effects (fades) during scene shifts.
- Dual Pipeline: Automatic WebGL/WebGPU switching.
- WebGPU Particles: WGSL compute shaders for 100k+ particles with direct storage buffer rendering.
- HQ2X Upscaling: Edge-aware upscaling for character sprites and assets.
- Depth Sorting: Metadata-driven
hitBoxFromTop(30px/24px) ensures correct Y-sorting for living entities.
-
Broad-phase: Spatial Grid partitioning (128px cells) for
$O(N)$ efficiency. - Narrow-phase: AABB collision detection with a Wasm Physics Bridge (C++ backend) for high-density scenarios.
- 8-Directional Movement: Includes "parity turning" (transitions through diagonals) to match legacy visual behavior.
-
Collision Rules: Tile-based collision using
WALL_IDS,FLOOR_IDS, andextralayer markers.
- Generative Assets: Text-to-sprite and text-to-dialogue generation integrated into the World Editor.
- Conversational NPCs: Persistent chat history using
personaandmoodmetadata.
- Spatial Partitioning: Map-specific Socket.io rooms to minimize global bandwidth.
- Binary Compression:
pako(zlib) compression for world sync packets > 512 bytes. - Interpolation: Client-side exponential decay lerping for remote players.
- Submodule Assimilation: Removed 31 redundant submodules (Aseprite, Ogmo, etc.) and ported their core logic to TypeScript to reduce technical debt.
- Environment Detection:
PerformanceManageroptimizes assets (prioritizing OGG) for mobile or low-end hardware. - Wasm Migration: Strategic migration of CPU-heavy logic (physics, pathfinding) to C++ via Emscripten.
- Standardized character interaction via an
interactionModestate machine. - Integrated high-performance particle effects (dust, rain, fire) into
WorldScene. - Full integration test suite (32+ files) verified at 100% pass rate.
- Audio:
AudioManagerhandles SFX and music, including Tracker modules (MOD, XM, S3M) viachiptune3. - Entity System: Yuu supports 8-directional movement (64 frames), NPCs 4-directional (32 frames).
- Blah System: NPCs use pitching 'blah' sounds to simulate speech during dialogue.