DocsGameMaker SDKAPI Reference

GameMaker SDK API Reference

Complete API documentation for the Shard GameMaker SDK.


shard_init

Initializes the Shard SDK with optional configuration.

shard_init([config])

Parameters

ParameterTypeRequiredDescription
configstructNoConfiguration struct

Configuration Struct

PropertyTypeDefaultDescription
launcher_urlstring"http://localhost:9876"URL of the Shard Launcher
enable_recordingbooltrueEnable recording event triggers
enable_monitorbooltrueEnable monitor/error reporting
enable_socialbooltrueEnable social event triggers

Example

// Initialize with defaults
shard_init();

// Initialize with custom config
shard_init({
    launcher_url: "http://localhost:9876",
    enable_recording: true,
    enable_monitor: true,
    enable_social: false  // Disable social events
});

If not called explicitly, the SDK auto-initializes with defaults on first API call.


shard_recording_trigger

Triggers a recording event in the Shard Launcher.

shard_recording_trigger(event_id)

Parameters

ParameterTypeRequiredDescription
event_idstringYesThe recording event ID

Example

// Trigger a recording event
shard_recording_trigger("myGame_bossDefeated");

HTTP Request

  • Endpoint: POST /api/recording/trigger
  • Payload: { "eventId": "...", "timestamp": "..." }

shard_monitor_report

Reports an error or diagnostic message to the Shard Launcher.

shard_monitor_report(message, [stack_trace])

Parameters

ParameterTypeRequiredDescription
messagestringYesError or diagnostic message
stack_tracestringNoOptional stack trace (default: "")

Example

// Report an error with message only
shard_monitor_report("Player position invalid");

// Report an error with stack trace
shard_monitor_report("Collision error", "obj_player Step event line 42");

HTTP Request

  • Endpoint: POST /api/monitor/report
  • Payload: { "message": "...", "stackTrace": "...", "timestamp": "..." }

shard_social_trigger

Triggers a social event in the Shard Launcher.

shard_social_trigger(event_id)

Parameters

ParameterTypeRequiredDescription
event_idstringYesThe social event ID

Example

// Trigger a social event
shard_social_trigger("myGame_achievementUnlocked");

HTTP Request

  • Endpoint: POST /api/social/trigger
  • Payload: { "eventId": "...", "timestamp": "..." }

Internal Details

Global Configuration

The SDK stores configuration in global.__shard_config:

// Access current config (read-only recommended)
var url = global.__shard_config.launcher_url;
var recording_enabled = global.__shard_config.enable_recording;

HTTP Implementation

All functions use GameMaker’s http_request function:

// Internal implementation pattern
var _headers = ds_map_create();
ds_map_add(_headers, "Content-Type", "application/json");
http_request(_url, "POST", _headers, json_stringify(_payload));
ds_map_destroy(_headers);
⚠️

The SDK does not handle HTTP Async events. Responses are ignored (fire-and-forget pattern).