__
/'\_/`\ /\ \__
/\ \ ___ ___ ___ __ __ \ \ ,_\ __
\ \ \__\ \ / __`\ / __`\ /' _ `\ /'_ `\ /'__`\ \ \ \/ /'__`\
\ \ \_/\ \/\ \L\ \/\ \L\ \/\ \/\ \/\ \L\ \/\ \L\.\_\ \ \_/\ __/
\ \_\\ \_\ \____/\ \____/\ \_\ \_\ \____ \ \__/.\_\\ \__\ \____\
\/_/ \/_/\/___/ \/___/ \/_/\/_/\/___L\ \/__/\/_/ \/__/\/____/
/\____/
\_/__/
++ New generation of Ultima Online server ++
!! Please support me on Patreon: https://www.patreon.com/MoongateServer !!
Source code: https://github.com/moongate-community/moongate
Moongate is a cutting-edge, ultra-high-performance Ultima Online server emulator built with .NET 9 and AOT (Ahead-of-Time) compilation. Designed specifically for the passionate UO community that still cherishes this legendary MMORPG, Moongate delivers exceptional performance and unprecedented customization capabilities through modern architecture and a powerful JavaScript scripting engine.
Our mission is simple: create the most performant and customizable UO server ever built, giving dedicated players and server administrators the tools they deserve.
While Ultima Online may have a smaller player base today, those who still play deserve nothing less than perfection. Moongate is built on these core principles:
- Performance Above All - Leveraging .NET 9 AOT for maximum speed and efficiency
- JavaScript-Powered Customization - Making server modification accessible to everyone
- Modern Architecture - Clean, maintainable code built for the future
- Community-First - Empowering server owners to create unique experiences
- Legacy Respect - Honoring classic UO while enhancing it with modern technology
- AOT Compilation - Faster startup, lower memory usage, predictable performance
- Zero-Allocation Paths - Critical code optimized to avoid garbage collection pressure
- Asynchronous I/O - High-throughput network operations with minimal overhead
- Priority-Based Event Loop - Intelligent task scheduling inspired by classic emulators
- Memory Pool Management - Efficient buffer reuse and memory management
- Modular Service Design - Clean separation of concerns with dependency injection
- Event-Driven System - Comprehensive event bus for loosely coupled components
- Pluggable Middleware - Extensible packet processing pipeline
- Configuration Management - Flexible JSON-based configuration system
- Comprehensive Logging - Structured logging with Serilog including packet tracing
- Jint Engine - Full-featured JavaScript runtime with .NET interop
- Planned Hot-Reload Support - Feature not yet implemented
- TypeScript Definitions - Auto-generated type definitions for development
- Module System - Organized script architecture with module support
- Rich API - Extensive scripting interface for all game systems
- .NET 9 SDK
- Ultima Online Classic Client version 7.x only (officially supported)
- 4GB RAM minimum (8GB recommended)
- Visual Studio 2022 or JetBrains Rider for development
-
Clone the repository
git clone https://github.com/moongate-community/moongate.git cd moongate
-
Build the solution
dotnet restore dotnet build
-
Configure the server
# Edit the configuration to set your UO client path nano moongate/moongate.json
-
Run in development mode
dotnet run --project src/Moongate.Server
For maximum performance in production:
# Build with AOT compilation
./scripts/run_aot.sh
# Or manually:
dotnet publish -r linux-x64 -o dist -p:PublishAot=true -c Release src/Moongate.Server
./dist/Moongate.Server
# Build the Docker image
docker build -t moongate-server .
# Run with volume mapping for configuration and data
docker run -d \
-p 2593:2593 \
-v ./moongate:/app/moongate \
moongate-server
Moongate uses a simple JSON configuration file:
{
"network": {
"port": 2593,
"logPackets": false
},
"webServer": {
"port": 23853,
"enabled": true
},
"name": "Moongate Shard",
"ultimaOnlineDirectory": "~/uo/"
}
Moongate features a sophisticated JavaScript scripting system that makes customization accessible:
// Auto-generated TypeScript definitions provide full intellisense
/// <reference path="index.d.ts" />
// Example: Custom spell implementation (future implementation)
class Fireball {
constructor() {
this.manaCost = 15;
this.requiredSkill = 40;
}
cast(caster, target) {
if (!this.checkMana(caster)) {
logger.warn(`${caster.name} lacks mana for Fireball`);
return false;
}
const damage = this.calculateDamage(caster);
target.takeDamage(damage);
logger.info(`${caster.name} cast Fireball on ${target.name} for ${damage} damage`);
return true;
}
calculateDamage(caster) {
const magery = caster.skills.magery;
return Math.floor(10 + (magery / 10));
}
}
// Register with the spell system
spells.register(new Fireball());
- Logger Module - Advanced logging capabilities
- Account Module - User account management
- More modules are planned as development progresses
- Custom TCP Server - Built from scratch for UO protocol optimization
- Packet Registration System - Comprehensive UO packet handling (200+ packet types)
- Session Management - Robust client state tracking
- Compression Support - Optional packet compression for bandwidth optimization
- Middleware Pipeline - Extensible packet processing chain
Built-in packet logging and network diagnostics:
# Enable packet logging in config
"LogPackets": true
# View real-time packet flow
tail -f logs/network_packets_*.log
Metric | JIT | AOT | Improvement |
---|---|---|---|
Startup Time | 2.3s | 0.8s | 65% faster |
Memory Usage | 145MB | 98MB | 32% less |
Packet Processing | 85k/s | 120k/s | 41% faster |
Steady State Latency | 2.1ms | 1.4ms | 33% lower |
Benchmarks run on Ubuntu 22.04 with Intel i7-12700K
# Restore dependencies
dotnet restore
# Build all projects
dotnet build
# Run tests
dotnet test
Comprehensive test suite with NUnit:
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run specific test category
dotnet test --filter Category=Network
- C# 12 with nullable reference types enabled
- XML Documentation for all public APIs
- EditorConfig for consistent formatting
- Modern async/await patterns throughout
- SOLID principles and clean architecture
- Performance Counters - CPU, memory, network utilization
- Event Loop Metrics - Tick timing and queue depths
- Script Execution Stats - JavaScript performance monitoring
- Network Statistics - Connection counts, packet rates, errors
# Runtime commands via console
> status # Show server status
> reload scripts # (planned) hot-reload all scripts
> gc # Force garbage collection
> metrics # Display performance metrics
> shutdown # Graceful shutdown
Goal: Get a player character visible and moving on the game world
Core Features:
- Character Creation & Login - Complete login flow with character selection
- Character Rendering - Player character appears correctly in the world
- Basic Movement - Walking, running, and direction changes
- Map Display - Load and display Britannia map tiles
- Client Synchronization - Proper character position updates
- Basic Networking - Stable client-server communication
- Session Management - Handle multiple concurrent players
Technical Requirements:
- UO packet handlers for movement (0x02, 0x22)
- Map file loading (.mul files)
- Character data persistence
- Position validation and anti-cheat basics
- Network packet compression
Success Criteria: A player can log in, see their character on the map, and walk around the world with other players visible.
Further milestones will be defined after completing the basic gameplay foundation.
- Documentation - Full Wiki
- Issues & Bugs - GitHub Issues
- Discord Community - Join our server
- Support Development - Patreon
π We're actively looking for developers to join the Moongate project! Whether you're passionate about UO, .NET development, or building high-performance systems, we'd love to have you on board.
We welcome contributors! Whether you're fixing bugs, adding features, or improving documentation:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow the existing code style and conventions
- Add tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting
- Core UO Protocol Implementation - Packet handlers, game mechanics
- JavaScript Engine Integration - Scripting API development
- Performance Optimization - AOT improvements, memory management
- Testing & QA - Comprehensive test coverage
- Documentation - Technical docs, tutorials, examples
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Ultima Online Community - For keeping the dream alive after all these years
- ModernUO, RunUO, UOX3, and ServUO Teams - For creating countless worlds and keeping UO servers alive throughout the decades. Your dedication has preserved this incredible game for new generations of players
- .NET Team - For the amazing AOT capabilities in .NET 9
- Jint Project - For the excellent JavaScript engine
β‘ Built for Speed. Designed for Community. Powered by Innovation.
Moongate Server - Where classic meets cutting-edge