DocsGameMaker SDKOverview

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

  1. Download ShardSDK.yymps from GitHub Releases
  2. In GameMaker, go to Tools → Import Local Package
  3. Select the downloaded .yymps file
  4. Click Add All then Import to add the SDK to your project

The SDK adds the following scripts to your project:

  • shard_init - Initialize configuration
  • shard_recording_trigger - Trigger recording events
  • shard_monitor_report - Report errors
  • shard_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

PropertyTypeDefaultDescription
launcher_urlstringhttp://localhost:9876Shard Launcher URL
enable_recordingbooltrueEnable recording triggers
enable_monitorbooltrueEnable error reporting
enable_socialbooltrueEnable social events

GML Naming Conventions

The SDK follows GameMaker’s GML naming conventions:

FeatureFunction NameParameter
Recordingshard_recording_triggerevent_id
Monitorshard_monitor_reportmessage, [stack_trace]
Socialshard_social_triggerevent_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_request function which handles failures gracefully

Your game continues running normally even if the launcher is unavailable.


Next Steps