Difference between revisions of "Standards:GMCP Client Variables"

From Mudlet
Jump to navigation Jump to search
(Initial Draft)
 
m (Initial Draft)
Line 9: Line 9:
  
 
===== Client.Variables.Default =====
 
===== Client.Variables.Default =====
‘’‘Purpose’’’: Sent by the server to acknowledge support for the Client.Variables namespace.
+
'''Purpose''': Sent by the server to acknowledge support for the Client.Variables namespace.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Default {}
 
Client.Variables.Default {}
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===== Client.Variables.List =====
 
===== Client.Variables.List =====
‘’‘Purpose’’’: The client sends a list of available client variables and their attributes.
+
'''Purpose''': The client sends a list of available client variables and their attributes.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.List {
 
Client.Variables.List {
Line 40: Line 40:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===== Client.Variables.Request =====
 
===== Client.Variables.Request =====
‘’‘Purpose’’’: The server requests specific client variables.
+
'''Purpose''': The server requests specific client variables.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Request [“BOLD_IS_BRIGHT”, “CHARSET”, “FONT”, “FONT_SIZE”, “LANGUAGE”, “SCREEN_READER”, “SYSTEMTYPE”, “USER”]
 
Client.Variables.Request [“BOLD_IS_BRIGHT”, “CHARSET”, “FONT”, “FONT_SIZE”, “LANGUAGE”, “SCREEN_READER”, “SYSTEMTYPE”, “USER”]
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===== Client.Variables.Update =====
 
===== Client.Variables.Update =====
‘’‘Purpose’’’: The client sends updates for requested variables.
+
'''Purpose''': The client sends updates for requested variables.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Update {
 
Client.Variables.Update {
Line 109: Line 109:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===== Client.Variables.Set =====
 
===== Client.Variables.Set =====
‘’‘Purpose’’’: The server sets specific client variables.
+
'''Purpose''': The server sets specific client variables.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Set {
 
Client.Variables.Set {
“BOLD_IS_BRIGHT” : “1”
+
    “BOLD_IS_BRIGHT” : “1”
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 124: Line 124:
 
=== Example Flow ===
 
=== Example Flow ===
  
1. ‘’‘Client’’’: Advertises support.
+
1. '''Client''': Advertises support.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Core.Supports.Set ["Client.Variables 1", ...]
 
Core.Supports.Set ["Client.Variables 1", ...]
 
</syntaxhighlight>
 
</syntaxhighlight>
2. ‘’‘Server’’’: Acknowledges support.
+
2. '''Server''': Acknowledges support.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Default {}
 
Client.Variables.Default {}
 
</syntaxhighlight>
 
</syntaxhighlight>
3. ‘’‘Client’’’: Sends available variables list.
+
3. '''Client''': Sends available variables list.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.List {
 
Client.Variables.List {
Line 157: Line 157:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
4. ‘’‘Server’’’: Requests specific variables.
+
4. '''Server''': Requests specific variables.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Request ["BOLD_IS_BRIGHT", "CHARSET", "FONT", "FONT_SIZE", "LANGUAGE", "SCREEN_READER", "SYSTEMTYPE", "USER"]
 
Client.Variables.Request ["BOLD_IS_BRIGHT", "CHARSET", "FONT", "FONT_SIZE", "LANGUAGE", "SCREEN_READER", "SYSTEMTYPE", "USER"]
 
</syntaxhighlight>
 
</syntaxhighlight>
5. ‘’‘Client’’’: Updates requested variables.
+
5. '''Client''': Updates requested variables.
 
<syntaxhighlight lang="json">
 
<syntaxhighlight lang="json">
 
Client.Variables.Update {
 
Client.Variables.Update {

Revision as of 23:51, 3 August 2024

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.

Specification for Client.Variables

Commands - Server

Client.Variables.Default

Purpose: Sent by the server to acknowledge support for the Client.Variables namespace.

Client.Variables.Default {}
Client.Variables.List

Purpose: The client sends a list of available client variables and their attributes.

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}
}
Client.Variables.Request

Purpose: The server requests specific client variables.

Client.Variables.Request [“BOLD_IS_BRIGHT”, “CHARSET”, “FONT”, “FONT_SIZE”, “LANGUAGE”, “SCREEN_READER”, “SYSTEMTYPE”, “USER”]
Client.Variables.Update

Purpose: The client sends updates for requested variables.

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
    }
}
Client.Variables.Set

Purpose: The server sets specific client variables.

Client.Variables.Set {
    “BOLD_IS_BRIGHT” : “1”
}

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.

Example Flow

1. Client: Advertises support.

Core.Supports.Set ["Client.Variables 1", ...]

2. Server: Acknowledges support.

Client.Variables.Default {}

3. Client: Sends available variables list.

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}
}

4. Server: Requests specific variables.

Client.Variables.Request ["BOLD_IS_BRIGHT", "CHARSET", "FONT", "FONT_SIZE", "LANGUAGE", "SCREEN_READER", "SYSTEMTYPE", "USER"]

5. Client: Updates requested variables.

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
    }
}

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.