Difference between revisions of "Standards:GMCP Client Variables"

From Mudlet
Jump to navigation Jump to search
(Retired)
Tag: Blanking
 
(16 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 standardizes how client-specific variables are exchanged between MUD clients and servers. This enables servers to dynamically adjust gameplay based on client data, enhancing the user experience.
 
====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====
 
User consent is essential for sharing client-specific variables. Ensure users are informed about the data being shared and retain control over their personal information. This exchange of information is geared towards finding out what data is available in the client, receiving only what is needed from the server or script, and prompting the user for fields where consent is necessary and the fields are desired.
 
=== Specification for Client.Variables ===
 
 
==== Commands ====
 
 
===== Client.Variables.Default =====
 
'''Purpose''': Sent by the server to confirm support for the <code>Client.Variables</code> namespace. The client responds with a <code>Client.Variables.List</code> message. The server’s acknowledgment is typically asynchronous, while the client’s response is synchronous.
 
<syntaxhighlight lang="json">
 
Client.Variables.Default {}
 
</syntaxhighlight>
 
===== Client.Variables.List =====
 
'''Purpose''': Lists available client variables and attributes. The server may asynchronously request specific variables via <code>Client.Variables.Request</code>.
 
======Attribute Details======
 
{| class="wikitable “wikitable”"
 
|-
 
!Attribute
 
!Description
 
!Value
 
!Required
 
|-
 
|'''''name'''''
 
|Client variable identifier.
 
|(text)
 
|Yes
 
|-
 
|'''''available'''''
 
|Indicates if the variable is available for use. Values that require consent default to <code>false</code>.
 
|<code>true</code> or <code>false</code>
 
|Yes
 
|-
 
|'''''updatable'''''
 
|Indicates if the variable can be updated by the server.
 
|<code>true</code> or <code>false</code>
 
|Yes
 
|}
 
<syntaxhighlight lang="json">
 
Client.Variables.List [
 
    {"name": "256_COLORS", "available": true, "updatable": false},
 
    {"name": "ANSI", "available": true, "updatable": false},
 
    {"name": "BOLD_IS_BRIGHT", "available": true, "updatable": true},
 
    {"name": "CHARSET", "available": true, "updatable": true},
 
    {"name": "CLIENT_NAME", "available": true, "updatable": false},
 
    {"name": "CLIENT_VERSION", "available": true, "updatable": false},
 
    {"name": "LANGUAGE", "available": false, "updatable": false},
 
    {"name": "MTTS", "available": true, "updatable": false},
 
    {"name": "OSC_COLOR_PALETTE", "available": true, "updatable": false},
 
    {"name": "SCREEN_READER", "available": false, "updatable": false},
 
    {"name": "SYSTEMTYPE", "available": false, "updatable": false},
 
    {"name": "TERMINAL_TYPE", "available": true, "updatable": false},
 
    {"name": "TLS", "available": true, "updatable": false},
 
    {"name": "TRUECOLOR", "available": true, "updatable": false},
 
    {"name": "USER", "available": false, "updatable": false},
 
    {"name": "UTF-8", "available": true, "updatable": false},
 
    {"name": "VT100", "available": true, "updatable": false},
 
    {"name": "WORD_WRAP", "available": true, "updatable": false}
 
]
 
</syntaxhighlight>
 
=====Client.Variables.Request=====
 
'''Purpose''': The server requests specific client variables with <code>Client.Variables.Request</code>. The client will synchronously respond with a <code>Client.Variables.Update</code> message.
 
 
Encourage user consent by including a custom message in the <code>purpose</code> attribute, explaining why the information is collected. Limit the length of the value for the <code>purpose</code> attribute to 250 characters or less.
 
======Attribute Details======
 
{| class="wikitable “wikitable”"
 
|-
 
! Attribute
 
!Description
 
!Value
 
!Required
 
|-
 
|'''''name'''''
 
|Client variable identifier.
 
|(text)
 
|Yes
 
|-
 
|'''''purpose'''''
 
|Reason for collecting the information.
 
|(text)
 
|No
 
|}
 
<syntaxhighlight lang="json">
 
Client.Variables.Request [
 
    {"name": "BOLD_IS_BRIGHT"},
 
    {"name": "CHARSET"},
 
    {"name": "LANGUAGE", "purpose": "Match client language to optimize game and UI content"},
 
    {"name": "SCREEN_READER", "purpose": "Enable accessibility features for game and UI"},
 
    {"name": "SYSTEMTYPE", "purpose": "Adjust game and UI elements based on operating system"},
 
    {"name": "USER", "purpose": "Identify client account and character to the server"}
 
]
 
</syntaxhighlight>
 
=====Client.Variables.Update=====
 
'''Purpose''': Sends updates for requested variables. The <code>source</code> attribute indicates whether the update is due to a <code>request</code>, <code>client</code> action, or <code>server</code> initiation. The <code>requested</code> attribute should only be sent in response to <code>Client.Variables.Request</code>.
 
======Attribute Details ======
 
{| class="wikitable “wikitable”"
 
|-
 
!Attribute
 
!Description
 
!Value
 
!Required
 
|-
 
|'''''name'''''
 
|Client variable identifier.
 
|(text)
 
|Yes
 
|-
 
|'''''available'''''
 
| Indicates if the variable is available for use.
 
|<code>true</code> or <code>false</code>
 
|Yes
 
|-
 
|'''''updatable'''''
 
|Indicates if the variable can be updated by the server.
 
|<code>true</code> or <code>false</code>
 
|Yes
 
|-
 
|'''''requested'''''
 
|Indicates if the variable was requested by the server.
 
|<code>true</code> or <code>false</code>
 
|Yes
 
|-
 
|'''''source'''''
 
|Indicates the source of the update.
 
|<code>request</code> or <code>client</code> or <code>server</code>
 
| Yes
 
|-
 
|'''''timestamp'''''
 
|Unix timestamp indicating when the update was made.
 
|10-digit (or less) number
 
|Yes
 
|-
 
|'''''success'''''
 
|Indicates if an updatable variable changed.
 
|<code>true</code> or <code>false</code>
 
|Only sent in response to Client.Variables.Set messages.
 
|-
 
|'''''value'''''
 
|The value of the variable.
 
|
 
| When '''''available''''' is <code>true</code>and a value exists.
 
|}
 
<syntaxhighlight lang="json">
 
Client.Variables.Update [
 
    {"name": "BOLD_IS_BRIGHT", "available": true, "updatable": true, "requested": false, "source": "request", "timestamp": 1721495879, "value": 2},
 
    {"name": "CHARSET", "available": true, "updatable": true, "requested": false, "source": "request", "timestamp": 1721495879, "value": "UTF-8"},
 
    {"name": "LANGUAGE", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "SCREEN_READER", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "SYSTEMTYPE", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "USER", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879}
 
]
 
</syntaxhighlight>
 
 
=====Client.Variables.Set=====
 
'''Purpose''': Server sets previously <code>requested</code>, <code>updatable</code> client variables. The client responds synchronously with <code>Client.Variables.Update</code>, marking the <code>source</code> as <code>server</code>.
 
======Attribute Details======
 
{| class="wikitable “wikitable”"
 
|-
 
! Attribute
 
!Description
 
!Value
 
! Required
 
|-
 
|'''''name'''''
 
| Client variable identifier.
 
|(text)
 
| Yes
 
|-
 
|'''''value'''''
 
|The value of the variable.
 
|(varies)
 
|Yes
 
|}
 
<syntaxhighlight lang="json">
 
// Client request with a valid and invalid value
 
Client.Variables.Set [
 
    {"name": "BOLD_IS_BRIGHT", "value": 1},
 
    {"name": "CHARSET", "value": "DEEP-6"}
 
]
 
 
// Server response to a valid and invalid value
 
Client.Variables.Update [
 
    {"name": "BOLD_IS_BRIGHT", "available": true, "updatable": true, "source": "server", "timestamp": 1721495900, "success": true, "value": 1},
 
    {"name": "CHARSET", "available": true, "updatable": true, "source": "server", "timestamp": 1721495900, "success": false, "value": "DEEP-6"}
 
]
 
</syntaxhighlight>
 
===Implementation Considerations===
 
 
*'''Client Support Advertisement''': Clients should advertise their support for the Client.Variables namespace using <code>Core.Supports.Set</code>.
 
*'''Server Acknowledgement''': Servers acknowledge support with <code>Client.Variables.Default</code>.
 
*'''Consent Management''': Clients must handle user consent for sharing sensitive or personal data variables. Prompts should inform users of requested data and allow them to opt-in or block requests.
 
*'''Blocked Variables''': Clients should not share a variable previously blocked by a user in <code>Client.Variables.List</code> messages, nor make the variable available to other protocols, such as NEW-ENVIRON, MNES, and MTTS.
 
*'''Variable Naming Convention''': Variables should be transferred in uppercase to maintain consistency and avoid issues with case sensitivity.
 
*'''Legacy Support''': Game drivers may not be able to send boolean values. Where boolean values are expected, clients will transform <code>"true"</code> or <code>1</code> to <code>true</code>, and <code>"false"</code> or <code>0</code> to <code>false</code>.
 
 
===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 send available variables list. Variables previously blocked by the user should not be sent.
 
<syntaxhighlight lang="json">
 
Client.Variables.List [
 
    {"name": "256_COLORS", "available": true, "updatable": false},
 
    {"name": "ANSI", "available": true, "updatable": false},
 
    {"name": "BOLD_IS_BRIGHT", "available": true, "updatable": true},
 
    {"name": "CHARSET", "available": true, "updatable": true},
 
    {"name": "CLIENT_NAME", "available": true, "updatable": false},
 
    {"name": "CLIENT_VERSION", "available": true, "updatable": false},
 
    {"name": "LANGUAGE", "available": false, "updatable": false},
 
    {"name": "MTTS", "available": true, "updatable": false},
 
    {"name": "OSC_COLOR_PALETTE", "available": true, "updatable": false},
 
    {"name": "SCREEN_READER", "available": false, "updatable": false},
 
    {"name": "SYSTEMTYPE", "available": false, "updatable": false},
 
    {"name": "TERMINAL_TYPE", "available": true, "updatable": false},
 
    {"name": "TLS", "available": true, "updatable": false},
 
    {"name": "TRUECOLOR", "available": true, "updatable": false},
 
    {"name": "USER", "available": false, "updatable": false},
 
    {"name": "UTF-8", "available": true, "updatable": false},
 
    {"name": "VT100", "available": true, "updatable": false},
 
    {"name": "WORD_WRAP", "available": true, "updatable": false}
 
]
 
</syntaxhighlight>
 
4. '''Server''': May requests specific variables. Once per connected session, the client may prompt the user with a request to share variables that are <code>"available": false</code> from the <code>Client.Variables.List</code> message.<syntaxhighlight lang="json">
 
Client.Variables.Request [
 
    {"name": "BOLD_IS_BRIGHT"},
 
    {"name": "CHARSET"},
 
    {"name": "LANGUAGE", "purpose": "Match client language to adjust game and user interface content"},
 
    {"name": "SCREEN_READER", "purpose": "Enable accessible features to adjust game and user interface content"},
 
    {"name": "SYSTEMTYPE", "purpose": "Consider client operating system to adjust game and user interface elements"},
 
    {"name": "USER", "purpose": "Indicate client account:character name to the game server"}
 
]
 
</syntaxhighlight>
 
5. '''Client''': Updates requested variables.
 
<syntaxhighlight lang="json">
 
Client.Variables.Update [
 
    {"name": "BOLD_IS_BRIGHT", "available": true, "updatable": true, "requested": false, "source": "request", "timestamp": 1721495879, "value": 2},
 
    {"name": "CHARSET", "available": true, "updatable": true, "requested": false, "source": "request", "timestamp": 1721495879, "value": "UTF-8"},
 
    {"name": "LANGUAGE", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "SCREEN_READER", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "SYSTEMTYPE", "available": false, "updatable": false, "requested": true, "source": "request", "timestamp": 1721495879},
 
    {"name": "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]]
 
 
=== Examples ===
 
[[File:Client Variables Consent Prompting.png|alt=Image showing text sent to the game client to prompt users to share client information|frameless|600x600px]]
 
 
Prompting an end user to consent to share variables from the game client
 
 
 
 
[[File:Client Variables Consent Handling.png|alt=Image showing preferences selection within settings menu of client to handle sharing select sensitive or personal client information|frameless|600x600px]]
 
 
Handling response to client requests for sharing sensitive or personal variables
 
===Conclusion===
 
The GMCP Client Variables Sharing extension standardizes the exchange of client-specific variables, ensuring seamless integration and enhanced user experiences. Adopting this standard streamlines variable management, enhances client-server communication, and enables 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 in the #mudlet-development channel of the Mudlet Discord.
 
*Implementation should follow GMCP protocol specifications, and all messages must be well-formatted JSON objects.
 

Latest revision as of 19:30, 7 September 2024