This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
FluffOS is an LPMUD driver based on the last release of MudOS (v22.2b14) with 10+ years of bug fixes and performance enhancements. It supports all LPC-based MUDs with minimal code changes and includes modern features like UTF-8 support, TLS, WebSocket protocol, async IO, and database integration.
Driver Layer (src/)
main.cc- Entry point for the driver executablebackend.cc- Main game loop and event handlingcomm.cc- Network communication layeruser.cc- User/session managementsymbol.cc- Symbol table managementofile.cc- Object file handling
VM Layer (src/vm/)
vm.cc- Virtual machine initialization and managementinterpret.cc- LPC bytecode interpretersimulate.cc- Simulation engine for object lifecyclemaster.cc- Master object managementsimul_efun.cc- Simulated external functions
Compiler Layer (src/compiler/)
compiler.cc- LPC-to-bytecode compilergrammar.y- Grammar definition (Bison)lex.cc- Lexical analyzergenerate.cc- Code generation
Packages (src/packages/)
- Modular functionality organized by feature (async, db, crypto, etc.)
- Each package has
.specfiles defining available functions - Core packages: core, crypto, db, math, parser, sockets, etc.
Networking (src/net/)
telnet.cc- Telnet protocol implementationwebsocket.cc- WebSocket support for web clientstls.cc- SSL/TLS encryption supportmsp.cc- MUD Sound Protocol support
CMake Configuration (CMakeLists.txt, src/CMakeLists.txt)
- CMake 3.22+ required
- C++17 and C11 standards
- Jemalloc for memory management (recommended)
- ICU for UTF-8 support
- OpenSSL for crypto features
Build Options (key flags)
MARCH_NATIVE=ON(default) - Optimize for current CPUSTATIC=ON/OFF- Static vs dynamic linkingUSE_JEMALLOC=ON- Use jemalloc memory allocatorPACKAGE_*- Enable/disable specific packagesENABLE_SANITIZER=ON- Enable address sanitizer for debugging
# Standard development build
mkdir build && cd build
cmake ..
make -j$(nproc) install
# Debug build with sanitizer
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=ON# Production-ready static build
cmake .. -DCMAKE_BUILD_TYPE=Release -DSTATIC=ON -DMARCH_NATIVE=OFF
make install# Build without database support
cmake .. -DPACKAGE_DB=OFF
# Build with specific packages disabled
cmake .. -DPACKAGE_CRYPTO=OFF -DPACKAGE_COMPRESS=OFF# Run all tests (requires GTest)
cd build
make test
# Run specific test executable
./src/lpc_tests
./src/ofile_tests# Run LPC test suite
cd testsuite
../build/bin/driver config.test# Run driver with test configuration
./build/bin/driver testsuite/etc/config.testSeveral source files are auto-generated during build:
grammar.autogen.cc/.h- Fromgrammar.y(Bison)efuns.autogen.cc/.h- From package specificationsapplies_table.autogen.cc/.h- From applies definitionsoptions.autogen.h- From configuration options
- Add function to appropriate package
.specfile - Implement function in corresponding
.ccfile - Run build to regenerate autogenerated files
- Add tests in
testsuite/directory
# Build with debug symbols and sanitizer
cmake .. -DCMAKE_BUILD_TYPE=Debug -DENABLE_SANITIZER=ON
# Run with GDB
gdb --args ./build/bin/driver config.test
# Memory debugging with Valgrind
valgrind --leak-check=full ./build/bin/driver config.test# Install dependencies
sudo apt install build-essential bison libmysqlclient-dev libpcre3-dev \
libpq-dev libsqlite3-dev libssl-dev libz-dev libjemalloc-dev libicu-dev# Install dependencies
brew install cmake pkg-config mysql pcre libgcrypt libevent openssl jemalloc icu4c
# Build with environment variables
OPENSSL_ROOT_DIR="/usr/local/opt/openssl" ICU_ROOT="/usr/local/opt/icu4c" cmake ..# Install MSYS2 packages
pacman -S git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-zlib mingw-w64-x86_64-libevent \
mingw-w64-x86_64-pcre mingw-w64-x86_64-icu mingw-w64-x86_64-openssl
# Build in MINGW64 terminal
cmake -G "MSYS Makefiles" ..src/- Main driver source codesrc/packages/- Modular package implementationssrc/vm/- Virtual machine and interpretersrc/compiler/- LPC compilersrc/net/- Network protocol implementationstestsuite/- LPC test programs and configurationsdocs/- Documentation (Markdown and Jekyll)build/- Build output directory (auto-generated)
Config.example- Example driver configurationsrc/local_options- Local build options (copy fromlocal_options.README)testsuite/etc/config.test- Test configuration- Package-specific
.specfiles define available functions
- Create directory in
src/packages/[package-name]/ - Add
CMakeLists.txt,.specfile, and source files - Update
src/packages/CMakeLists.txt - Add tests in
testsuite/
- Edit
src/compiler/grammar.yfor syntax changes - Regenerate grammar with Bison if available
- Update corresponding compiler components
- Build with
-DENABLE_SANITIZER=ON - Use
mud_status()efun in LPC for runtime memory info - Check
testsuite/log/debug.logfor detailed logs