ClamberMUD

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.Hello with 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.Set with the modules you want. The game sends only what you ask for.
  1. GameIAC WILL GMCP
  2. ClientIAC DO GMCP
  3. ClientCore.Hello {"client": "Mudlet", "version": "4.19.1"}
  4. ClientCore.Supports.Set ["Char 1", "Room 1", "Clamber 1", "Party 1", "Comm 1"]
  5. GameChar.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

PackageWhat and when
Char.Vitalsask for CharHealth, 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 CharName, race, class, level, experience, tier, floor, zone, and viewers, whenever any of them changes, and once more when the character dies.
Char.Cooldownsask for CharYour skills and spells and their cooldowns, when one is used, gets ready, or is learned or lost.
Char.Companionsask for CharYour companions, their health, and the orders they're under, whenever any of it changes.
Room.Infoask for RoomThe room you're in, its exits, and its place on the grid, when you move or the room changes.
Party.Membersask for PartyYour party, when it or anyone in it changes.
Comm.Channel.Textask for CommEach line said on a channel, for chat windows and tabs.
Clamber.Collapseask for ClamberThe collapse timer, every second while it runs.
Clamber.Sirenask for ClamberThe siren on a tier that has one (Tier 4), when it starts, goes on air, and goes quiet.
Clamber.Exploredask for ClamberThe rooms you've been in on your floor, when you arrive and each time you enter one for the first time.
Client.GUIMudlet onlyThe game's own Mudlet interface, offered when a character comes into the world.

From your client

PackageWhat it does
Core.HelloNames your client and its version.
Core.Supports.SetThe packages you want, replacing any list you sent before.
Core.Supports.AddMore packages for the list.
Core.Supports.RemovePackages to take off the list.
Clamber.DisplayThe plain or the usual display, for this connection only.
Clamber.ResumeLog 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.Collapse goes 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.Cooldowns goes out when something happens, never as the seconds tick by. Count down from left yourself, starting when the message came.
  • Room.Info comes when you move, and again if the room changes while you stand in it, such as its difficulty after you level up. Compare num with the last one to tell a move from an update.
  • Clamber.Explored comes 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.Text comes with each line said on a channel, just after the line itself shows.
  • A death sends Char.Status one 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

Ask for CharWhen it changes

Your gauges, in one flat object.

FieldMeaning
hp, maxhpnumberHit points now, and at most.
mp, maxmpnumberMana now, and at most. Both are 0 for a climber without mana.
mv, maxmvnumber, optionalMovement points, which walking spends. Left out for a climber that doesn't use them.
badgeslist of words, optionalWords 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; optionalSpecial 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, optionalYour Dread, from 0 to 100, on a tier that has it (Tier 3). Left out on other tiers.
positionwordstanding, resting, or sleeping.
incombattrue or falseWhether you're in a fight: attacking something, or being attacked.
foename, hp; optionalWhom 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 textAn 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

Ask for CharWhen it changes

Who you are and where you've got to.

FieldMeaning
nametextYour character's name.
race, classtextAs the game names them: "Human", "Rogue".
levelnumberYour level.
xpnumberExperience earned toward the next level.
xpnextnumberThe experience the next level takes. 0 at the top level.
tier, floornumberWhere you are in the tower.
zonenumber, optionalOn 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, optionalYour live audience on Vivi's show. Left out at 0.
deadtrue, optionalSent 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

Ask for CharWhen one is used, gets ready, or is learned or lost, and for each new character

Every skill and spell you use by command, in alphabetical order, with how long until each one is ready. Passive abilities aren't listed.

FieldMeaning
specialslistOne entry for each skill or spell, with the fields below.
nametextIts name: "Backstab".
usetextWhat 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".
leftnumberSeconds until it's ready. 0 when it is.
totalnumberThe whole cooldown it's on, in seconds, for a bar. 0 when it's ready.
needsnametrue or missingtrue 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

Ask for CharWhen it changes

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.

FieldMeaning
nametextIts name, as the game writes it mid-sentence, without colors: "a loyal wolf".
hp, maxhpnumberIts health and most health.
ordertextThe 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

Ask for RoomWhen you move or the room changes

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.

FieldMeaning
numnumberThe 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.
idtextThe game's own name for the room, just as stable: "f01.hollowmere_green".
nametextThe room's title, without colors.
areatextThe floor, as a mapper area: "Tier 1, floor 1".
tier, floornumberWhere the room is in the tower.
zonenumber, optionalOn 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, optionalThe 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 falseA safe area: no monsters, no fights, and the place to log out.
coordsx, y, zIts 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 → numberWhere 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, optionalHow dangerous the room's monsters are for your level: trivial, easy, even, tough, dangerous, or deadly. Left out in safe rooms.
shop, medic, postboxtrue, optionalWhat the room offers.
doortrue, optionalA way into or out of an interior: a building, a cave, a lair, a dungeon.
interiortext, optionalThe interior you're in, which has a grid of its own. Left out on the floor's grid.
spinofftrue, optionalA 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, optionalThe 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 under specials, 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.Info is 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, use Clamber.Explored.

Party.Members

Ask for PartyWhen it changes

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.

FieldMeaning
nametextThe member's name.
levelnumberTheir level. 0 while they're away.
hpnumberTheir health, as a percent. 0 while they're away.
leadertrue, optionalThe party's leader.
heretrue, optionalOn your floor.
awaytrue, optionalNot 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

Ask for CommWith each line said on a channel

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.

FieldMeaning
channeltextsay (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.
talkertextWho's talking, as the line names them: a player's name on OOC, and Someone for a shouter you haven't met.
texttextThe 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

Ask for ClamberEvery second while it runs

The collapse timer: how long your climber has left in the tower.

FieldMeaning
leftnumberSeconds left.
startnumberThe time this climber started with, in seconds: a gauge's full mark.
runningtrue or falseWhether it's counting down now. It runs while you're online and awake, and anywhere outside a safe area, online or not.
immunetrue or falseA climber whose race or class never collapses. Its time never runs out.
{"left": 170923, "start": 172800, "running": true, "immune": false}

Clamber.Siren

Ask for ClamberWhen the siren's phase changes

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.

FieldMeaning
phasewordquiet; warning, the siren winding up; or onair, while every monster near a climber hunts it.
endsnumber, optionalWhen the phase ends, in Unix seconds. Left out while it's quiet.
{"phase": "warning", "ends": 1793998830}

Clamber.Explored

Ask for ClamberWhen you arrive, and in each new room

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.

FieldMeaning
areatextThe floor, as in Room.Info: "Tier 1, floor 1".
zonenumber, optionalOn 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 numbersThe rooms you've been in, smallest number first.
totalnumberHow 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

Mudlet onlyWhen a character comes into the world

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.

FieldMeaning
versiontextChanges whenever the package does, so Mudlet knows to update.
urltextWhere to download it.
baseuifalseThe 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"]
ModuleIts packages
CharChar.Vitals, Char.Status, Char.Cooldowns, Char.Companions
RoomRoom.Info
PartyParty.Members
ClamberClamber.Collapse, Clamber.Siren, Clamber.Explored
CommComm.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 idea in the game, or ask on the Discord. Found something wrong? Type bug.