$ show sniper00/moon
Moon is a high-performance actor-model game server framework written in modern C++ (C++20) with Lua 5.4/5.5 as its embedded scripting engine. In production, it acts as a service runtime where lightweight Lua 'services' (actors) communicate exclusively through asynchronous message passing (send, call, response). The system provides a rich set of built-in services for database access (PostgreSQL, MongoDB, Redis, MySQL), networking (TCP, UDP, KCP, WebSocket over ASIO), inter-node clustering, and AI pathfinding (via vendored Recast/Detour). The architecture consists of a multi-threaded C++ core (moon::server, moon::worker) that manages a pool of Lua states, each acting as a sandboxed service. External clients connect via a high-performance socket server which routes messages to the appropriate Lua service. Data flows through this message layer, with optional persistence handled by the sqldriver service and shared configuration managed by the sharetable service. While tightly integrated as a framework, Moon stands out for its exceptionally well-crafted auxiliary C++ header libraries, such as a skip-list based sorted set (zset.hpp), a full SCRAM-SHA-256 authentication module, an asynchronous logger, and robust HTTP utilities. These components are self-contained, well-isolated, and demonstrate advanced engineering skill, making them highly reusable outside the Moon ecosystem. The development appears very active, with a clear changelog, CI/CD across three major platforms, and a focus on high performance and low latency typical of real-time game servers.
The LLM identified 5 files worth highlighting for reuse:
Implements a templated, allocator-aware skip-list based sorted set (zset) with O(log n) rank, score, range, and index operations. This is a core data structure for game leaderboards and priority queues. It is a standalone C++ header that only depends on basic utilities, making it easily extractable for any C++ project requiring a high-performance ordered container.
A complete, standalone C++ implementation of the SCRAM-SHA-256 authentication protocol (client final message, nonce, PBKDF2, HMAC, server signature verification). Demonstrates advanced cryptography engineering. It is fully self-contained and can be dropped into any project needing secure password-based authentication against a compliant server.
Provides two high-performance concurrent queue implementations: a lock-based double-buffered queue (concurrent_queue) ideal for single-producer/single-consumer or low-contention scenarios, and a lock-free multi-producer/single-consumer queue (mpsc_queue). These are fundamental building blocks for any multi-threaded system and are implemented with clean, modern C++.
An asynchronous logging utility with a dedicated writer thread, double-buffered queue, configurable levels, colored console output, and file rolling. The design decouples log call sites from I/O, preventing blocking in high-throughput critical paths. It is a polished, production-ready logging component that can be extracted for use in any C++ application.
A standalone, header-only HTTP utility library for parsing request lines, HTTP headers, query strings, and performing percent encoding/decoding. The implementation is robust and relies on modern C++ standard library features (string_view, from_chars). It is a clean, well-tested pattern for traffic parsing that is easily reusable.