Havyn

Havyn

An Open Source MMO Server Framework

Modern C++ game server with Lua scripting.
Multiplayer. Modular. Ready to customize.

C++20Lua 5.4Zig BuildMessagePack

Everything You Need for Multiplayer

Modern C++20

Clean, readable architecture with modern C++ features. No legacy cruft.

Lua Scripting

Game content in Lua scripts — mobs, abilities, quests. Easy to customize.

Dual Protocol

TCP for reliable packets, UDP for real-time sync. Best of both worlds.

Party System

Built-in crew/party system with invites, member sync, and leader promotion.

Combat System

Targeting, auto-attack, damage calculations, death handling.

AI Companions

Summonable AI followers with Lua-scripted behavior and personality.

Lua-Powered Game Content

Define mobs, abilities, and companions in simple Lua scripts. The C++ server handles networking and performance.

Mob Definition

-- scripts/mobs/skeleton_pirate.lua
return {
    name = "Skeleton Pirate",
    stats = { hp = 50, str = 8, def = 3 },

    onSpawn = function(mob)
        mob:say("Yarr!")
    end,

    onDeath = function(mob, killer)
        -- Drop loot, grant XP
    end
}

Companion AI

-- scripts/companions/first_mate.lua
return {
    onSpawn = function(companion, owner)
        local greetings = {
            "Ready to sail, Cap'n!",
            "At yer service!",
            "Where to, Captain?"
        }
        companion:say(greetings[math.random(#greetings)])
    end,

    onCombatStart = function(companion, target)
        if math.random() < 0.3 then
            companion:say("I've got yer back!")
        end
    end
}

Modular Architecture

Load only the modules you need. Extend with your own.

havyn/
├── src/
│   ├── core/           # Server framework
│   │   ├── server.*    # Main server, module loading
│   │   ├── session.*   # Client session management
│   │   ├── packet.*    # Protocol, MessagePack
│   │   └── zone.*      # World zones, entity containers
│   │
│   ├── lua/            # Sol2 Lua bindings
│   │   ├── lua_manager.*   # VM, script loading
│   │   └── lua_entity.*    # Entity API for scripts
│   │
│   └── modules/        # Game systems
│       ├── auth/       # Login, characters
│       ├── movement/   # Position sync
│       ├── combat/     # Targeting, damage
│       ├── party/      # Group/crew system
│       └── companion/  # AI companions

└── scripts/            # Lua game content
    ├── mobs/           # Mob AI and stats
    ├── abilities/      # Skill effects
    └── companions/     # Companion behaviors

Quick Start

# Clone the repository
git clone https://github.com/LoxleyX/havyn
cd havyn

# Build the server
zig build

# Start the server
./zig-out/bin/havyn-server

Ready to Build?

Havyn is MIT licensed. Fork it, customize it, ship your game.

Get Started on GitHub