Rust · MMO · Game Engine

Feudal Engine

A high-performance, massively multiplayer game engine built in Rust. Powering persistent medieval sandbox worlds — without server wipes.

47Modules
14Plugins
60 FPSTarget
0.1 mTerrain Precision
Gateway
WebSocket · Login · Routing
↓ gRPC
Orchestrator
Quadtree Sharding · HA
World Node
Shard 0
World Node
Shard 1
World Node
Shard N
↓ gRPC offload
Physics
SIMD · 60 Hz
AI
BT + ML
Terrain
Erosion
PostgreSQL
ScyllaDB
Redis

Core Features

Everything a modern MMO engine needs — in one integrated workspace.

🗺️

Spatial Sharding

The world (36 km × 36 km) is partitioned by a quadtree into independent shards, each owning its own ECS world, physics simulation and terrain. Shards split at 600 entities or 75 % CPU load and merge when idle — the orchestrator manages the full lifecycle automatically with 30 s cooldowns and up to 4 concurrent operations.

👻

Ghost Zones

100 m overlap corridors exist at every shard boundary. Entities approaching the edge are mirrored into the neighbouring shard and synced every 100 ms (up to 500 ghosts per neighbour), guaranteeing seamless handoff with zero visible discontinuity for players.

⛏️

100 % Destructible Terrain

Full voxel terrain at 0.1 m vertical resolution across a height range of −1 000 m to +1 000 m, persisted in ScyllaDB with RLE compression (1 333:1 for unmodified chunks). Biome layers, hydraulic and thermal erosion, cave generation, ore veins and procedural terrain decay are all built in.

🤖

Adaptive NPC AI

NPCs run on Behaviour Trees with an XP-driven rank system (Normal → Elite → Boss) and difficulty grades (0–3 ★). Grade 3 bosses deal 2× damage with 2.5× health. A* pathfinding on a navigation mesh auto-generated from voxel data, up to 5 000 NPCs per dedicated AI worker at 10 Hz.

🌍

Living World

No server wipes — ever. Unclaimed terrain gradually reverts to its procedural state (72 h delay, 5 % per tick). Depleted ore veins respawn world-wide. Seasons progress on a real calendar (30-day months, 12 months, 8 real hours per in-game day). Dynamic weather with rain, snow, fog and thunderstorms.

📡

Dual-Channel Networking

UDP at 20–30 Hz for low-latency movement and combat (zero-copy binary, ≤ 1 400 B packets, < 100 ms RTT). QUIC for reliable inventory, chat and quest traffic. WebSocket for client connections. All internal services communicate via gRPC. SO_REUSEADDR and DSCP EF markings keep jitter low.

🎙️

Integrated Voice & Chat

Cross-shard text and voice chat with eight channel types (Local 50 m, World, Global, Guild, Party, Trade, Whisper, System). Opus codec at 32 kbps, 3D spatial audio with Doppler effect, HRTF profiles, audio occlusion and reverb. Redis Pub/Sub distributes messages across all shards in real time.

🏰

Guild Land Claims

Guilds claim land via monument circles (base radius 100 m, up to 5 upgrade levels reaching 140 m) or rectangular fief grids. Progressive upkeep costs apply (1.05× scaling exponent). Siege mechanics with a 1 h preparation phase, 2 h active window and 24 h cooldown. New claims enjoy 72 h protection.

🧩

Plugin System

14 optional plugins (Crafting, Farming, PvP Arenas, Quests and more) extend the engine at runtime via a verified dynamic loader with Ed25519 signature checks and ABI hash validation. A capability system controls exactly what each plugin can access — core modules are never modified.

Engine Details

A closer look at the systems that power Feudal Engine.

ECS & Game Loop
  • Archetypal, cache-friendly entity-component storage supporting 10 000+ entities per shard
  • SIMD-accelerated transform propagation; fine-grained parallel system sets (CoreParallel, Perception, PhysicsAndAI)
  • Each world shard runs its own isolated ECS world — zero shared mutable state between shards
  • Schedules: Input → PreUpdate (spatial index) → Update → PostUpdate (combat, replication) → Render
  • TOML-driven prefab system with inheritance, cycle detection and compile-time depth limits
