DocsRPG Maker SDKAPI Reference

RPG Maker SDK API Reference

Complete API documentation for the Shard RPG Maker SDK.


ShardSDK

Global object providing access to all SDK services.

Properties

PropertyTypeDescription
ConfigobjectSDK configuration (read-only)
RecordingobjectRecording service
MonitorobjectMonitor service
SocialobjectSocial service

Config Object

PropertyTypeDescription
launcherUrlstringURL of the Shard Launcher
enableRecordingbooleanWhether recording is enabled
enableMonitorbooleanWhether monitoring is enabled
enableSocialbooleanWhether social events are enabled

ShardSDK.Recording

Service for triggering recording events.

triggerEvent(eventId)

Triggers a recording event in the Shard Launcher.

Parameters:

ParameterTypeRequiredDescription
eventIdstringYesThe recording event ID

Example:

// Trigger a recording event
ShardSDK.Recording.triggerEvent("myGame_bossDefeated");

HTTP Request:

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

ShardSDK.Monitor

Service for reporting errors and diagnostics.

reportError(message, stackTrace)

Reports an error to the Shard Launcher.

Parameters:

ParameterTypeRequiredDescription
messagestringYesError or diagnostic message
stackTracestringNoOptional stack trace

Example:

// Report an error with message only
ShardSDK.Monitor.reportError("Player position invalid");
 
// Report an error with stack trace
try {
    // risky code
} catch (e) {
    ShardSDK.Monitor.reportError(e.message, e.stack);
}

HTTP Request:

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

ShardSDK.Social

Service for triggering social events.

triggerEvent(eventId)

Triggers a social event in the Shard Launcher.

Parameters:

ParameterTypeRequiredDescription
eventIdstringYesThe social event ID

Example:

// Trigger a social event
ShardSDK.Social.triggerEvent("myGame_achievementUnlocked");

HTTP Request:

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

Plugin Parameters

Configure via RPG Maker’s Plugin Manager:

ParameterTypeDefaultDescription
Launcher URLstringhttp://localhost:9876URL of the Shard Launcher
Enable RecordingbooleantrueEnable recording event triggers
Enable MonitorbooleantrueEnable monitor/error reporting
Enable SocialbooleantrueEnable social event triggers

Script Call Examples

Use these in RPG Maker event Script calls:

Recording a Boss Fight

// When boss battle starts
ShardSDK.Recording.triggerEvent("myGame_bossFight");

Reporting Game Errors

// In a try-catch block
try {
    // game logic
} catch (e) {
    ShardSDK.Monitor.reportError(e.message, e.stack);
}

Achievement Unlocked

// When player unlocks an achievement
ShardSDK.Social.triggerEvent("myGame_firstBoss");

Advanced Usage

Checking if Features are Enabled

// Check if recording is enabled before triggering
if (ShardSDK.Config.enableRecording) {
    console.log("Recording is enabled");
}

Custom Error Handler

// Set up a global error handler
window.onerror = function(message, source, lineno, colno, error) {
    ShardSDK.Monitor.reportError(
        message,
        error ? error.stack : `${source}:${lineno}:${colno}`
    );
    return false; // Let the error propagate
};

The SDK automatically handles cases where the launcher is not running - your game will continue without errors.