Each game core snapshots its timed boss regens once a second and shares them over the original HEADER_GG_RELAY addressed to "#mt_boss", so old cores just miss the player lookup instead of dropping the P2P link. New /mt_features query kind "bosses" (capability bit 256, mask 511) lists the player's channel plus the shared channel 99. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.3 KiB
PORT world boss tracking, v1
Date: 2026-10-15. Read-only port of the AVA2 uitrack world-boss tab. Source: src/server/game/src/port_boss_track.h (board, wire format), port_boss_track.cpp (regen scan, relay, query), hooks in main.cpp (1 s tick), input_p2p.cpp (Relay) and port_features.h (query kind bosses, capability bit 256). No new packet header, no DB schema, no gameplay change. AVA2's teleport button is not ported, and its dungeon tab is already covered by the dungeons query.
Which regens are listed
A regen is a boss regen when all of these hold:
- type
MOB,GROUPorANYWHERE; time > 0(it respawns on a timer);- its leader (the mob itself, or member 0 of the group, which
SpawnGroupmakes the master) is aCHAR_TYPE_MONSTERwithbRank >= MOB_RANK_BOSS.
Each row carries:
| Field | Source |
|---|---|
| VNUM | leader vnum |
| MAP | regen->lMapIndex |
| X, Y | centre of the regen box minus the map base (map-local units); 0 0 for ANYWHERE |
| ALIVE, MAX | regen->count, regen->max_count (capped at 255) |
| NEXT | server time when regen_event fires next (now + event_time / passes_per_sec); 0 when there is no event |
| PERIOD | regen->time in seconds |
The regen timer is the original one; the board only reads it. regen_event tops the regen up to max_count each time it fires, so ALIVE < MAX with a NEXT in the past means "about to spawn".
Sharing between cores
Each game core (not the auth core) scans its own regen list once a second, keeping at most 64 rows. It broadcasts the snapshot when it changes (vnum/map/alive/max/period differ, or NEXT moves by more than 2 s) and otherwise every 60 s as a heartbeat.
The snapshot goes over the original HEADER_GG_RELAY, addressed to the name #mt_boss, which no player can have:
TPacketGGRelay { header, szName "#mt_boss", lSize }
PortBossHeader { uint16 p2p_port; uint8 channel; uint8 count } 4 bytes
PortBossWire { uint32 vnum, map; int32 x, y; uint32 period, next; uint8 alive, max } 26 bytes x count
A new GG header was not used on purpose: a core without this code would hit "UNKNOWN HEADER" and close the P2P link. An old core instead looks the name up with FindPC, finds nobody and drops the payload, logging one InputP2P::Relay : #mt_boss size N line per snapshot. A new core consumes the relay before the player lookup. Malformed payloads (short, size mismatch, more than 64 rows) are rejected with one syserr line.
Remote snapshots are keyed by sender host + P2P port; a newer one replaces the older, and a core that has been silent for 150 s drops out.
Query
/mt_features 1 REQUEST bosses
MTF1 begin REQUEST bosses 0 0 TOTAL 0 SERVER_TIME
MTF1 boss REQUEST INDEX VNUM MAP X Y CHANNEL ALIVE MAX NEXT PERIOD
MTF1 end REQUEST ROW_COUNT
A player sees the rows of their own channel plus channel 99 (the shared core). Rows are sorted by map, vnum and channel, and capped at 128. The usual query rules (throttle, own PC, version check) apply. bosses with extra arguments returns MTF1 error REQUEST unsupported.
Evidence
tests/features/test_bosses.py:- wiring checks for the Makefile, the main tick, the relay hook order and the query dispatch;
- a compiled test of the board covering the broadcast throttle, encode/decode round trip, channel filter, sort, replace, expiry, malformed payloads and the caps.
tests/features/test_queries.py: cap 511, dispatch and the extra-argument error.- FreeBSD build in
/root/metin2-features-dev. 2026-10-15 test on 203 with two channel5 cores:firston 13040 served maps 1/21/41/68; a temporarysecondon 13041 served maps 72/5.- A query on either core returned all 5 boss rows of both cores:
- pirate 5001
ANYWHEREon maps 21/41; - 2307 on map 68;
- 1192 on map 72;
- 5161 on map 5.
- pirate 5001
- NEXT values were identical from both sides.
- The live channel 1-4 cores and game99 (old binary) each logged the relay line and kept their P2P links; no P2P errors in syserr.
- The Makefile has no header dependencies. After changing
port_features.h, touchcmd_general.cpp(its only includer) or the old object is linked. The first test build hit this and still advertised cap 255.
Deployment
Every game core must run the new binary for every boss to be listed; mixing is safe in both directions. Channel 99 rows appear only once game99 runs it.