Back to Rules
TypeScript

Pixi.js TypeScript Game Development Rules: Best Practices for High-Performance Web & Mobile Games

Claude Directory November 29, 2025
0 copies 1 downloads

Unlock smooth, efficient Pixi.js games in TypeScript with these optimized rules. Covering project structure, naming conventions, performance tweaks, mobile adaptations, and Pixi.js-specific techniques for seamless web and mobile experiences.

Rule Content
### Code Principles
**Do:** Prioritize concise, performant TypeScript using functional and declarative styles; reserve classes for Pixi.js necessities.
*Example:*
```typescript
const updatePosition = (sprite: PIXI.Sprite, delta: number) => {
  sprite.x += delta * speed;
};
```
**Don't:** Rely on classes for simple logic or create objects excessively during loops.
*Example (Avoid):*
```typescript
class PositionUpdater {
  update(sprite: PIXI.Sprite, delta: number) { /* ... */ }
}
```

### Project Organization
**Do:** Group code into feature-based folders like scenes/, entities/, systems/, and assets/.
*Example:*
```
src/
  scenes/
    game-scene.ts
  entities/
    player-entity.ts
  systems/
    physics-system.ts
```
**Don't:** Scatter files randomly or mix concerns in single files.
*Example (Avoid):* Dumping all game logic into one massive app.ts.

### Naming Conventions
**Do:** Apply camelCase for functions/variables, kebab-case for files, PascalCase for classes/Pixi objects, and prefixes like 'is', 'has' for booleans; UPPERCASE for constants.
*Example:*
```typescript
const createPlayerSprite = (): PlayerSprite => { /* ... */ };
const isGamePaused = false;
const MAX_LIVES = 3;
// File: player-entity.ts
```
**Don't:** Use inconsistent casing or vague names like 'x' or 'tmp'.
*Example (Avoid):* `let p = new Sprite();`

### TypeScript & Pixi.js Practices
**Do:** Enforce strong typing everywhere, use Pixi Ticker for loops, WebGPU with WebGL fallback, and object pooling.
*Example:*
```typescript
const app = new PIXI.Application({ preferWebGpu: true });
app.ticker.add((delta) => updateGame(delta));
interface GameEntity { x: number; y: number; }
```
**Don't:** Skip types or use raw DOM events instead of Pixi interaction manager.
*Example (Avoid):* Untyped `any` for sprites.

### Pixi.js Optimizations
**Do:** Batch sprites, use texture atlases, ParticleContainer for particles, culling, and caching.
*Example:*
```typescript
const particles = new PIXI.ParticleContainer(10000, { scale: true, alpha: true });
// Atlas: load single texture sheet
```
**Don't:** Nest containers deeply or create sprites per frame without pooling.
*Example (Avoid):* `new PIXI.Sprite(texture)` inside update loop.

### Performance Boosts
**Do:** Minimize GC with pooling, lazy/pre-fetch loading, level chunking, and bounds checks.
*Example:*
```typescript
const pool: PIXI.Sprite[] = [];
const getSprite = () => pool.pop() || new PIXI.Sprite();
```
**Don't:** Load uncompressed assets or compute off-screen elements.

### Mobile (Ionic Capacitor) Tweaks
**Do:** Add touch gestures, responsive UI, low-res assets, and power-saving via Ticker throttling.
*Example:* Use Capacitor plugins for haptics; `legacy: true` for old devices.
**Don't:** Ignore orientation changes or use desktop-res assets on mobile.

### Deployment & Testing
**Do:** Set env vars, CI/CD, unit/integration tests, profiling, and CDN caching.
*Example:* Vercel for static assets with progressive loading.
**Don't:** Deploy without cross-device tests or error handlers.

### Code Suggestions
**Do:** Analyze first, step-by-step plan, performant snippets with explanations.
**Don't:** Suggest unoptimized libs without evaluating impact.

Comments

More Rules

View all
AI/ML

GLM-4.7 Optimized Config & System Prompt Designer

Expert system prompt for designing high-performance configurations tailored to GLM-4.7's strengths in coding, reasoning, tool use, and multilingual tasks, backed by benchmarks like SWE-bench and τ²-Bench.

C
Community
AI/ML

GLM-4.7 Open-Source Coding Expert: Optimized System Prompt

Leverage GLM-4.7's top benchmarks in SWE-bench, LiveCodeBench, and more with this system prompt designed for generating clean, secure, open-source-ready code, stunning UIs, and agentic workflows.

C
Community
AI/ML

GLM-4.7 Optimized Coding Agent

This system prompt transforms an AI into GLM-4.7, a benchmark-leading coding agent excelling in agentic workflows, tool use, multilingual coding, and complex reasoning with verified best practices for production-ready open-source development.

C
Community
DevOps

Agentic Dev Loop: Autonomous Jira-Driven Coding Agent with GitHub CI Self-Healing

Ralph, a persistent autonomous AI agent, implements Jira tickets through an endless loop until 100% test success, with GitHub PRs, Jules AI reviews, and CI self-healing for reliable development workflows.

C
Claude Directory
AI/ML

Türk Hukuku Uzmanı AI Agent: Güvenilir Yasal Danışman System Prompt

Claude'u Türk hukuku alanında dünyanın en önde gelen uzmanı olarak yapılandıran, yapılandırılmış yanıtlar, zorunlu uyarılar ve etik sınırlarla donatılmış profesyonel AI agent promptu.

C
Community
Database

PostgreSQL Best Practices: Expert Subagent Guide

Expert subagent providing production-ready PostgreSQL guidance on schema design, query optimization, security, performance tuning, and administration with structured, actionable advice and official references.

C
Claude Directory