game-development-patterns

Enforce deterministic combat and 60fps performance with game loop and state machine patterns.

8|6|Updated May 26, 2025
One-click install
npx skills add https://github.com/Hack23/blacktrigram --skill game-development-patterns
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: game-development-patterns
Source: https://github.com/Hack23/blacktrigram/tree/main/.github/skills/game-development-patterns
Command: npx skills add https://github.com/Hack23/blacktrigram --skill game-development-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured approach to building robust game loops and deterministic combat systems for Black Trigram, ensuring maintainable architecture.

Core Features & Use Cases

  • Game Loop Architecture: Use a properly clamped delta loop to prevent spiraling death and ensure smooth gameplay.
  • Fixed Timestep for Deterministic Physics: Adopt a fixed timestep with an accumulator to guarantee deterministic combat behavior.
  • State Machine Architecture: Implement a discriminated union state machine for combat flow with explicit transitions.
  • Separation of Concerns: Clearly separate game state, rules, actions, and events from rendering and audio logic.

Quick Start

Configure a minimal combat scene by enabling a clamped game loop, a fixed timestep physics update, and a discriminated union state machine to drive combat flow.

Frequently Asked Questions about game-development-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a fixed timestep for deterministic physics in TypeScript?▼

A fixed timestep for deterministic physics uses an accumulator to process updates at consistent intervals, preventing spiral-of-death issues. This separates physics from rendering to guarantee reproducible combat behavior.

Why does my game loop cause frame rate drops and how do I clamp the delta time?▼

Clamping the game loop delta prevents the spiral-of-death by capping the time slice processed per frame. This maintains smooth 60fps performance even when rendering temporarily lags behind physics updates.

How do I structure a state machine for combat flow in react-three-fiber?▼

A discriminated union state machine structures combat flow in react-three-fiber by enforcing explicit state transitions. This separates game actions and rules from rendering logic to maintain a clean architecture.

What is the best way to separate game state from rendering logic in TypeScript?▼

Separating game state in TypeScript involves isolating rules, actions, and events into a typed GameState system. This keeps deterministic combat logic decoupled from audio and rendering components.

Does this game loop pattern support 60fps combat systems?▼

Yes, this game loop pattern supports 60fps combat systems by combining a clamped delta loop with a fixed timestep accumulator. This architecture guarantees deterministic physics without sacrificing rendering performance.