mcpField
B
building-mechanics

building-mechanics

github.com/bbeierle12Development974 installsUpdated 1d ago
Repository

About building-mechanics

3D Building Mechanics is a skill and set of scripts for building systems in Three.js games. It covers spatial queries, structural stability, performance at scale, and multiplayer synchronization for game developers.

Key features

  1. 01Spatial hash grids and octrees
  2. 02Chunk loading and performance profiling
  3. 03Structural stability and damage propagation
  4. 04Optional realistic physics engine
  5. 05Delta synchronization and conflict resolution

Use cases

  1. 01Query nearby building pieces efficiently
  2. 02Validate building stability in a game
  3. 03Stream large building worlds
  4. 04Synchronize multiplayer construction

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/bbeierle12/skill-mcp-claude --skill building-mechanics

After installing, type/building-mechanicsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

_meta.json
references/
multiplayer-networking.md
performance-at-scale.md
structural-physics-advanced.md
scripts/
building-network-manager.js
chunk-manager.js
client-prediction.js
conflict-resolver.js
damage-propagation.js
delta-compression.js
heuristic-validator.js
octree.js
performance-profiler.js
physics-engine-lite.js
spatial-hash-grid.js
stability-optimizer.js

Details

From the project README

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, LOD
  • references/structural-physics-advanced.md - Arcade vs heuristic vs realistic physics
  • references/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 distribution
  • scripts/octree.js - Adaptive queries for clustered bases
  • scripts/chunk-manager.js - World streaming for large maps
  • scripts/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 updates
  • scripts/damage-propagation.js - Damage states, cascading collapse
  • scripts/physics-engine-lite.js - Optional realistic physics
Multiplayer (references/multiplayer-networking.md)
  • scripts/delta-compression.js - Only send changed state
  • scripts/client-prediction.js - Optimistic placement with rollback
  • scripts/conflict-resolver.js - Handle simultaneous builds
  • scripts/building-network-manager.js - Complete server/client system

Key Patterns

Spatial Indexing Selection
PiecesDistributionUse
<1,000AnyArray
1-5kUniformSpatialHashGrid
1-5kClusteredOctree
5k+AnyChunkManager + 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.

Comments

Markdown supported