GMCP

From Flexible Survival
Jump to: navigation, search

GMCP, or Generic Mud Communication Protocol, is a method of sending JSON-encoded data between a server and mud client outside the normal flow of test that is supported by many modern clients. It can be used for things such as sending a player's stats to the client so that it can include the data in some kind of GUI.

Flexible Survival does not yet have full native integration of GMCP, but has a pseudo implementation that can send data from the server to client, but not back again. It was also written with BeipMU in mind, so is currently tailored to that. Further changes may occur as the code develops.


Supported packages

Currently, only a single package is supported, beip.stats. This can contain three blocks of data for different groups of stats. Note that in order to reduce network traffic, the protocol is designed to allow updating either a single stat or multiple stats at a time, so not all data will be provided with every update.

The general format of a block is:

"<Group name>": {
    "background-color": <color string>,
    "values": {
        <data for value>
    }
}

Values can contain numeric, string, or range data. Their format is:

"<name of stat>": {
    "<type of value>": <value data>,
    "prefix-length": <numeric value>,
    "value-color": <color string>,
    "name-color": <color string>,
    "name-alignment": "[left|right|center]"
}

The prefix length field is used to specify how many characters to ignore at the beginning of the name of the stat - this allows controlling the order that fields are displayed in by adding a prefix such as "10_" and setting the prefix length field to 3.

value-color and name-color can be used to specify the color in which to display the relevant field. Color strings may be an RGB hex code such as "#00ff00" for green, or an ANSI colour code in the form "ansi256(<number>)".

The type of value should be one of "int", "string", or "range". For "int" and "string" types, the value data field should be the number or string to be displayed. For "range" types, a block will be provided of the form:

{
    "value": <numeric value>,
    "min": <numeric value>,
    "max": <numeric value>,
    "bar-fill": <color string>
}

All fields have a prefix-length of 3.


beip.stats player stats

  • 00_Name: String value, contains the character's name and a value-color corresponding to the character's gender.
  • 10_Hit Points: Range value, character's current health.
  • 30_Level": String value, character's true level.
  • 35_Mentored to: String value, character's effective level.
  • 40_Current XP: String value, character's current experience points.
  • 50_Rested XP: String value, character's rested experience point value.
  • 60_Cred Energy: String value.
  • 70_Hero Points: String value.
  • 80_Wounds: String value.
  • 90_Unread Notices: String value, number of unread notices on the website.


beip.stats resources stats

  • 10_Freecred: String value.
  • 20_Mako: String value.
  • 30_Reward Tokens: String value.
  • 40_Builder Nanites: String value.
  • 40_Patrol Points: String value.
  • 50_Battery Charge: String value.


beip.stats combat stats

  • 10_Difficulty Level: String value.
  • 20_Difficulty Quantity: String value.
  • 30_Primary Class: String value, character's primary class.
  • 40_Secondary Class: String value, character's secondary class if in possession of a dual soul pendant.