GameMaker SDK
Integrate the Shard SDK into your GameMaker project for recording, error monitoring, and social events.
Prerequisites: GameMaker Studio 2.3+ and Shard Launcher running
Installation
- Download
ShardSDK.yympsfrom GitHub Releases - In GameMaker, go to Tools → Import Local Package
- Select the downloaded
.yympsfile - Click Add All then Import to add the SDK to your project
The SDK adds the following scripts to your project:
shard_init- Initialize configurationshard_recording_trigger- Trigger recording eventsshard_monitor_report- Report errorsshard_social_trigger- Trigger social events
Quick Start
The SDK auto-initializes with default settings on first use. Simply call the functions:
// In your game code
function on_boss_defeated() {
// Trigger a recording event
shard_recording_trigger("myGame_bossDefeated");
}
function on_error(message) {
// Report an error
shard_monitor_report(message);
}
function on_achievement_unlocked() {
// Trigger a social event
shard_social_trigger("myGame_achievementUnlocked");
}Configuration
Optionally initialize with custom settings at game start:
// In your initialization code (e.g., Create event of a persistent controller)
shard_init({
launcher_url: "http://localhost:9876", // Default
enable_recording: true,
enable_monitor: true,
enable_social: true
});Configuration Options
| Property | 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 |
GML Naming Conventions
The SDK follows GameMaker’s GML naming conventions:
| Feature | Function Name | Parameter |
|---|---|---|
| Recording | shard_recording_trigger | event_id |
| Monitor | shard_monitor_report | message, [stack_trace] |
| Social | shard_social_trigger | event_id |
All function and parameter names use snake_case to match GML conventions.
Basic Usage
Recording Events
Trigger recording when gameplay moments occur:
// Trigger a recording event
shard_recording_trigger("myGame_e5f6g7h8");Error Monitoring
Report errors and exceptions:
// Report an error with message only
shard_monitor_report("Player fell through floor");
// Report an error with stack trace
shard_monitor_report("Collision error", "obj_player Step event");Social Events
Trigger social content display:
// Trigger a social event
shard_social_trigger("myGame_a1b2c3d4");Error Handling
The SDK uses fire-and-forget HTTP calls with silent failure:
- If the Shard Launcher is not running, calls silently fail
- No errors are thrown to your game code
- Network timeouts are handled automatically (5 second timeout)
- Uses GameMaker’s
http_requestfunction which handles failures gracefully
Your game continues running normally even if the launcher is unavailable.
Next Steps
- API Reference - Full API documentation
- Recording Overview - Learn about recording features
- Error Tracking - Learn about error monitoring
- Social Events - Learn about social features
- ShardKit CLI - Generate event IDs with the CLI