Skip to content
/ l2r Public

A MMO server emulator written in Rust with Bevy, designed for modern infrastructure with safety, speed, and reliability at its core.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

l2r-dev/l2r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

108 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

L2R L2R - MMORPG Server Emulator

Rust Lua Docker Telegram

An experimental MMO server emulator written in Rust, designed for modern infrastructure with safety, speed, and reliability at its core.

โš ๏ธ Note: This project is in early development and not intended for production use.

๐Ÿš€ Features

  • High Performance: Built with Rust for maximum performance and minimal memory footprint
  • Memory Safety: Zero-cost abstractions and memory safety without garbage collection
  • Docker Integration: Seamless containerized setup using Docker Compose for streamlined development and modern deployment workflows.
  • Chronicle Support: Initially targeting High Five chronicle, but has 'foundation' (some mechanics implemented behind cargo features) to develop different game chronicles in single codebase.

๐ŸŽฏ Why Rust?

One night before bed, I decided to learn Rust, and this project became my pet project. ๐Ÿ˜„

  • Performance: Near C/C++ performance with zero-cost abstractions
  • Borrow Checker: โค๏ธ Quite good memory control and special-way of understanding memory layouts.
  • Concurrency: Handy support for async programming and multithreading
  • Modern Tooling: Cargo package manager, built-in testing, and documentation
  • Cross-platform: Easy deployment on Linux, Windows, and macOS

โš™๏ธ Why Bevy?

Building an MMO server requires complex entity management, and Bevy's architecture fits perfectly for our MMO emulator needs:

  • ๐Ÿ—๏ธ Entity Component System (ECS): Bevy's data-driven ECS architecture naturally models game entities (players, NPCs, items) with maximum performance and flexibility. Every character, monster, and item is an entity with modular components.

  • ๐Ÿš€ Performance at Scale: Built for handling thousands of entities simultaneously - perfect for MMO environments with thousands of concurrent players, NPCs, and world objects.

  • ๐Ÿงฉ Plugin System: Each game system (combat, movement, inventory, chat) is a separate plugin, allowing for clean separation of concerns and easy feature development. While hot-reloading is not currently implemented, it is possible with known limitationsโ€”such as potential state mismatches and issues with function declarations, which must always remain static in dynamic libs.

  • ๐Ÿ“Š Query System: Powerful entity querying with compile-time safety enables complex game logic like "find all players within these components, filter by only changed last frame" or "update all items in a specific zone entity filtered by MyComponent" with optimal performance.

  • โšก Parallel Processing: Bevy's system scheduler automatically parallelizes non-conflicting operations across CPU cores, maximizing throughput for server-side calculations like movement validation, combat resolution, and other systems processing.

  • ๐Ÿ”„ Handy Async: Support for async operations through bevy_defer, enabling database operations, some HTTP or I/O without blocking the main game loop.

  • ๐Ÿ”— Networking Support: Integration with bevy_slinet provides client-server stuff for implementg TCP/UDP client-servers.

  • ๐Ÿงช Complete Unit Testing: Bevy's ECS architecture enables comprehensive unit tests that simulate exactly all game mechanics that happen during real gameplay - complete with entity interactions, combat systems, movement validation, and state changes - but without networking overhead and with database mocking. Tests can run the full game loop using app.update() while using mocked database connections, allowing for fast, reliable testing of complex MMO scenarios like player vs monster combat, skill usage, and world interactions.

  • ๐ŸŽฎ Developer GUI & 3D Management: Bevy makes it quite easy to use crates implementing GUIs, and this project uses bevy-inspector-egui to provide a feature-toggled developer interface. This GUI lets you visualize the world through reflected components and edit entities in real time for debugging and investigation, supporting 3D transforms and custom entity hierarchies for MMO world management. By default, the server runs as a CLI application for minimal resource usage on headless servers (such as Linux-servers), with the GUI available only when explicitly enabled via cargo features.


๐Ÿ›  Development Setup

Prerequisites

Quick Start

  1. Clone the repository

    git clone https://github.com/aggyomfg/l2r.git
    cd l2r
  2. Start the development environment

    docker compose up -d
  3. Install runcc for easier start

    cargo install runcc
  4. Run both servers (login and game)

    cargo runcc -c .

Development Environment

The development setup includes:

Configuration

Modify config as needed (also can be configured via ENVs with L2R_ prefix):

