You already know what one more feature costs.
If you have extended a Metin2 server, you have paid it: a C++ patch, a hand-written packet, a switch case, a rebuild. Universal Core turns the Metin2 mainline engine into a foundation where the engine holds the mechanisms and gameplay lives outside it, in Lua on the server and Python on the client.
One message from the server to a window touches ten places.
Take the smallest feature there is: the server tells a client window something. In the mainline engine the data crosses a shared header, an encoder, the launcher's packet code and the Python glue that forwards it. Switch the drawing to see the same message here.
- Shared definitionC++Rebuild: both binariesPacket header and structs
- Game serverC++Rebuild: serverEncode the packet
- Client launcherC++Rebuild: launcherPacket size tableDispatch switchReceive functionIts declarationConstants exported to Python
- Client PythonPythonGame windowInterface forwarderThe feature's own window
Counted in Hiding the transport layer.
A rule is a branch.
Whether a player may use an item, join a party or fight here is a branch in C++, by map, by item, by mode. A new rule means editing the function that decides, and nothing removes the rule when its system ends. Policies answer this one.
A bonus is a point.
A point holds a number, with no condition, state or moment at which it applies. A conditional bonus is one more branch in the damage path. Traits answer this one.
The engine keeps the mechanisms. Gameplay moves out.
The three costs have one cause: the engine holds the gameplay. Take the mainline engine apart one layer at a time, and see what is left in C++.
The mainline engine is one block
Packets, rule branches, hardcoded points and the QuestManager are compiled into the same C++. A feature has nowhere else to land, so every feature is an engine change.
The mechanisms stay in C++
Registries that ask for decisions, an event bus that delivers engine events to Lua subscribers, and one transport for every channel between client, game cores and database.
Luna runs beside the QuestManager
The QuestManager keeps quest state, login and logout events and the
whenblocks. Luna does not replace it. The bridge is the single boundary every script call crosses, with coroutines of its own.Forge modules hold the gameplay
A forge is a stateful module loaded at boot and kept for the whole process, written in the same file as its quest hooks.
Frameworks take rules from both sides
Policies, affects, traits, skills, virtual players and player metrics. Each one is a mechanism in the engine that accepts registrations from C++ and from Lua, so a rule sits beside the system that owns it.
The client is the other end of the transport
Python windows register as handlers for server messages. UCHTML renders templates into client UI, and the render pipeline carries a frame through a render graph and an RHI to DirectX 11.
The simulator is the same server, built twice
The headless simulator is the game server built a second time from the same sources. It boots without a socket, a database or a disk map, and a Lua driver calls real engine entry points.
A rule becomes a question the engine asks.
Instead of a branch, the engine asks a registry. Each registration has a guard that selects the cases it owns and a payload that answers. Here is a complete item rule from the docs; pick a case and follow the walk.
trial_items.forge
forge trial_items begin
environment game begin
local MAP_A = 1
local handle = forge.sys.game.item_use_policy.register(
"trial_items",
function(ch) return ch:get_map_index() == MAP_A end,
function(ch, item)
if item:get_vnum() == 100008 then
return { allowed = false, reason = "Not on this map." }
end
return { allowed = true }
end)
return { handle = handle }
end
end
For item use, no allow beats a deny. Eight registries share this shape and each resolves in its own way: Policies, and the item use behaviour.
The foundations are built to meet.
A policy is one framework. Follow a single skill cast and it crosses five more, each handing the next something it can use. Every step opens the page that explains it.
- Skill use policyAsked before the cast. Like item use, it stops at the first refusal.allowed: the skill runs
- SkillOne definition per skill, read by the game server and the client.Player metricsThe native skill signal counts the cast too.a node adds an affect
- AffectA timed state on a character. For a broadcastable type, every viewer sees it with its duration.the affect is the gate
- TraitAttached while the affect lasts. A pre hook bumps a point for one damage calculation.the hit lands
- Player metricA qualifying hit feeds the
damagesignal, and the catalog counts it once for every consumer.Virtual playersIn a virtual session the default gate refuses the count. A prize commit is the explicit write back to real data.the heartbeat sweep publishes - Your Lua consumerSubscribes to
ON_METRICS_CHANGEDand re-evaluates only what the batch touched.
One feature, end to end, in three files.
Back to the message from the top of the page. On every login the server sends the player's login count to a small client window. This is the tutorial's code, loaded from the tutorial itself.
Server and client must agree on the bytes of a message. The .proto is that agreement: field names, types and field numbers. It compiles to Lua and to Python, never to C++.
protobuf/ue/login_counter.proto
syntax = "proto2";
package LoginCounter;
message GCLoginCount {
required int32 count = 1;
required int32 online = 2;
}
Lua, treated as a real language.
- A Lua debugger
- The quest compiler emits source maps, so you set breakpoints in the source you edit while the debugger follows the chunks that run.
- Generated stubs
- Every binding carries a documentation comment, and generated EmmyLua stubs turn it into completion, documentation and type checking in the editor.
- A headless simulator
- Stage a world from a Lua driver, call real engine entry points and read a verdict, without a client.
Choose where to start.
- FoundationsHow each system works and why it is built that way. Start here if you want the model before the API.
- DocsThe API reference: registration calls, signatures, verdict tables and the traps of each framework.
- TutorialsMulti-step builds with a check at each stage: forge modules, policies, traits, skills, metrics and client windows.
- ManifestoWhy gameplay belongs outside the engine, argued in full.