Agent skill
building-mechanics
Three.js 3D building system with spatial indexing, structural physics, and multiplayer networking. Use when creating survival games, sandbox builders, or any game with player-constructed structures. Covers performance optimization (spatial hash grids, octrees, chunk loading), structural validation (arcade/heuristic/realistic physics modes), and multiplayer sync (delta compression, client prediction, conflict resolution).
Install this agent skill to your Project
npx add-skill https://github.com/Bbeierle12/Skill-MCP-Claude/tree/main/skills/3d-building-advanced
SKILL.md
3D Building Mechanics
Complete building system for Three.js games with performance optimization, structural physics, and multiplayer networking.
Quick Start
import { SpatialHashGrid } from './scripts/spatial-hash-grid.js';
import { HeuristicValidator } from './scripts/heuristic-validator.js';
// Spatial indexing for fast queries
const spatialIndex = new SpatialHashGrid(10);
spatialIndex.insert(piece, piece.position);
const nearby = spatialIndex.queryRadius(position, 15);
// Structural validation (Rust/Valheim style)
const validator = new HeuristicValidator({ mode: 'heuristic' });
validator.addPiece(piece);
const canPlace = validator.validatePlacement(newPiece);
Reference Files
Read these for detailed implementation guidance:
references/performance-at-scale.md- Spatial partitioning, chunk loading, instancing, LODreferences/structural-physics-advanced.md- Arcade vs heuristic vs realistic physicsreferences/multiplayer-networking.md- Authority models, delta sync, conflict resolution
Scripts
Performance (references/performance-at-scale.md)
scripts/spatial-hash-grid.js- O(1) queries for uniform distributionscripts/octree.js- Adaptive queries for clustered basesscripts/chunk-manager.js- World streaming for large mapsscripts/performance-profiler.js- Benchmarking utilities
Structural Physics (references/structural-physics-advanced.md)
scripts/heuristic-validator.js- Fast validation (Fortnite/Rust/Valheim modes)scripts/stability-optimizer.js- Caching and batch updatesscripts/damage-propagation.js- Damage states, cascading collapsescripts/physics-engine-lite.js- Optional realistic physics
Multiplayer (references/multiplayer-networking.md)
scripts/delta-compression.js- Only send changed statescripts/client-prediction.js- Optimistic placement with rollbackscripts/conflict-resolver.js- Handle simultaneous buildsscripts/building-network-manager.js- Complete server/client system
Key Patterns
Spatial Indexing Selection
| Pieces | Distribution | Use |
|---|---|---|
| <1,000 | Any | Array |
| 1-5k | Uniform | SpatialHashGrid |
| 1-5k | Clustered | Octree |
| 5k+ | Any | ChunkManager + Octree |
Physics Mode Selection
- Arcade (Fortnite): Connectivity only, instant collapse, best for combat
- Heuristic (Rust/Valheim): Stability %, predictable, best for survival
- Realistic: Full stress/strain, expensive, best for engineering sims
Multiplayer Pattern
Server-authoritative with client prediction. Use delta compression for sync.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
r3f-materials
Three.js materials in R3F, built-in materials (Standard, Physical, Basic, etc.), ShaderMaterial with custom GLSL, uniforms binding and animation, and material properties. Use when choosing materials, creating custom shaders, or binding dynamic uniforms.
audio-router
Router for audio domain including playback, analysis, and audio-reactive visuals. Use when implementing any audio functionality including music, sound effects, visualizers, or audio-driven animations. Routes to 3 specialized skills.
case-studies-reference
Game building mechanics case studies and decision frameworks. Use when designing building systems, evaluating trade-offs, or learning from existing games. Reference-only skill with detailed analysis of Fortnite, Rust, Valheim, Minecraft, No Man's Sky, and Satisfactory building systems.
brainstorming
Use when starting any feature, project, or design work. Guides collaborative design refinement through incremental questioning before any code is written.
shader-router
Decision framework for GLSL shader projects. Routes to specialized shader skills (fundamentals, noise, SDF, effects) based on task requirements. Use when starting a shader project or needing guidance on which shader techniques to combine.
audio-playback
Audio playback using Tone.js including players, transport, scheduling, and loading audio. Use when implementing background music, sound effects, audio synchronization, or timed audio events. Essential for any audio-enabled web application.
Didn't find tool you were looking for?