Difference between revisions of "Standards:MUD Client Media Protocol"
(18 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | <languages/> | ||
+ | <translate> | ||
= MUD Client Media Protocol (MCMP) = | = MUD Client Media Protocol (MCMP) = | ||
+ | |||
== A Standard for Loading, Playing and Stopping Media Files with MUD Clients over GMCP == | == A Standard for Loading, Playing and Stopping Media Files with MUD Clients over GMCP == | ||
+ | |||
== Status of this Memo == | == Status of this Memo == | ||
This memo describes the addition of a standardized namespace of the Generic Mud Communication Protocol (GMCP) telnet sub-negotiation protocol (201) that provides syntax and usage guidance for sending JSON formatted messages from game servers to text-based game clients to load, play and stop media files. | This memo describes the addition of a standardized namespace of the Generic Mud Communication Protocol (GMCP) telnet sub-negotiation protocol (201) that provides syntax and usage guidance for sending JSON formatted messages from game servers to text-based game clients to load, play and stop media files. | ||
+ | |||
== Overview and Rationale == | == Overview and Rationale == | ||
With renewed interest in the MUD genre of gaming, expectations are high to provide sight and sound content that competes for audience with other gaming platforms. The purpose of the MUD Client Media Protocol (MCMP) is to establish a method of delivering media, such as game sounds, background music and video snippets, to text-based game clients via their widely accepted messaging platform, GMCP, which uses JSON as its data-interchange format. The intended return for introducing this protocol is to improve the MUD gaming experience and accessibility through standardized messaging between game servers and game clients. MUD Client Media Protocol (MCMP) is inspired by its predecessor [https://www.zuggsoft.com/zmud/msp.htm Mud Sound Protocol] (MSP). | With renewed interest in the MUD genre of gaming, expectations are high to provide sight and sound content that competes for audience with other gaming platforms. The purpose of the MUD Client Media Protocol (MCMP) is to establish a method of delivering media, such as game sounds, background music and video snippets, to text-based game clients via their widely accepted messaging platform, GMCP, which uses JSON as its data-interchange format. The intended return for introducing this protocol is to improve the MUD gaming experience and accessibility through standardized messaging between game servers and game clients. MUD Client Media Protocol (MCMP) is inspired by its predecessor [https://www.zuggsoft.com/zmud/msp.htm Mud Sound Protocol] (MSP). | ||
+ | |||
== Overview of the GMCP (201) Sub-negotiation Protocol == | == Overview of the GMCP (201) Sub-negotiation Protocol == | ||
Line 18: | Line 24: | ||
* GMCP messages consist of the namespace and a command (case insensitive alpha characters) delineated by a stop character, and optionally a space character and JSON-encoded payload. | * GMCP messages consist of the namespace and a command (case insensitive alpha characters) delineated by a stop character, and optionally a space character and JSON-encoded payload. | ||
* GMCP messages may be sent by both the client or server at any time with no warning. | * GMCP messages may be sent by both the client or server at any time with no warning. | ||
+ | |||
== Update to namespace: Client.* for Client.Media == | == Update to namespace: Client.* for Client.Media == | ||
We are proposing an addition to the Client.* meta-namespace for Client.Media. This serves the purpose of reserving this namespace for handling game client media operations and supporting future expansion and integration. | We are proposing an addition to the Client.* meta-namespace for Client.Media. This serves the purpose of reserving this namespace for handling game client media operations and supporting future expansion and integration. | ||
+ | |||
+ | |||
+ | == Video Demonstration of Client.Media == | ||
+ | |||
+ | [[File:MCMP_Background_Music_Demo_with_Mudlet.mp4]] | ||
== Specification for Client.Media == | == Specification for Client.Media == | ||
Line 31: | Line 43: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | </translate> | |
+ | ===<span class="mw-headline" id="Commands_-_Server">Commands - Server</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span>[[/index.php?title=Standards:MUD Client Media Protocol&veaction=edit§ion=1|edit]]<span class="mw-editsection-divider"> | </span>[[/index.php?title=Standards:MUD Client Media Protocol&action=edit§ion=1|edit source]]<span class="mw-editsection-bracket">]</span></span>=== | ||
+ | <span></span> | ||
+ | Due to the limitations for legacy gaming platforms supporting all JSON data types, such as boolean (''true'' and ''false''), game clients should support parsing of values within the Client.Media namespace also as strings (surrounded by quotes). | ||
− | === | + | <span></span> |
+ | ====<span class="mw-headline" id="Client.Media.Default">Client.Media.Default</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span>[[/index.php?title=Standards:MUD Client Media Protocol&veaction=edit§ion=2|edit]]<span class="mw-editsection-divider"> | </span>[[/index.php?title=Standards:MUD Client Media Protocol&action=edit§ion=2|edit source]]<span class="mw-editsection-bracket">]</span></span>==== | ||
+ | <span></span> | ||
+ | *Package: Client.Media.Default | ||
+ | *Purpose: Identify to the game client a default URL directory to load media files from an external resource. | ||
+ | *Guidance: For games that automatically download media files, perform a Client.Media.Default GMCP event once upon player login. | ||
+ | <span></span> | ||
− | + | Syntax: | |
+ | <span></span><div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"> | ||
+ | <span></span><span class="err">Client.Media.Default</span> <span class="p">{</span><span class="nt">"url"</span><span class="p">:</span> <span class="s2">"hxxps://www.example.com/media/"</span><span class="p">}</span> | ||
+ | </div><span></span> | ||
+ | Usage: | ||
+ | <span></span> | ||
+ | {| class="wikitable" | ||
− | + | !Required | |
− | + | !Key | |
− | |||
− | |||
− | + | !Value | |
− | + | ||
+ | ! style="text-align:left;" |Purpose | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- style="color: green;" | |- style="color: green;" | ||
− | | style="text-align:center;"| Yes | + | | style="text-align:center;" |Yes |
− | | "url" | + | |
− | | <url> | + | |"url" |
− | + | ||
− | + | |<url> | |
− | |||
− | |||
− | + | | style="text-align:left;" | | |
+ | *Resource location where the media file may be downloaded. | ||
+ | *Last character must be a / (slash). | ||
− | {{note}} | + | |}<span></span> |
+ | {{note}} | ||
− | + | <span></span><translate> Some examples are shown [[Special:MyLanguage/Manual:Scripting#Loading_Media|here]]. | |
+ | </translate> | ||
+ | ====<span class="mw-headline" id="Client.Media.Load">Client.Media.Load</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span>[[/index.php?title=Standards:MUD Client Media Protocol&veaction=edit§ion=1|edit]]<span class="mw-editsection-divider"> | </span>[[/index.php?title=Standards:MUD Client Media Protocol&action=edit§ion=1|edit source]]<span class="mw-editsection-bracket">]</span></span>==== | ||
+ | <span></span> | ||
* Package: Client.Media.Load | * Package: Client.Media.Load | ||
− | * Purpose: Load media files from an external source. | + | *Purpose: Load media files from an external source. |
− | * Guidance: For games that automatically download media files and have the capability to cache with the game client. | + | *Guidance: For games that automatically download media files and have the capability to cache with the game client. |
+ | <span></span> | ||
Syntax: | Syntax: | ||
+ | <span></span><div class="mw-highlight mw-highlight-lang-json mw-content-ltr" dir="ltr"> | ||
+ | <span></span><span class="err">Client.Media.Load</span> <span class="p">{</span> | ||
+ | <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"sword1.mp3"</span><span class="p">,</span> | ||
+ | <span class="nt">"url"</span><span class="p">:</span> <span class="s2">"hxxps://www.example.com/media/"</span> | ||
+ | <span class="p">}</span> | ||
+ | </div><span></span> | ||
+ | Usage: | ||
+ | <span></span> | ||
+ | {| class="wikitable" | ||
− | + | !Required | |
− | + | ||
− | + | !Key | |
− | + | ||
+ | !Value | ||
+ | |||
+ | ! style="text-align:left;" |Purpose | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- style="color: green;" | |- style="color: green;" | ||
− | | style="text-align:center;"| Yes | + | | style="text-align:center;" |Yes |
− | | "name" | + | |
− | | <file name> | + | |"name" |
− | | style="text-align:left;"| | + | |
− | * Name of the media file. | + | |<file name> |
− | * May contain directory information (i.e. weather/lightning. | + | |
+ | | style="text-align:left;" | | ||
+ | *Name of the media file. | ||
+ | *May contain directory information (i.e. weather/lightning.mp3). | ||
+ | |||
|- style="color: blue;" | |- style="color: blue;" | ||
− | | style="text-align:center;"| Maybe | + | | style="text-align:center;" |Maybe |
+ | |||
| "url" | | "url" | ||
+ | |||
| <url> | | <url> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | {{note}} Some examples are shown [[Manual:Scripting#Loading_Media|here]]. | + | | style="text-align:left;" | |
+ | *Resource location where the media file may be downloaded. | ||
+ | *Last character must be a / (slash). | ||
+ | *Only required if a url was not set with Client.Media.Default. | ||
+ | |||
+ | |}<span></span> | ||
+ | {{note}} | ||
+ | <translate> Some examples are shown [[Special:MyLanguage/Manual:Scripting#Loading_Media|here]]. | ||
+ | |||
==== Client.Media.Play ==== | ==== Client.Media.Play ==== | ||
Line 116: | Line 156: | ||
"tag": "environment", | "tag": "environment", | ||
"volume": 25, | "volume": 25, | ||
+ | "fadein": 5000, | ||
+ | "fadeout": 7000, | ||
+ | "start": 1000, | ||
+ | "finish": 20000, | ||
"loops": 3, | "loops": 3, | ||
"priority": 60, | "priority": 60, | ||
"continue": true, | "continue": true, | ||
− | "key": "area-background-music" | + | "key": "area-background-music" |
}</syntaxhighlight> | }</syntaxhighlight> | ||
Line 136: | Line 180: | ||
| style="text-align:left;"| | | style="text-align:left;"| | ||
* Name of the media file. | * Name of the media file. | ||
− | * May contain directory information (i.e. weather/lightning. | + | * May contain directory information (i.e. weather/lightning.mp3). |
|- style="color: blue;" | |- style="color: blue;" | ||
| style="text-align:center;"| Maybe | | style="text-align:center;"| Maybe | ||
Line 144: | Line 188: | ||
| style="text-align:left;"| | | style="text-align:left;"| | ||
* Resource location where the media file may be downloaded. | * Resource location where the media file may be downloaded. | ||
+ | * Last character must be a / (slash). | ||
* Only required if the file is to be downloaded remotely and a url was not set above with Client.Media.Default or Client.Media.Load. | * Only required if the file is to be downloaded remotely and a url was not set above with Client.Media.Default or Client.Media.Load. | ||
|- | |- | ||
Line 166: | Line 211: | ||
| style="text-align:left;"| | | style="text-align:left;"| | ||
* Relative to the volume set on the player's client. | * Relative to the volume set on the player's client. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "fadein" | ||
+ | | <msec> | ||
+ | | | ||
+ | | style="text-align:left;"| | ||
+ | * Volume increases, or fades in, ranged across a linear pattern from one to the volume set with the "volume" key. | ||
+ | * Start position: Start of media. | ||
+ | * End position: Start of media plus the number of milliseconds (msec) specified. | ||
+ | * 1000 milliseconds = 1 second. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "fadeout" | ||
+ | | <msec> | ||
+ | | | ||
+ | | style="text-align:left;"| | ||
+ | * Volume decreases, or fades out, ranged across a linear pattern from the volume set with the "volume" key to one. | ||
+ | * Start position: End of the media minus the number of milliseconds (msec) specified. | ||
+ | * End position: End of the media. | ||
+ | * 1000 milliseconds = 1 second. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "start" | ||
+ | | <msec> | ||
+ | | 0 | ||
+ | | style="text-align:left;"| | ||
+ | * Begin play at the specified position in milliseconds. | ||
+ | * 1000 milliseconds = 1 second. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "finish" | ||
+ | | <msec> | ||
+ | | 0 | ||
+ | | style="text-align:left;"| | ||
+ | * End play at the specified position in milliseconds. | ||
+ | * 1000 milliseconds = 1 second. | ||
|- | |- | ||
| style="text-align:center;"| No | | style="text-align:center;"| No | ||
Line 187: | Line 268: | ||
| true | | true | ||
| style="text-align:left;"| | | style="text-align:left;"| | ||
− | |||
* Continues playing matching new music files when true. | * Continues playing matching new music files when true. | ||
* Restarts matching new music files when false. | * Restarts matching new music files when false. | ||
Line 201: | Line 281: | ||
|} | |} | ||
− | {{note}} Some examples are shown [[Manual:Scripting#Playing_Media|here]]. | + | </translate> |
+ | |||
+ | {{note}} | ||
+ | <translate> Some examples are shown [[Special:MyLanguage/Manual:Scripting#Playing_Media|here]]. | ||
==== Client.Media.Stop ==== | ==== Client.Media.Stop ==== | ||
Line 216: | Line 299: | ||
"priority": 60, | "priority": 60, | ||
"key": "area-background-music", | "key": "area-background-music", | ||
+ | "fadeaway": true, | ||
+ | "fadeout": 7000 | ||
}</syntaxhighlight> | }</syntaxhighlight> | ||
Line 254: | Line 339: | ||
| style="text-align:left;"| | | style="text-align:left;"| | ||
* Stops playing media by key matching the value specified. | * Stops playing media by key matching the value specified. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "fadeaway" | ||
+ | | true or false | ||
+ | | style="text-align:left;" | | ||
+ | * Decrease volume from the current position for a given duration, then stops the track. | ||
+ | * Given duration is the lesser of the remaining track duration or the fadeout specified in Client.Media.Play. | ||
+ | * If fadeout was not specified in Client.Media.Play, then the optional fadeout parameter from Client.Media.Stop or a default of 5000 milliseconds will be applied. | ||
+ | |- | ||
+ | | style="text-align:center;"| No | ||
+ | | "fadeout" | ||
+ | | | ||
+ | | style="text-align:left;" | | ||
+ | * Default duration in milliseconds to decrease volume to the end of the track. | ||
+ | * Only used if fadeout was not defined in Client.Media.Play. | ||
|- | |- | ||
|} | |} | ||
− | {{note}} Some examples are shown [[Manual:Scripting#Stopping_Media|here]]. | + | </translate> |
+ | {{note}} | ||
+ | <translate> Some examples are shown [[Special:MyLanguage/Manual:Scripting#Stopping_Media|here]]. | ||
+ | |||
+ | == Versions == | ||
+ | |||
+ | * Version 1.0: Initial specification. | ||
+ | * Version 1.0.1: fadein, fadeout and start added to Client.Media.Play by Mike Conley (mike.conley[at]stickmud.com) on 22-DEC-2021. | ||
+ | * Version 1.0.2: finish added to Client.Media.Play and fadeaway and fadeout added to Client.Media.Stop by Mike Conley (mike.conley[at]stickmud.com) on 10-DEC-2023. | ||
+ | |||
+ | == Advertise Support for MCMP == | ||
+ | |||
+ | Consider advertising your games support of MCMP (and GMCP) to mud lists via the Mud Server Status Protocol, [[Special:MyLanguage/Manual:Supported_Protocols#MSSP|MSSP]], by providing a MSSP variable of "MCMP" and value of "1". | ||
== Authors == | == Authors == | ||
− | * Mike Conley (Tamarindo, Co-Administrator at StickMUD and Mudlet contributor) | + | * Mike Conley (Tamarindo, Co-Administrator at StickMUD and Mudlet contributor) mike.conley[at]stickmud.com |
* Eric Oestrich (Developer of ExVenture and Grapevine) eric[at]oestrich.org | * Eric Oestrich (Developer of ExVenture and Grapevine) eric[at]oestrich.org | ||
Line 267: | Line 379: | ||
* Known clients implementing this specification: | * Known clients implementing this specification: | ||
− | ** Mudlet version 4.4+. See [[Manual:Scripting#MUD_Client_Media_Protocol|documentation]]. | + | ** Mudlet version 4.4+. See [[Special:MyLanguage/Manual:Scripting#MUD_Client_Media_Protocol|documentation]]. |
+ | ** BeipMU version 4.00.298 implements basic load/play/stop commands. | ||
+ | </translate> |
Latest revision as of 14:30, 10 December 2023
MUD Client Media Protocol (MCMP)
A Standard for Loading, Playing and Stopping Media Files with MUD Clients over GMCP
Status of this Memo
This memo describes the addition of a standardized namespace of the Generic Mud Communication Protocol (GMCP) telnet sub-negotiation protocol (201) that provides syntax and usage guidance for sending JSON formatted messages from game servers to text-based game clients to load, play and stop media files.
Overview and Rationale
With renewed interest in the MUD genre of gaming, expectations are high to provide sight and sound content that competes for audience with other gaming platforms. The purpose of the MUD Client Media Protocol (MCMP) is to establish a method of delivering media, such as game sounds, background music and video snippets, to text-based game clients via their widely accepted messaging platform, GMCP, which uses JSON as its data-interchange format. The intended return for introducing this protocol is to improve the MUD gaming experience and accessibility through standardized messaging between game servers and game clients. MUD Client Media Protocol (MCMP) is inspired by its predecessor Mud Sound Protocol (MSP).
Overview of the GMCP (201) Sub-negotiation Protocol
To recap, the GMCP protocol is a bidirectional telnet sub-negotiation protocol (See RFC 854) which fulfills the following conditions:
- GMCP is separated into several ‘namespaces’, which may be enabled or disabled by the client at any time. The ‘Core’ namespace is always enabled and may not be disabled. Namespaces should consist of case-insensitive alphabetical characters and stop characters (. - ASCII 46/0x2E), representable as [A-Za-z.].
- GMCP messages consist of the namespace and a command (case insensitive alpha characters) delineated by a stop character, and optionally a space character and JSON-encoded payload.
- GMCP messages may be sent by both the client or server at any time with no warning.
Update to namespace: Client.* for Client.Media
We are proposing an addition to the Client.* meta-namespace for Client.Media. This serves the purpose of reserving this namespace for handling game client media operations and supporting future expansion and integration.
Video Demonstration of Client.Media
Specification for Client.Media
The Client.Media family of GMCP packages provide a way for games to send sound, music and video events. GMCP media events are sent in one direction: from game server to to game client. Media files may be downloaded manually by the user and/or automatically via the game client. Game clients should advertise to servers that Client.Media is supported with a Core.Supports message from game client to server.
Core.Supports.Set ["Client.Media 1", ...]
Commands - Server[edit | edit source]
Due to the limitations for legacy gaming platforms supporting all JSON data types, such as boolean (true and false), game clients should support parsing of values within the Client.Media namespace also as strings (surrounded by quotes).
Client.Media.Default[edit | edit source]
- Package: Client.Media.Default
- Purpose: Identify to the game client a default URL directory to load media files from an external resource.
- Guidance: For games that automatically download media files, perform a Client.Media.Default GMCP event once upon player login.
Syntax:
Client.Media.Default {"url": "hxxps://www.example.com/media/"}
Usage:
Required | Key | Value | Purpose |
---|---|---|---|
Yes | "url" | <url> |
|
Note:
Some examples are shown here.
Client.Media.Load[edit | edit source]
- Package: Client.Media.Load
- Purpose: Load media files from an external source.
- Guidance: For games that automatically download media files and have the capability to cache with the game client.
Syntax:
Client.Media.Load {
"name": "sword1.mp3",
"url": "hxxps://www.example.com/media/"
}
Usage:
Required | Key | Value | Purpose |
---|---|---|---|
Yes | "name" | <file name> |
|
Maybe | "url" | <url> |
|
Note:
Some examples are shown here.
Client.Media.Play
- Package: Client.Media.Play
- Purpose: Play media files.
- Guidance: Game clients could choose whether to play only one media file at one time or multiple files at one time.
Syntax:
Client.Media.Play {
"name": "city.mp3",
"url": "hxxps://www.example.com/media/",
"type": "music",
"tag": "environment",
"volume": 25,
"fadein": 5000,
"fadeout": 7000,
"start": 1000,
"finish": 20000,
"loops": 3,
"priority": 60,
"continue": true,
"key": "area-background-music"
}
Usage:
Required | Key | Value | Default | Purpose |
---|---|---|---|---|
Yes | "name" | <file name> |
| |
Maybe | "url" | <url> |
| |
No | "type" | "sound", "music" or "video" | "sound" |
|
No | "tag" | <tag> |
| |
No | "volume" | 1 to 100 | 50 |
|
No | "fadein" | <msec> |
| |
No | "fadeout" | <msec> |
| |
No | "start" | <msec> | 0 |
|
No | "finish" | <msec> | 0 |
|
No | "loops" | -1, or >= 1 | 1 |
|
No | "priority" | 1 to 100 |
| |
No | "continue" | true or false | true |
|
No | "key" | <key> |
|
Note:
Some examples are shown here.
Client.Media.Stop
- Package: Client.Media.Stop
- Purpose: Stop playing media files.
- Guidance: An empty body will stop all media.
Syntax:
Client.Media.Stop {
"name": "city.mp3",
"type": "music",
"tag": "environment",
"priority": 60,
"key": "area-background-music",
"fadeaway": true,
"fadeout": 7000
}
Usage:
Required | Key | Value | Purpose |
---|---|---|---|
No | "name" | <file name> |
|
No | "type" | "sound", "music" or "video" |
|
No | "tag" | <tag> |
|
No | "priority" | 1 to 100 |
|
No | "key" | <key> |
|
No | "fadeaway" | true or false |
|
No | "fadeout" |
|
Note:
Some examples are shown here.
Versions
- Version 1.0: Initial specification.
- Version 1.0.1: fadein, fadeout and start added to Client.Media.Play by Mike Conley (mike.conley[at]stickmud.com) on 22-DEC-2021.
- Version 1.0.2: finish added to Client.Media.Play and fadeaway and fadeout added to Client.Media.Stop by Mike Conley (mike.conley[at]stickmud.com) on 10-DEC-2023.
Advertise Support for MCMP
Consider advertising your games support of MCMP (and GMCP) to mud lists via the Mud Server Status Protocol, MSSP, by providing a MSSP variable of "MCMP" and value of "1".
Authors
- Mike Conley (Tamarindo, Co-Administrator at StickMUD and Mudlet contributor) mike.conley[at]stickmud.com
- Eric Oestrich (Developer of ExVenture and Grapevine) eric[at]oestrich.org
Notes
- Known clients implementing this specification:
- Mudlet version 4.4+. See documentation.
- BeipMU version 4.00.298 implements basic load/play/stop commands.