Skip to main content

AI Agent Guide

GameByte is optimized for AI-driven development with tiered documentation and discoverable patterns.

Quick Start for Agents​

1. Load Core Knowledge (Required)​

Read these files first:

  • Core API: /ai-agent-guide/core-api (~2000 tokens)
  • Quick Reference: /ai-agent-guide/quick-reference (~500 tokens)

2. Discover Topics (As Needed)​

# Search guides by keyword
grep -r "physics" docs/
grep -r "mobile.*optimization" docs/

3. Reference Examples​

Check examples/ directory for working code patterns.

Documentation Tiers​

TierContentTokensWhen to Load
Tier 1Core API~2000Always (pre-loaded)
Tier 2Advanced guidesVariableOn-demand
Tier 3Working examplesVariableFor patterns

LLM Integration​

llms.txt​

The /llms.txt file provides a machine-readable index:

GET https://docs.gamebyte.dev/llms.txt

All markdown docs include semantic keywords:

<!-- llm-context: physics, collision, 2d, matter-js -->

Frontmatter​

Each page includes:

  • llm_summary: One-line API summary
  • keywords: Searchable terms
  • llm-context: Semantic context tags

Key Patterns​

Minimal Game Setup​

const game = createGame();
await game.initialize(canvas, '2d');
game.start();

Service Resolution​

const renderer = game.make('renderer');
const sceneManager = game.make('scene.manager');
const input = game.make('input');

Scene Creation​

class MyScene extends BaseScene {
constructor() { super('my-scene', 'My Scene'); }
async initialize() { await super.initialize(); /* setup */ }
update(deltaTime: number) { super.update(deltaTime); /* logic */ }
}

Common Tasks​

TaskPattern
Create gamecreateGame() → initialize(canvas, '2d') → start()
Add scenesceneManager.add(new Scene()) → switchTo('id')
Create buttonnew UIButton({ text, width, height, backgroundColor })
Play audioMusic.play(key) or SFX.play(key)
Handle inputinput.keyboard.on('KeyW', callback)
Add physicsPhysics.create2DWorld() → createBody()

Smart Defaults​

GameByte has 40+ auto-configured settings. Only override when needed:

  • Touch targets: 44px (Apple HIG)
  • Render resolution: Device pixel ratio
  • Physics timestep: 1/60
  • Audio volumes: Master=1, Music=0.7, SFX=1

Integration Tips​

  1. Start with Core API - Covers 80% of use cases
  2. Use semantic search - Keywords in all docs
  3. Check examples - Real working code
  4. Smart defaults - Don't over-configure
  5. Type-safe - Full TypeScript support