Difference between revisions of "Standards:GMCP Client Variables"

From Mudlet
Jump to navigation Jump to search
m (Initial Draft)
(Retired)
Tag: Blanking
 
(60 intermediate revisions by the same user not shown)
Line 1: Line 1:
== GMCP Client Variables Sharing Standard ==
 
  
=== Overview and Rationale ===
 
The GMCP Client Variables Sharing extension provides a standardized way to exchange client-specific variables between MUD clients and game servers using GMCP messages. This facilitates enhanced user experiences by allowing servers to adjust gameplay and UI elements based on client-provided data.
 
====Rationale====
 
As MUDs become more complex, the need for customizable and dynamic interactions between clients and servers has grown. Sharing client-specific variables allows for personalized gameplay experiences, seamless UI adjustments, and improved accessibility features. By standardizing this exchange, the GMCP Client Variables Sharing extension ensures that all participants in the MUD ecosystem can benefit from enhanced communication and data sharing.
 
====Consent Management Process====
 
A critical aspect of sharing client-specific variables is obtaining user consent. This process ensures that users are aware of what data is being shared and have control over their personal information.
 
=== Specification for Client.Variables ===
 
 
==== Commands ====
 
 
===== Client.Variables.Default =====
 
'''Purpose''': Sent by the server to acknowledge support for the Client.Variables namespace. The client will synchronously respond with a Client.Variables.List message.
 
<syntaxhighlight lang="json">
 
Client.Variables.Default {}
 
</syntaxhighlight>
 
===== Client.Variables.List =====
 
'''Purpose''': The client sends a list of available client variables and their attributes. The server may asynchronously respond with a Client.Variables.Request message.
 
<syntaxhighlight lang="json">
 
Client.Variables.List {
 
    “256_COLORS”: {“available”: true, “updatable”: false},
 
    “ANSI”: {“available”: true, “updatable”: false},
 
    “BOLD_IS_BRIGHT”: {“available”: true, “updatable”: true},
 
    “CHARSET”: {“available”: true, “updatable”: true},
 
    “CLIENT_NAME”: {“available”: true, “updatable”: false},
 
    “CLIENT_VERSION”: {“available”: true, “updatable”: false},
 
    “FONT”: {“available”: false, “updatable”: false},
 
    “FONT_SIZE”: {“available”: false, “updatable”: false},
 
    “LANGUAGE”: {“available”: false, “updatable”: false},
 
    “MTTS”: {“available”: true, “updatable”: false},
 
    “OSC_COLOR_PALETTE”: {“available”: true, “updatable”: false},
 
    “SCREEN_READER”: {“available”: false, “updatable”: false},
 
    “SYSTEMTYPE”: {“available”: false, “updatable”: false},
 
    “TERMINAL_TYPE”: {“available”: true, “updatable”: false},
 
    “TLS”: {“available”: true, “updatable”: false},
 
    “TRUECOLOR”: {“available”: true, “updatable”: false},
 
    “USER”: {“available”: false, “updatable”: false},
 
    “UTF-8”: {“available”: true, “updatable”: false},
 
    “VT100”: {“available”: true, “updatable”: false},
 
    “WORD_WRAP”: {“available”: true, “updatable”: false}
 
}
 
</syntaxhighlight>
 
====== Attribute Details ======
 
{| class="wikitable “wikitable”"
 
|-
 
! Attribute
 
!Description
 
|-
 
|''available''
 
|Indicates if the variable is available for use.
 
|-
 
|''updatable''
 
| Indicates if the variable can be updated by the server.
 
|}
 
 
=====Client.Variables.Request=====
 
'''Purpose''': The server requests specific client variables. The client will synchronously respond with a Client.Variables.Update message.
 
<syntaxhighlight lang="json">
 
Client.Variables.Request [“BOLD_IS_BRIGHT”, “CHARSET”, “FONT”, “FONT_SIZE”, “LANGUAGE”, “SCREEN_READER”, “SYSTEMTYPE”, “USER”]
 
</syntaxhighlight>
 
=====Client.Variables.Update=====
 
'''Purpose''': The client sends updates for requested variables with a <code>source</code> attribute of <code>request</code>.
 
<syntaxhighlight lang="json">
 
Client.Variables.Update {
 
    “BOLD_IS_BRIGHT”: {
 
        “available”: true,
 
        “updatable”: true,
 
        “requested”: false,
 
        “source”: “request”,
 
        “timestamp”: 1721495879,
 
        “value”: 2
 
    },
 
    “CHARSET”: {
 
        “available”: true,
 
        “updatable”: true,
 
        “requested”: false,
 
        “source”: “request”,
 
        “timestamp”: 1721495879,
 
        “value”: “UTF-8”
 
    },
 
    “FONT”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    },
 
    “FONT_SIZE”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    },
 
    “LANGUAGE”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    },
 
    “SCREEN_READER”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    },
 
    “SYSTEMTYPE”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    },
 
    “USER”: {
 
        “available”: false,
 
        “updatable”: false,
 
        “requested”: true,
 
        “source”: “request”,
 
        “timestamp”: 1721495879
 
    }
 
}
 
</syntaxhighlight>
 
======Attribute Details======
 
{| class="wikitable “wikitable”"
 
|-
 
! Attribute
 
! Description
 
|-
 
| ''available''
 
| Indicates if the variable is available for use.
 
|-
 
| ''updatable''
 
| Indicates if the variable can be updated by the server.
 
|-
 
| ''requested''
 
| Indicates if the variable was requested by the server.
 
|-
 
| ''source''
 
| Indicates the source of the update (request, server, client).
 
|-
 
| ''timestamp''
 
| Unix timestamp indicating when the update was made.
 
|-
 
| ''value''
 
| The value of the variable.
 
|}
 
 
=====Client.Variables.Set=====
 