Physics
  • SIMD-accelerated rigid-body simulation and collision detection at 60 Hz, fully server-authoritative
  • Three execution modes: in-process (< 50 µs per character), gRPC worker offload (> 2 000 bodies), or hybrid
  • Continuous collision detection (CCD) enabled by default; position reconciliation threshold 0.1 m
  • Distance-based physics LOD: full (0–50 m), reduced (50–150 m), minimal (150–400 m), off beyond
  • Raycasting, convex-hull queries and client-side prediction with server reconciliation
Terrain System
  • 0.1 m vertical voxel resolution — 10 layers per metre, 128 × 128 m tile chunks, fully persistent in ScyllaDB
  • RLE compression: unmodified tile ~15 B (1 333:1 ratio); modified tile ~150 B (133:1 ratio); zstd level 3
  • Multi-octave noise for continent-scale generation; hydraulic and thermal erosion via dedicated worker
  • Biome layers control vegetation, ore distribution, river / lake / ocean placement and weather
  • Navigation mesh auto-generated from voxel data with 50 ms incremental rebuild; multi-level (surface + underground)
  • Heightmap import/export pipeline compatible with Gaea, World Machine and raw binary formats
Rendering
  • Portable GPU abstraction across Vulkan, Metal, DX12 and WebGPU; GPU-driven culling and bindless rendering
  • Cascaded shadow maps (CSM), DDGI, variance shadow maps (VSM) and SSGI; TAA + upscaling (FSR / DLSS / XeSS)
  • PBR material pipeline with HDR skybox, volumetric fog, dynamic weather visuals and lightning
  • GPU particle systems with atlas texturing, collision, event-driven curves and per-effect budgets
  • Skeletal animation: blend trees, 1D/2D blending, IK (FABRIK + two-bone), procedural locomotion with motion matching
  • Dynamic resolution scaling (DRS) with adaptive budget controller (target 60 FPS, 14.67 ms frame budget, 2 ms headroom)
Infrastructure
  • All configuration via per-service TOML files with full environment-variable override (FEUDAL_<SERVICE>_<KEY>)
  • Structured tracing with OpenTelemetry export, JSON output, per-subsystem memory accounting and auto-redacted secrets
  • Prometheus metrics (ECS, Network, Physics, Game groups) exported by every service; Grafana dashboards included
  • Runtime diagnostics: scoped RAII timers, hierarchical flame spans, rolling P95/σ stats, spike detection > 2σ
  • Chrome trace export, jemalloc memory stats, GPU profiling hooks and flamegraph scripts
  • Admin panel (egui + HTTP API); Docker Compose dev stack; Docker Swarm production stack with health checks
Game Systems
  • Day/night cycle: 8 real hours per in-game day; sunrise 06:00, sunset 20:00; moon phases synced to 30-day calendar
  • Dynamic weather: rain, snow, fog, storms; temperature lapse rate 6.5 °C / 1 000 m; lightning with 150 ms flash
  • Binary replay recording with O(1) seeking, optional BLAKE3 checksums and zstd compression (30 s rolling buffer)
  • Instanced dungeon, raid and PvP arena servers with gRPC session handoff, Redis-backed lifecycle and 120 s reconnect
  • CASC-style asset management: BLAKE3 content hashing, ChaCha20-Poly1305 encryption, binary delta patching, < 10 ms indexed load
  • Full i18n with BCP-47 language codes (en-US, de-DE, fr-FR, es-ES, zh-CN, ja-JP, ko-KR, ru-RU, pt-BR) and hot-reload

Architecture

Distributed microservice architecture — designed for massive scale.

