1---2name: gamedev-conventions3description: Cross-engine game development conventions and standards for the game-dev team4---5
6# Game Dev Team Conventions
7
8## General
9
10- Detect and follow the project's existing engine and code conventions
11- Use delta time for all frame-rate-dependent calculations
12- Implement object pooling for frequently spawned/destroyed objects
13- Separate game data from game logic (data-driven design)
14- Use events/signals for decoupled communication between systems
15- Keep game state serializable for save/load support
16- Profile before optimizing - measure, don't guess
17
18## Performance Standards
19
20- **Target frame rate**: Maintain target FPS (60 for action games, 30 for strategy)
21- **Memory**: Minimize per-frame allocations, avoid GC spikes
22- **Draw calls**: Batch where possible, use instancing for repeated geometry
23- **Physics**: Use layer masks, limit raycast distances, prefer overlap checks over raycasts
24- **Loading**: Use async loading, show progress, never block the main thread
25- **Pooling**: Pool projectiles, particles, enemies, and any frequently created objects
26
27## Code Organization
28
29- One primary class/script per file
30- Group files by system (Player/, Enemies/, UI/, Environment/, etc.)
31- Keep scripts/components focused - single responsibility
32- Use namespaces or folders to prevent naming collisions
33- Separate editor tools from runtime code
34
35## State Management
36
37- Use finite state machines for entities with discrete states
38- Implement proper enter/exit/update for each state
39- Make state transitions explicit and traceable
40- Handle edge cases (interrupted transitions, invalid states)
41- Consider hierarchical state machines for complex entities
42
43## Input Handling
44
45- Abstract input from actions (don't check KeyCode directly)
46- Support remapping and multiple input devices
47- Handle simultaneous inputs correctly
48- Implement input buffering for action games
49- Test with keyboard, mouse, and gamepad
50
51## Asset Conventions
52
53- Use consistent naming: `PascalCase` for types, `camelCase` or `snake_case` per engine convention
54- Textures: Power-of-2 dimensions, appropriate compression per platform
55- Models: < 50K triangles for mobile, < 100K for desktop (per object)
56- Audio: Use appropriate compression, implement spatial audio where needed
57- Keep source assets separate from imported/processed assets
58
59## Testing
60
61- Test critical game systems (state machines, damage calculation, inventory)
62- Write integration tests for complex interactions
63- Automate repetitive playtesting with bots or scripts where possible
64- Test edge cases: zero health, full inventory, boundary conditions
65- Verify platform-specific behavior on target hardware
66
67## Multiplayer (when applicable)
68
69- Implement authoritative server (never trust the client)
70- Minimize network bandwidth (delta compression, relevancy)
71- Handle latency with prediction and reconciliation
72- Test with simulated lag and packet loss
73- Implement proper disconnect/reconnect handling
74
75## Collaboration
76
77- Each agent works within their defined scope
78- Agents should not modify files outside their responsibility
79- Engine-dev and gameplay-dev agree on system interfaces before implementation
80- All changes must follow patterns found in the existing codebase
81- Use the engine-specific skill as your primary reference