Skip to content
MasterLaplace edited this page Jul 14, 2026 · 7 revisions

πŸš€ LplPlugin β€” FullDive Engine

Goal: Build a real Sword Art Online (SAO) β€” a FullDive VR experience where the boundary between physical and virtual worlds disappears, driven by real neural signals.

LplPlugin is a high-performance, data-oriented closed-loop BCI platform written in C++23 (with C for the kernel module). It is organized as 20 independent modules built by xmake, combining a Linux kernel module for zero-copy UDP ingestion, a full ECS simulation engine, a software + Vulkan renderer, and a standalone BCI module (OpenBCI Cyton, 8ch/250Hz) that computes scientifically-grounded neural metrics in real time β€” feeding back into the simulation loop.


✨ Key Highlights

Metric Value
Language C++23 (-fno-rtti, -fno-exceptions)
Build System xmake 2.9+
Modules 20 static libraries + 3 executables
Frame time 62.55 Β΅s average (Phase 1 milestone)
Packet loss 0.00% (1000/1000)
Throughput ~495 pkt/s
Physics (50 entities) 0.055 ms/frame
BCI channels 8 ch / 250 Hz (OpenBCI Cyton)
Renderer Software rasterizer + Vulkan backend
Unit tests 24 / 24 βœ…

πŸ—οΈ Architecture at a Glance

[OpenBCI Cyton β€” 8 ch / 250 Hz] ──────────────────────────────┐
    ↓ USB serial / raw parse                              [bci/ module]
    FFT + SignalMetrics R(t) + RiemannianGeometry Ξ΄_R + D_M
    NeuralMetrics::from_state() β†’ ECS ComponentID::NEURAL
    ↓ β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

UDP Packet (port 7777)                                [net/ + kernel/]
    ↓
Netfilter Hook (kernel module β€” NF_INET_PRE_ROUTING)
    ↓
RxRingBuffer (mmap'd LplSharedMemory, atomic head/tail)
    ↓
Network::network_consume_packets() β†’ dispatch to WorldPartition chunks
    ↓
SystemScheduler ECS (auto DAG: RingConsume β†’ ClientIO β†’ Physics β†’ Neural)
    ↓
WorldPartition::step()
    β”œβ”€ GPU path: CUDA kernel (PhysicsKernel.cu)
    └─ CPU path: physicsTick (current)
    ↓
Inter-chunk migration (backward iteration + swap-and-pop)
    ↓
swapBuffers() β†’ atomic write↔read toggle
    ↓
Network::broadcast_state() β†’ TxRingBuffer β†’ ioctl kick β†’ kernel TX thread β†’ UDP

πŸ“ Module Structure

LplPlugin/
β”œβ”€β”€ core/           β€” Platform abstraction, types, assertions, logging
β”œβ”€β”€ math/           β€” Vec3, Quat, Fixed32, CORDIC, BoundaryBox
β”œβ”€β”€ memory/         β€” PinnedAllocator (CUDA zero-copy), pool allocators
β”œβ”€β”€ container/      β€” FlatAtomicsHashMap, Morton encoding, sparse sets
β”œβ”€β”€ concurrency/    β€” ThreadPool, SpinLock, atomic utilities
β”œβ”€β”€ ecs/            β€” Entity registry, Partition (SoA double-buffered chunks)
β”œβ”€β”€ physics/        β€” WorldPartition, collision (AABB, octree broadphase)
β”œβ”€β”€ net/            β€” UDP transport (kernel driver / socket fallback), protocol
β”œβ”€β”€ gpu/            β€” CUDA physics kernels, GPU lifecycle
β”œβ”€β”€ input/          β€” InputManager (keys, axes, neural state per entity)
β”œβ”€β”€ platform/       β€” Host backends (clock/display/gpu-memory/input)
β”œβ”€β”€ render/         β€” Software + Vulkan renderer, ImGui integration
β”œβ”€β”€ image/          β€” 2D software imaging (Surface, Painter, Codec)
β”œβ”€β”€ scene/          β€” Scene graph (Scene, Transform2D)
β”œβ”€β”€ audio/          β€” Spatial audio (stub)
β”œβ”€β”€ haptic/         β€” Haptic/vestibular feedback (stub)
β”œβ”€β”€ bci/            β€” OpenBCI driver, FFT, DSP, SignalMetrics, Riemannian, calibration
β”œβ”€β”€ serial/         β€” State serialization & deterministic replay
β”œβ”€β”€ bench/          β€” Benchmark harness
β”œβ”€β”€ engine/         β€” Top-level facade aggregating all modules, game loop
β”œβ”€β”€ kernel/         β€” Linux kernel module (lpl_kmod.c)
β”œβ”€β”€ apps/           β€” Executables (lpl-server, lpl-client, lpl-benchmark)
└── samples/        β€” Example code

Each module is a static library (lpl-<name>) with include/lpl/<name>/ headers and src/ implementations.


πŸ“– Wiki Contents

Project Overview

  • Vision & Objectives β€” Ultimate goal, scientific ambition, motivation
  • Philosophy & Principles β€” Core design principles (DOD, Zero-Copy, Server-Authoritative…)
  • Architecture β€” Zero-copy pipeline, memory layout, double buffering, client-server protocol

Technical Reference

Status & Results

Planning

  • Roadmap β€” Phases 1–5 with success criteria
  • Future Ideas β€” RTOS, advanced physics, BCI, NeRF, server meshing…

Research

πŸ“– LplPlugin Wiki

🏠 Home


πŸ“ Project Overview

πŸ”§ Technical Reference

πŸ“Š Status & Results

πŸ—ΊοΈ Planning

πŸŽ“ Research

Clone this wiki locally