| Concurrency & Threading | Asynchronous Multithreading: Connection handling, combat ticks, AI state machines, and database queries run concurrently on Tokio-managed OS threads. Data access hazards are eliminated at compile-time. | Serialized Single-Threaded: Execution runs sequentially on a single virtual machine thread to prevent dynamic reference data races. Any slow execution blocks the entire game loop. |
| Memory & Data Locality | Cache-Friendly ECS: Separation of entities (raw IDs) from data components stored in flat, contiguous memory pools. Systems iterate over arrays sequentially for high CPU cache utilization. | Heap Object Indirection: Every room, item, and player is a distinct heap-allocated object. Retrieving variables via dynamic lookup causes pointer chasing and cache thrashing. |
| Execution Safety | Bounded Sandbox: Rhai scripts run with strict inline limits (max 50,000 instructions, 32 recursion levels, bounded memory allocations). Filesystem and network access are blocked. | Unconstrained VM: LPC scripts run natively in the virtual machine bytecode engine. Infinite loops, deep recursion, or high memory usage can freeze execution or crash the driver. |
| Content Architecture | Declarative Templates: Decouples description from behavior. Base stats, descriptions, and exits are defined in declarative TOML files, while code is confined to event hooks. | Monolithic Code: Static fields and game behaviors are mixed directly inside imperative LPC scripts, complicating automated static validation and parameter balancing. |
| Persistence & I/O | Batched Database Writes: Flushes dirty entity changes to a SQLite database in WAL mode using a background thread pool every 5 seconds, shielding the game loop from I/O latency. | File Serialization: Synchronously writes entity variable state to flat files on disk (via save_object) in the main loop thread, risking disk lag pauses. |
| Builder Accessibility | Visual Tools & TOML: Enables non-technical authors to create rooms, items, and NPCs using static TOML files, terminal visual builders (Spade TUI), or AI natural language agents (MCP). | Mandated Coding: Requires all content creators to write C-like LPC scripts to define even basic rooms and items, posing a more technical barrier to entry. |