Process Port Description
feudal-gateway 8080 WS Client-facing WebSocket gateway (10 000 max connections, 10 per IP); login queue, session management, position-based shard routing via orchestrator snapshots
feudal-orchestrator 50100 gRPC Quadtree shard coordinator; authority registry; split / merge lifecycle (split at 600 entities / 75 % CPU); HA failover with Redis leader election and 30 s cooldown
feudal-node 50200+ gRPC World shard — 60 Hz ECS game loop, physics, terrain, networking, ghost-zone UDP sync with neighbours, entity persistence via gRPC pool
feudal-physics-worker 50300 gRPC SIMD physics offload — horizontally scalable; triggered at > 2 000 bodies per shard; streaming gRPC entity state
feudal-ai-worker 50400 gRPC NPC AI — Behaviour Trees, A* pathfinding on nav-mesh, adaptive ML grades (0–3 ★), 10 Hz tick, up to 5 000 NPCs per worker
feudal-terrain-worker 50500 gRPC Terrain generation, hydraulic & thermal erosion, biome assignment, navmesh generation; offloaded via gRPC
feudal-chat-server 9200 gRPC Cross-shard voice (Opus 32 kbps) and text chat; 8 channel types; Redis Pub/Sub distribution; JWT auth; moderation (mute/ban/flood detection)
Offloaded Workers

Physics, AI and terrain generation run in dedicated processes, dynamically assigned by the orchestrator. Each scales horizontally and independently — add more workers without touching shard servers.

🔄 Dynamic Sharding

Shards split automatically when load exceeds thresholds (600 entities or 75 % CPU for 5 consecutive cycles) and merge at 100 entities. The orchestrator manages the complete lifecycle with 30 s cooldowns — zero manual intervention.

💾 Multi-Database

PostgreSQL for player accounts and transactions (50-connection pool, TLS). ScyllaDB for voxel terrain and world state (QUORUM consistency, RF 3). Redis for sessions, leaderboards and real-time pub/sub. All drivers ship with in-memory mocks for fast iteration.

Technology Stack

Best-in-class Rust ecosystem — from the ECS core to the database layer.

LanguageRust 1.94+ (Edition 2024)
ECSBevy ECS 0.18
PhysicsRapier 3D (SIMD)
Renderingwgpu 27
UIegui 0.33
NetworkingQUIC · UDP · WebSocket
Service MeshgRPC (tonic + prost)
Async RuntimeTokio 1.49
Serialisationserde · rkyv · postcard
DatabasesPostgreSQL · ScyllaDB · Redis
Auth / CryptoJWT · AES-256-GCM · ChaCha20
Audio / VoiceOpus (audiopus)
MetricsPrometheus + OpenTelemetry
Terrain NoiseMulti-octave noise 0.9
Allocatorjemalloc
Asset IntegrityBLAKE3 · zstd

Plugin System

14 optional plugins extend the engine at runtime — without modifying the core.

🗡️pvp_arena

Instanced PvP arenas with teams, scoring, 10-min matches and leaderboards

⚒️crafting

Crafting stations (Anvil, Workbench, Alchemy, Cooking), recipes and skill levelling

🌾farming

Crop growth stages (seedling → mature), water and health mechanics, seasonal yields

📜quest

Quest tracking, objective management and in-game delivery

💾quest-persistent

High-performance persistent quest state via storage API, batch loading and async I/O

🗺️region-manager

Zone management, region hierarchy, instancing and auto-scaling (max 100 players per instance)

🏔️terraforming

Player voxel terrain editing with undo/redo (100 steps), batch processing and async persistence

🌐world-streaming

Hierarchical LOD streaming: LOD0 128 m, LOD1 512 m, LOD2 2 048 m; priority queue and memory budgets

📊metrics-dashboard

Live Prometheus/Grafana performance dashboard with per-plugin metric collection

🔗network-replication

Delta-compressed replication rules, interest filtering and per-entity bandwidth budgeting (128 KB/s)

🛡️anticheat

Server-side validation with anomaly detection and rate limiting

📦asset-streaming

Progressive asset loading (low-res → high-res) with priority queue and LRU eviction

🗄️database-backend

Swappable PostgreSQL / Cassandra backend with connection pooling, batch writes and caching

👋hello

Minimal reference plugin demonstrating init, update and shutdown lifecycle hooks