For client scripters
GMCP
Everything the game sends your MUD client besides text: your health, the collapse timer, cooldowns, your party, chat, a room feed made for auto-mappers, and the rooms you've explored. Here's every package, every field, and when each one arrives.
Getting started
GMCP, the Generic MUD Communication Protocol, carries small JSON messages alongside the game's text, out of sight, so your client can draw gauges, maps, and timers without reading the screen. ClamberMUD speaks it on both of its ports: clambermud.com port 4445 with TLS (recommended), or port 4444 for plain telnet.
- Turn it on. As you connect, the game offers GMCP. Most clients take it up on their own, and Mudlet has it on by default.
- Say hello. Send
Core.Hellowith your client's name and version. It's optional, but a client that names itself Mudlet is offered the game's own interface. - Ask for packages. Send
Core.Supports.Setwith the modules you want. The game sends only what you ask for.
- Game
IAC WILL GMCP - Client
IAC DO GMCP - Client
Core.Hello {"client": "Mudlet", "version": "4.19.1"} - Client
Core.Supports.Set ["Char 1", "Room 1", "Clamber 1", "Party 1", "Comm 1"] - Game
Char.Vitals {"hp": 96, "maxhp": 96, "mp": 40, "maxmp": 40, "mv": 120, "maxmv": 120, "position": "standing", "incombat": false}
Data starts once a character comes into the world, not at the login and character menus. The browser client at clambermud.com/play is built on these same packages.
Every package
From the game
| Package | What and when |
|---|---|
Char.Vitalsask for Char | Health, mana, movement, effect marks, stances, loaded ammo, whether you're resting, asleep, or in a fight, and your foe's health, whenever any of them changes. |
Char.Statusask for Char | Name, race, class, level, experience, tier, floor, zone, and viewers, whenever any of them changes, and once more when the character dies. |
Char.Cooldownsask for Char | Your skills and spells and their cooldowns, when one is used, gets ready, or is learned or lost. |
Char.Companionsask for Char | Your companions, their health, and the orders they're under, whenever any of it changes. |
Room.Infoask for Room | The room you're in, its exits, and its place on the grid, when you move or the room changes. |
Party.Membersask for Party | Your party, when it or anyone in it changes. |
Comm.Channel.Textask for Comm | Each line said on a channel, for chat windows and tabs. |
Clamber.Collapseask for Clamber | The collapse timer, every second while it runs. |
Clamber.Sirenask for Clamber | The siren on a tier that has one (Tier 4), when it starts, goes on air, and goes quiet. |
Clamber.Exploredask for Clamber | The rooms you've been in on your floor, when you arrive and each time you enter one for the first time. |
Client.GUIMudlet only | The game's own Mudlet interface, offered when a character comes into the world. |
From your client
| Package | What it does |
|---|---|
Core.Hello | Names your client and its version. |
Core.Supports.Set | The packages you want, replacing any list you sent before. |
Core.Supports.Add | More packages for the list. |
Core.Supports.Remove | Packages to take off the list. |
Clamber.Display | The plain or the usual display, for this connection only. |
Clamber.Resume | Log back in after a dropped connection without the password. |
The game ignores anything else a client sends. Package and module names can be in any case.
When data arrives
The game looks at your data after every command you type and once a second while you play. A package goes out only when what's in it has changed, so a quiet moment sends nothing.
- Coming into the world, by logging in or picking a character, sends everything you asked for at once.
Clamber.Collapsegoes out every second while the timer runs, so a gauge can just show what arrives. While it's stopped, it's sent only when it changes.Char.Cooldownsgoes out when something happens, never as the seconds tick by. Count down fromleftyourself, starting when the message came.Room.Infocomes when you move, and again if the room changes while you stand in it, such as its difficulty after you level up. Comparenumwith the last one to tell a move from an update.Clamber.Exploredcomes when you come into the world, climb to a new floor, or cross into another zone, and each time you enter a room for the first time. Walking through rooms you've been in sends nothing.Comm.Channel.Textcomes with each line said on a channel, just after the line itself shows.- A death sends
Char.Statusone last time, with"dead": true. The next character's data all goes out fresh. - Server updates sometimes restart the game without dropping anyone. Your connection keeps its GMCP and its list of packages, so there's nothing to ask for again.
Every message is the whole package, never a partial update. A key that's missing means there's nothing to report: no ammo loaded, no stance, not the party's leader.
Char.Vitals
Your gauges, in one flat object.
| Field | Meaning |
|---|---|
hp, maxhpnumber | Hit points now, and at most. |
mp, maxmpnumber | Mana now, and at most. Both are 0 for a climber without mana. |
mv, maxmvnumber, optional | Movement points, which walking spends. Left out for a climber that doesn't use them. |
badgeslist of words, optional | Words your prompt shows: effects such as a stance, in alphabetical order, then Hiding while you hide, as in ["Guard", "Hiding"]. Hiding means you're hiding, not that no one can see you. |
ammo, ammonamenumber, text; optional | Special ammo loaded in the ranged weapon in your hands: how many are left, and what it is, such as "fire arrow". Left out when none is loaded, since plain shots never run out. |
dreadnumber, optional | Your Dread, from 0 to 100, on a tier that has it (Tier 3). Left out on other tiers. |
positionword | standing, resting, or sleeping. |
incombattrue or false | Whether you're in a fight: attacking something, or being attacked. |
foename, hp; optional | Whom you're attacking, as your prompt's foe shows: name, as the game names them ("someone" if you can't see them), and hp, their health as a percent, never 0 while they stand. Left out when you aren't attacking anyone. |
| any other keynumber or text | An effect your prompt counts in stacks, by the short label your prompt gives it, such as a rogue's combo points, "cp": 3. Some show a few letters instead of a count, as your prompt does, and then the value is text, such as "wv": "RGR". |
{
"cp": 3,
"foe": {"name": "a sewer rat", "hp": 63},
"hp": 412,
"incombat": true,
"maxhp": 455,
"maxmp": 0,
"maxmv": 210,
"mp": 0,
"mv": 188,
"position": "standing"
}
Char.Status
Who you are and where you've got to.
| Field | Meaning |
|---|---|
nametext | Your character's name. |
race, classtext | As the game names them: "Human", "Rogue". |
levelnumber | Your level. |
xpnumber | Experience earned toward the next level. |
xpnextnumber | The experience the next level takes. 0 at the top level. |
tier, floornumber | Where you are in the tower. |
zonenumber, optional | On a tier that is one floor (Tier 4), the zone you're in, 1 to 10, which stands in for the floor. Left out on other tiers. |
viewersnumber, optional | Your live audience on Vivi's show. Left out at 0. |
deadtrue, optional | Sent once, when the character dies. |
{
"name": "Kestrel",
"race": "Human",
"class": "Rogue",
"level": 48,
"xp": 5210,
"xpnext": 9800,
"tier": 1,
"floor": 5,
"viewers": 31400
}
Char.Cooldowns
Every skill and spell you use by command, in alphabetical order, with how long until each one is ready. Passive abilities aren't listed.
| Field | Meaning |
|---|---|
specialslist | One entry for each skill or spell, with the fields below. |
nametext | Its name: "Backstab". |
usetext | What to type to use it: "backstab", or for a spell without a command of its own, cast and its name, such as "cast raise shade". |
leftnumber | Seconds until it's ready. 0 when it is. |
totalnumber | The whole cooldown it's on, in seconds, for a bar. 0 when it's ready. |
needsnametrue or missing | true for one that does nothing unless you name whom after use, such as Backstab, which is only used out of a fight, so there's no foe to fall back on. A button for it should ask for the name, or put use on the command line, rather than send use alone. |
It never counts down on its own, so count down from left yourself, from when the message came. A wait longer than the usual cooldown, as some rotations have, reports its whole length in total, so a bar still starts full. A rogue's, shortened:
{
"specials": [
{"name": "Backstab", "use": "backstab", "left": 14, "total": 20, "needsname": true},
{"name": "Hide", "use": "hide", "left": 0, "total": 0},
{"name": "Kneecap", "use": "kneecap", "left": 0, "total": 0}
]
}
Char.Companions
Your companions, the creatures and soldiers that follow you and fight for you, as a list, oldest first. It's an empty list when you have none. It lists every one wherever it is, as squad does, and never says where.
| Field | Meaning |
|---|---|
nametext | Its name, as the game writes it mid-sentence, without colors: "a loyal wolf". |
hp, maxhpnumber | Its health and most health. |
ordertext | The order it's under, from order: follow (what it does to start with), attack, guard, or hold. |
Two companions can share a name, so tell them apart by where they are in the list.
[
{"name": "a loyal wolf", "hp": 64, "maxhp": 80, "order": "follow"},
{"name": "a levy", "hp": 21, "maxhp": 40, "order": "attack"},
{"name": "a sergeant", "hp": 55, "maxhp": 55, "order": "guard"}
]
Room.Info
The room you're standing in, in the shape auto-mappers expect: a number for the room that never changes, its exits as room numbers, and its place on a grid. It tells you only what the game shows you: the exits you can see, and nothing about a room until you're in it.
| Field | Meaning |
|---|---|
numnumber | The room's number, the same for every climber and across restarts and updates. It's between 1 and 2,147,483,647, so it works as a Mudlet room ID. |
idtext | The game's own name for the room, just as stable: "f01.hollowmere_green". |
nametext | The room's title, without colors. |
areatext | The floor, as a mapper area: "Tier 1, floor 1". |
tier, floornumber | Where the room is in the tower. |
zonenumber, optional | On a tier that is one floor (Tier 4), the room's zone, 1 to 10. There the area is the whole tier, "Tier 4", since every zone shares one grid. |
exittrue, optional | The tier's exit: floor 10's, wherever it has moved to, or on Tier 4, once you've earned the right to see it. |
safetrue or false | A safe area: no monsters, no fights, and the place to log out. |
coordsx, y, z | Its place on the grid. x grows to the east, y to the north, and z upward. Each floor's town center is at 0, 0, 0. |
exitsdirection → number | Where each way out leads, by n, e, s, w, u, and d. Only the exits you can see: a hidden one shows up once you've found it. |
difficultyword, optional | How dangerous the room's monsters are for your level: trivial, easy, even, tough, dangerous, or deadly. Left out in safe rooms. |
shop, medic, postboxtrue, optional | What the room offers. |
doortrue, optional | A way into or out of an interior: a building, a cave, a lair, a dungeon. |
interiortext, optional | The interior you're in, which has a grid of its own. Left out on the floor's grid. |
spinofftrue, optional | A room of a spin-off, another show behind a door that's only open for a while. Walking its rooms isn't exploring, so Clamber.Explored never lists them: don't count them as rooms still to find. |
specialscommand → number, optional | The ways into and out of interiors, by the command that takes them, "enter cave" or "leave", to room number. |
Hollowmere Green, the town center of Tier 1's first floor:
{
"num": 1977135019,
"id": "f01.hollowmere_green",
"name": "Hollowmere Green",
"area": "Tier 1, floor 1",
"tier": 1,
"floor": 1,
"safe": true,
"coords": {"x": 0, "y": 0, "z": 0},
"exits": {
"e": 1637633805,
"n": 1130959750,
"s": 997240194,
"u": 1679355889,
"w": 587623402
},
"medic": true
}
And just inside the Quarry Caves, out in floor 1's wilds:
{
"num": 682665473,
"id": "f01.quarry_caves.cave_mouth",
"name": "Cave Mouth",
"area": "Tier 1, floor 1",
"tier": 1,
"floor": 1,
"safe": false,
"coords": {"x": 0, "y": 0, "z": 0},
"exits": {"w": 524517430},
"difficulty": "easy",
"door": true,
"interior": "The Quarry Caves",
"specials": {"leave": 1418592369}
}
Mapping
- Each floor's town center has an exit
u, the way up to the next floor's center. It only goes one way. - An interior's rooms sit on a grid of their own, named by
interior, with its doorway at 0, 0, 0, so give each interior its own map or area. The room outside lists the way in underspecials, and the doorway lists"leave". - Exits name room numbers only. A room's name and details arrive when you walk in, so a mapper draws exits you haven't taken as stubs.
- Numbers belong to the rooms, not to you, so a map drawn by one climber works for every other.
Room.Infois always the room you're in, which you've been in by then. To show which rooms on a shared map this climber hasn't been in yet, useClamber.Explored.
Party.Members
Your party, you included, as a list. It's an empty list when you're not in one. It never says where anyone is, only whether they're on your floor.
| Field | Meaning |
|---|---|
nametext | The member's name. |
levelnumber | Their level. 0 while they're away. |
hpnumber | Their health, as a percent. 0 while they're away. |
leadertrue, optional | The party's leader. |
heretrue, optional | On your floor. |
awaytrue, optional | Not in the world right now. |
[
{"name": "Kestrel", "level": 48, "hp": 91, "leader": true, "here": true},
{"name": "Wren", "level": 47, "hp": 64, "here": true},
{"name": "Moth", "level": 45, "hp": 100},
{"name": "Bea", "level": 0, "hp": 0, "away": true}
]
Comm.Channel.Text
Each line said on a channel, your own included, so your client can copy chat into a window or tab of its own. It's the package many other MUDs send for chat, so chat scripts written for them work here too. The line still shows in the game's text as usual.
| Field | Meaning |
|---|---|
channeltext | say (what's said and emoted in the room), party, tells (tells, replies, and whispers, to you or from you), shout, ooc, or vivi (Vivi on air, not what she says in your earpiece). More may come; put any you don't know with the rest of your chat. |
talkertext | Who's talking, as the line names them: a player's name on OOC, and Someone for a shouter you haven't met. |
texttext | The whole line as the game shows it, with its ANSI color codes, on one line however wide your screen is. |
{
"channel": "ooc",
"talker": "Kestrel",
"text": "\u001b[38;5;117m[OOC] Kestrel: anyone up for floor 2?\u001b[39m"
}
Clamber.Collapse
The collapse timer: how long your climber has left in the tower.
| Field | Meaning |
|---|---|
leftnumber | Seconds left. |
startnumber | The time this climber started with, in seconds: a gauge's full mark. |
runningtrue or false | Whether it's counting down now. It runs while you're online and awake, and anywhere outside a safe area, online or not. |
immunetrue or false | A climber whose race or class never collapses. Its time never runs out. |
{"left": 170923, "start": 172800, "running": true, "immune": false}
Clamber.Siren
The siren, on a tier that has one (Tier 4), so a client can play its sound or show a warning. You get the phase it's in when you arrive, then each change.
| Field | Meaning |
|---|---|
phaseword | quiet; warning, the siren winding up; or onair, while every monster near a climber hunts it. |
endsnumber, optional | When the phase ends, in Unix seconds. Left out while it's quiet. |
{"phase": "warning", "ends": 1793998830}
Clamber.Explored
Every room you've been in on the floor you're on, interiors too, by Room.Info number. A mapper keeps one map for every climber, so this is how it can tell which rooms this one still has to find. It's the same count as the game's map.
| Field | Meaning |
|---|---|
areatext | The floor, as in Room.Info: "Tier 1, floor 1". |
zonenumber, optional | On a tier that is one floor (Tier 4), the zone you're in. There the list covers that zone alone, and crossing into another zone sends that one's. |
roomslist of numbers | The rooms you've been in, smallest number first. |
totalnumber | How many rooms the floor (or zone) has, interiors too. |
A climber who has been in Hollowmere Green, the town center of Tier 1's first floor, and in the gates just north and east of it:
{
"area": "Tier 1, floor 1",
"rooms": [1130959750, 1637633805, 1977135019],
"total": 327
}
Each message is the whole list, so a room on your map that isn't in it is one this climber hasn't been in, as long as it's on the same floor (and on Tier 4, in the same zone, as Room.Info's zone told you). A spin-off's rooms are the exception: they're never listed, so leave out any room Room.Info marked spinoff.
Client.GUI
A client that names itself Mudlet in Core.Hello is offered the game's own interface: a map, gauges, the collapse timer, a hotbar for your skills on F1 to F12, and chat in tabs. It comes whether or not you asked for Client, and Mudlet installs it or updates it on its own. Other clients never get it.
| Field | Meaning |
|---|---|
versiontext | Changes whenever the package does, so Mudlet knows to update. |
urltext | Where to download it. |
baseuifalse | The package is the whole interface. |
{
"version": "ddbde9b4906c",
"url": "https://clambermud.com/mudlet/ClamberMUD.mpackage",
"baseui": false
}
In the game, mudlet off stops the offer and mudlet on brings it back. The game doesn't send Client.Map: the package downloads the first floor's map itself.
What your client sends
Core.Hello
Your client's name and version. It's optional. The game notes it, and offers Mudlet clients the interface package.
Core.Hello {"client": "Mudlet", "version": "4.19.1"}
Core.Supports.Set, Add, and Remove
Each takes a list of names, each with a version number. A module's name asks for all its packages, and a package's full name asks for that one alone. Set replaces your list, Add adds to it, and Remove takes off exactly the names you give, so removing Char.Vitals after asking for Char changes nothing. The version number is accepted, but not checked.
Core.Supports.Set ["Char 1", "Room 1", "Clamber 1", "Party 1", "Comm 1"]
Core.Supports.Add ["Char.Vitals 1"]
Core.Supports.Remove ["Party 1"]
| Module | Its packages |
|---|---|
Char | Char.Vitals, Char.Status, Char.Cooldowns, Char.Companions |
Room | Room.Info |
Party | Party.Members |
Clamber | Clamber.Collapse, Clamber.Siren, Clamber.Explored |
Comm | Comm.Channel.Text |
Clamber.Display
A JSON string, "plain" or "auto", that picks the display for this connection alone, as the browser client's screen reader mode does. The plain display drops the block art and puts into words what colors show; "auto" is the usual display, and "full" means the same. It only decides while your account's display setting is auto, as it is unless you change it: display plain or display full in the game wins.
Clamber.Display "plain"
Clamber.Resume
Reconnecting in one tap, as the browser client does. As soon as GMCP is on, before you answer the terminal-type questions, send a JSON string: the token the game gave you last time, or "" if you have none. Sending it says your client keeps a token. A good token logs straight back in to the character you were playing, with no welcome screen or password; one that's no good gets the usual login.
At the end of every login, the game sends a client that sent Clamber.Resume a new token in the same package, whatever you asked for with Core.Supports. Keep it to yourself: it logs in as you. It works once, for up to 30 minutes after your connection ends, and stops working when you quit, change your password, or log in again from anywhere. On quit, and when a token is refused, the game sends "": forget the one you have.
Clamber.Resume ""
Anything else a client sends, Core.Ping included, is ignored. A message from a client can be up to 8 KB.
Scripting in Mudlet
Mudlet has GMCP on by default. When you log in, the game offers its own interface package, and Mudlet installs it unless Preferences → General → Allow server to install script packages is off. The package asks for every module.
Writing your own scripts without it? Ask for the modules yourself, from a script:
sendGMCP([[Core.Supports.Add ["Char 1", "Room 1", "Clamber 1", "Party 1", "Comm 1"] ]])
Mudlet keeps the latest of each package in its gmcp table, such as gmcp.Char.Vitals.hp, and raises an event named for the package as each one arrives. A warning when the clock gets low:
-- Warn once when the collapse timer drops under an hour.
local warned = false
registerAnonymousEventHandler("gmcp.Clamber.Collapse", function()
local c = gmcp.Clamber.Collapse
if c.running and not c.immune and c.left < 3600 and not warned then
warned = true
cecho("\n<magenta>Under an hour left on the clock!\n")
end
end)
And telling a move from an update to the same room:
-- Act only when you've walked into a new room.
local lastRoom
registerAnonymousEventHandler("gmcp.Room.Info", function()
local r = gmcp.Room.Info
if r.num ~= lastRoom then
lastRoom = r.num
echo("\nNow in " .. r.name .. " (" .. r.area .. ")\n")
end
end)
On the wire
For anyone writing a client. GMCP is telnet option 201. The game offers it with IAC WILL GMCP as you connect. Answer IAC DO GMCP to turn it on; answer IAC DONT GMCP and nothing more is sent.
Each message is IAC SB GMCP (bytes FF FA C9), the package name, a space, the JSON, and IAC SE (FF F0), in UTF-8. A 255 byte inside a message is doubled, as telnet requires. The game sends its JSON on one line, without spaces; the examples on this page are spaced out to read.
FF FA C9 Clamber.Collapse {"left":170923,"start":172800,"running":true,"immune":false} FF F0
Good to know
- Only what you could see. GMCP never tells you more than the game's own screen: no rooms you haven't been in, no exits you haven't found, and never where your party members are.
- New fields can turn up as the game grows. Skip keys you don't know, except in
Char.Vitals, where any key this page doesn't list is an effect mark. - Any display. GMCP is the same whichever display you play with, plain or full.
- Missing something? Type
ideain the game, or ask on the Discord. Found something wrong? Typebug.