Godot SDK API Reference
Complete API documentation for the Shard Godot SDK.
ShardSDK
Autoload singleton providing access to all SDK services. Automatically registered when the plugin is enabled.
Properties
| Property | Type | Description |
|---|---|---|
recording | RecordingService | Recording service instance |
monitor | MonitorService | Monitor service instance |
social | SocialService | Social service instance |
launcher_url | String | Configured launcher URL |
enable_recording | bool | Whether recording is enabled |
enable_monitor | bool | Whether monitor is enabled |
enable_social | bool | Whether social is enabled |
debug_logging | bool | Whether debug logging is enabled |
Usage
# Access via the autoload singleton
ShardSDK.recording.trigger_event("myGame_a1b2c3d4")
ShardSDK.monitor.report_error("Something went wrong")
ShardSDK.social.trigger_event("myGame_a1b2c3d4")Configuration Options
Configure via Project → Project Settings under shard_sdk/:
| Setting | Type | Default | Description |
|---|---|---|---|
shard_sdk/launcher_url | String | "http://localhost:9876" | URL of the Shard Launcher |
shard_sdk/enable_recording | bool | true | Enable recording event triggers |
shard_sdk/enable_monitor | bool | true | Enable monitor/error reporting |
shard_sdk/enable_social | bool | true | Enable social event triggers |
shard_sdk/debug_logging | bool | false | Enable debug logging output |
RecordingService
Service for triggering recording events. Access via ShardSDK.recording.
Methods
trigger_event(event_id: String) -> void
Triggers a recording event in the Shard Launcher.
Parameters:
event_id(String): The event ID to trigger (e.g.,"myGame_a1b2c3d4")
Example:
# Trigger a recording event
ShardSDK.recording.trigger_event("myGame_bossDefeated")HTTP Request:
- Endpoint:
POST /api/recording/trigger - Payload:
{
"eventId": "myGame_bossDefeated",
"timestamp": "2024-01-15T10:30:00.000Z"
}Notes:
- Fire-and-forget: Does not block game execution
- Silent failure: No exceptions if launcher unavailable
- Empty event IDs are ignored with a warning (if debug logging enabled)
MonitorService
Service for reporting errors and diagnostics. Access via ShardSDK.monitor.
Methods
report_error(message: String, stack_trace: String = "") -> void
Reports an error to the Shard Launcher.
Parameters:
message(String): Error or diagnostic messagestack_trace(String, optional): Stack trace information, defaults to empty string
Example:
# Report a simple error
ShardSDK.monitor.report_error("Player position invalid")
# Report an error with stack trace
var stack = get_stack()
var stack_str = ""
for frame in stack:
stack_str += "%s:%d in %s\n" % [frame.source, frame.line, frame.function]
ShardSDK.monitor.report_error("Unexpected state", stack_str)HTTP Request:
- Endpoint:
POST /api/monitor/report - Payload:
{
"message": "Player position invalid",
"stackTrace": "",
"timestamp": "2024-01-15T10:30:00.000Z"
}Notes:
- Fire-and-forget: Does not block game execution
- Silent failure: No exceptions if launcher unavailable
- Empty messages are ignored with a warning (if debug logging enabled)
SocialService
Service for triggering social events. Access via ShardSDK.social.
Methods
trigger_event(event_id: String) -> void
Triggers a social event in the Shard Launcher.
Parameters:
event_id(String): The event ID to trigger (e.g.,"myGame_a1b2c3d4")
Example:
# Trigger a social event
ShardSDK.social.trigger_event("myGame_achievementUnlocked")HTTP Request:
- Endpoint:
POST /api/social/trigger - Payload:
{
"eventId": "myGame_achievementUnlocked",
"timestamp": "2024-01-15T10:30:00.000Z"
}Notes:
- Fire-and-forget: Does not block game execution
- Silent failure: No exceptions if launcher unavailable
- Empty event IDs are ignored with a warning (if debug logging enabled)
HTTP Behavior
All SDK methods use fire-and-forget HTTP POST requests:
| Aspect | Behavior |
|---|---|
| Method | POST |
| Content-Type | application/json |
| Timeout | 5 seconds |
| On Success | Logs if debug enabled |
| On Failure | Silent (logs if debug enabled) |
| Blocking | No - async execution |
Timestamp Format
All payloads include an ISO 8601 timestamp in UTC:
YYYY-MM-DDTHH:MM:SS.sssZExample: 2024-01-15T10:30:00.123Z