Godot SDK
Integrate the Shard SDK into your Godot 4.x project for recording, error monitoring, and social events.
Prerequisites: Godot 4.x and Shard Launcher running
Installation
Option 1: Copy the Addon
- Download or clone the SDK from GitHub
- Copy the
addons/shard_sdk/folder to your Godot project’saddons/directory - In Godot, go to Project → Project Settings → Plugins
- Enable the Shard SDK plugin
Option 2: Asset Library
Coming soon - The SDK will be available on the Godot Asset Library.
Quick Start
Once the plugin is enabled, the ShardSDK autoload singleton is automatically available. Access features directly:
extends Node
func _on_boss_defeated():
# Trigger a recording event
ShardSDK.recording.trigger_event("myGame_bossDefeated")
func _on_error(message: String, stack: String):
# Report an error
ShardSDK.monitor.report_error(message, stack)
func _on_achievement_unlocked():
# Trigger a social event
ShardSDK.social.trigger_event("myGame_achievementUnlocked")Configuration
Configure the SDK via Project → Project Settings under the shard_sdk/ section:
| Setting | Type | Default | Description |
|---|---|---|---|
launcher_url | String | http://localhost:9876 | Shard Launcher URL |
enable_recording | bool | true | Enable recording triggers |
enable_monitor | bool | true | Enable error reporting |
enable_social | bool | true | Enable social events |
debug_logging | bool | false | Enable debug output |
Enable debug_logging during development to see SDK activity in the Output panel.
Recording
Trigger recording events when gameplay moments occur:
# Trigger when a boss is defeated
func _on_boss_defeated():
ShardSDK.recording.trigger_event("myGame_bossDefeated")
# Trigger when an achievement is unlocked
func _on_achievement_unlocked(achievement_id: String):
ShardSDK.recording.trigger_event("myGame_" + achievement_id)The Shard Launcher captures a clip around the trigger moment. Event IDs should be generated using the ShardKit CLI.
Error Monitoring
Report errors and exceptions to track issues in production:
# Report a simple error
func _on_connection_failed():
ShardSDK.monitor.report_error("Connection to server failed")
# Report an error with stack trace
func _on_exception(message: String):
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(message, stack_str)Social Events
Trigger social content display in the launcher overlay:
# Trigger when entering a new area
func _on_area_entered(area_name: String):
ShardSDK.social.trigger_event("myGame_entered_" + area_name)
# Trigger when completing a quest
func _on_quest_completed(quest_id: String):
ShardSDK.social.trigger_event("myGame_quest_" + quest_id)Error Handling
The SDK uses fire-and-forget HTTP calls with silent failure:
- If the Shard Launcher is not running, calls silently fail
- No exceptions are thrown to your game code
- Network timeouts are handled automatically (5 second timeout)
Your game continues running normally even if the launcher is unavailable.
Project Structure
The SDK addon structure:
addons/shard_sdk/
├── plugin.cfg # Plugin metadata
├── plugin.gd # Editor plugin (registers autoload & settings)
├── ShardSDK.gd # Main autoload singleton
├── recording/
│ └── RecordingService.gd # Recording trigger functionality
├── monitor/
│ └── MonitorService.gd # Error reporting functionality
└── social/
└── SocialService.gd # Social event functionalityNext Steps
- API Reference - Full API documentation
- Recording Overview - Learn about recording features
- Social Events - Learn about social features
- ShardKit CLI - Generate event IDs with the CLI