login_server/data/config.toml
game_server/data/config.toml

๐Ÿ“š Feature Documentation

Component Status Description
๐Ÿ—๏ธ Infrastructure โ˜… โšก ๐Ÿ”จ Database, configuration, monitoring, security & network protocols
๐Ÿ” Login Server โšก ๐Ÿ”จ Authentication, session management & server gateway
๐ŸŽฎ Game Server โ˜… โšก ๐Ÿ”จ World simulation, combat, items & MMO mechanics

Legend: โ˜… = Almost working | โšก = In Development | ๐Ÿ”จ = Dreams & Future Plans

๐ŸŒŸ Quick Highlights

  • ๐Ÿš€ ECS Architecture: Built on Bevy's high-performance Entity Component System
  • ๐Ÿ” Monitoring: OpenMetrics integration for any game/infra metrics. Reconnectable DB pool.
  • ๐Ÿ—บ๏ธ L2J Geodata: Full pathfinding with A* algorithm implementation
  • โš”๏ธ Combat System: Physical damage, critical hits, hit-miss and Lua skill framework
  • ๐Ÿ“Š Stats Calculation: System with formulas for P.Atk, M.Atk, Speed, and other character stats
  • ๐ŸŽ’ Item Management: Inventory system with equipment stats
  • ๐Ÿค– NPC AI: Spawn system with basic monster behaviors
  • ๐Ÿ‘ฅ Player Visibility: Encounter system with distance-based updates

๐Ÿค Contributing

Want to contribute? Here is how:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests if possible.
  4. Run tests: cargo test
  5. Commit your changes: git commit -m 'Add amazing feature'
  6. Push to the branch: git push
  7. Open a Pull Request

Development Guidelines

  • Follow Rust conventions and idioms
  • Use bevy_lint to verify some bevy related-stuff.
  • Add tests for new functionality
  • Update documentation for public APIs, remeber rustdoc is great
  • TODO: add ci/cd to check fmt and lint

๐Ÿ“ˆ Performance

TODO Some benchmarks-tests.

Contacts

Join Telegram channel and chat for updates, discussions, and community support: t.me/l2r_dev

๐Ÿ™ Acknowledgments & Shoutouts

๐Ÿ›๏ธ L2 Server Emulation

  • L2J Team - The original pioneers of open-source server emulation
  • L2jMobius (GitLab) - The most mature and actively maintained Java emulator with extensive chronicles support

๐Ÿฆ€ Essential Rust & Bevy Ecosystem Crates

  • bevy_slinet (GitHub) - Simple networking plugin for Bevy with TCP/UDP support, essential for client-server communication
  • bevy-inspector-egui (GitHub) - Real-time component inspector and debug GUI for Bevy ECS, invaluable for MMO development
  • bevy_mod_scripting (GitHub) - Scripting engine for Bevy, enabling dynamic game logic and content creation without recompilation and makes development more flexible
  • egui_dock (GitHub) - Docking support for egui, enabling professional IDE-like interfaces with draggable tabs and windows
  • avian3d (GitHub) - ECS-driven 3D physics engine for Bevy
  • bevy_defer (GitHub) - Async runtime for Bevy with World access, enabling async functions like database operations without blocking the game loop
  • bevy_webgate - Web integration for Bevy applications, useful for admin panels and metrics endpoints
  • pathfinding (GitHub) - A* pathfinding implementation

๐Ÿ› ๏ธ Core Infrastructure & Development Tools

  • Sea-ORM (GitHub) - Async & dynamic ORM for Rust, providing type-safe database operations
  • Redis (GitHub) - High-level Redis client for session management and caching
  • Tera (GitHub) - Template engine for dynamic HTML generation

๐ŸŒŸ Special Recognition

  • The Rust Community for creating an ecosystem that makes systems programming both safe and performant
  • Bevy Contributors for building a game engine that perfectly matches MMO server architecture needs
  • NCSoft for creating the legendary world of Lineage 2 that continues to inspire developers worldwide

โš ๏ธ Note: This is an educational project. Please ensure you comply with all applicable laws and terms of service when using this software.


Made with โค๏ธ and ๐Ÿฆ€

About

A MMO server emulator written in Rust with Bevy, designed for modern infrastructure with safety, speed, and reliability at its core.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Contributors 2

  •  
  •