'''Purpose''': The server sets one or more updatable client variables. The client will synchronously respond with a Client.Variables.Update with a <code>source</code> attribute of <code>server</code>.
 
<syntaxhighlight lang="json">
 
Client.Variables.Set {
 
    “BOLD_IS_BRIGHT” : “1”,
 
    "CHARSET" : "UTF-8"
 
}
 
</syntaxhighlight>
 
===Implementation Considerations===
 
 
*'''Client Support Advertisement''': Clients should advertise their support for the Client.Variables namespace using Core.Supports.Set.
 
*'''Server Acknowledgement''': Servers acknowledge support with Client.Variables.Default.
 
*'''Consent Management''': Clients must handle user consent for sharing sensitive variables. Prompts should inform users of requested data and allow them to opt-in or block requests.
 
*'''Variable Updates''': Clients should manage variable updates efficiently, ensuring data integrity and user consent.
 
*'''Variable Naming Convention''': Variables should be transferred in uppercase to maintain consistency and avoid issues with case sensitivity.
 
 
===Example Flow===
 
 
1. '''Client''': Should advertise support.
 
<syntaxhighlight lang="json">
 
Core.Supports.Set ["Client.Variables 1", ...]
 
</syntaxhighlight>
 
2. '''Server''': May acknowledge support.
 
<syntaxhighlight lang="json">
 
Client.Variables.Default {}
 
</syntaxhighlight>
 
3. '''Client''': Must sends available variables list.
 
<syntaxhighlight lang="json">
 
Client.Variables.List {
 
    "256_COLORS": {"available": true, "updatable": false},
 
    "ANSI": {"available": true, "updatable": false},
 
    "BOLD_IS_BRIGHT": {"available": true, "updatable": true},
 
    "CHARSET": {"available": true, "updatable": true},
 
    "CLIENT_NAME": {"available": true, "updatable": false},
 
    "CLIENT_VERSION": {"available": true, "updatable": false},
 
    "FONT": {"available": false, "updatable": false},
 
    "FONT_SIZE": {"available": false, "updatable": false},
 
    "LANGUAGE": {"available": false, "updatable": false},
 
    "MTTS": {"available": true, "updatable": false},
 
    "OSC_COLOR_PALETTE": {"available": true, "updatable": false},
 
    "SCREEN_READER": {"available": false, "updatable": false},
 
    "SYSTEMTYPE": {"available": false, "updatable": false},
 
    "TERMINAL_TYPE": {"available": true, "updatable": false},
 
    "TLS": {"available": true, "updatable": false},
 
    "TRUECOLOR": {"available": true, "updatable": false},
 
    "USER": {"available": false, "updatable": false},
 
    "UTF-8": {"available": true, "updatable": false},
 
    "VT100": {"available": true, "updatable": false},
 
    "WORD_WRAP": {"available": true, "updatable": false}
 
}
 
</syntaxhighlight>
 
4. '''Server''': May requests specific variables.
 
 
* The client may prompt the user once per connected session for variables that are <code>"available": false</code>.
 
* The client must track variables requested for the current connected session to limit prompting requests for sharing to once per connected session.
 
<syntaxhighlight lang="json">
 
Client.Variables.Request ["BOLD_IS_BRIGHT", "CHARSET", "FONT", "FONT_SIZE", "LANGUAGE", "SCREEN_READER", "SYSTEMTYPE", "USER"]
 
</syntaxhighlight>
 
5. '''Client''': Updates requested variables.
 
<syntaxhighlight lang="json">
 
Client.Variables.Update {
 
    "BOLD_IS_BRIGHT": {
 
        "available": true,
 
        "updatable": true,
 
        "requested": false,
 
        "source": "request",
 
        "timestamp": 1721495879,
 
        "value": 2
 
    },
 
    "CHARSET": {
 
        "available": true,
 
        "updatable": true,
 
        "requested": false,
 
        "source": "request",
 
        "timestamp": 1721495879,
 
        "value": "UTF-8"
 
    },
 
    "FONT": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    },
 
    "FONT_SIZE": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    },
 
    "LANGUAGE": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    },
 
    "SCREEN_READER": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    },
 
    "SYSTEMTYPE": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    },
 
    "USER": {
 
        "available": false,
 
        "updatable": false,
 
        "requested": true,
 
        "source": "request",
 
        "timestamp": 1721495879
 
    }
 
}
 
</syntaxhighlight>
 
 
==== Flow Diagrams ====
 
 
====== Requesting and Receiving Variables ======
 
[[File:Flow1.png|alt=GMCP Client Variables Flow 1|frameless|600x600px]]
 
 
====== Receiving Variable Updates ======
 
 
 
[[File:Flow2.png|alt=GMCP Client Variables Flow 2|frameless|600x600px]]
 
 
====== Setting Updatable Variables ======
 
 
 
[[File:Flow3.png|alt=GMCP Client Variables Flow 3|frameless|600x600px]]
 
 
===Conclusion===
 
The GMCP Variables Sharing extension standardizes the exchange of client-specific variables, ensuring seamless integration and enhanced user experiences. By adopting this standard, MUD developers can streamline variable management, improve client-server communication, and provide more personalized gaming experiences.
 
 
==Versions==
 
*Version 1.0: Initial specification.
 
 
==Authors==
 
*Mike Conley (Tamarindo, Administrator at StickMUD and Mudlet contributor) mike.conley[at]stickmud.com
 
 
===Notes===
 
*This specification is subject to updates and community input. Contributions and feedback are welcome to ensure it meets the needs of the MUD community.
 
*Implementation should follow GMCP protocol specifications, and all messages must be well-formatted JSON objects.
 

Latest revision as of 19:30, 7 September 2024