Skip to main content

WYVRN Unity SDK

The WYVRN SDK has a C# API to integrate with AI, Chroma, and haptics.

About

The WYVRN SDK is a runtime game plugin that is shared to provide a common API for naming events and triggering external AI, Chroma playback and haptic events.

Getting Started With Unity SDK

  • This WYVRN SDK plugin requires Unity 2021.3.15f1 or higher.

Requirements and Setup

To import the WYVRN SDK into Unity using the Unity Package Manager, follow these steps:


  • Open the Unity Package Manager, then click the + button in the toolbar.

Add the WYVRN SDK package from disk or by URL


Option 1) Add package from disk

  • Select Add package from disk... from the menu.

image_53

  • Download this repository and browse to package.json file of the local copy.

image_54


Option 2) Add package from git URL

  • Select Add package from git URL from the menu.

image_49


If either installation option is successful, the Razer WYVRN SDK package will appear in the package list.

image_50

Security

To avoid a 3rd party injecting malicious code, the plugin checks for a valid signature on the Razer Chromatic Library. The DLL issuer is validated to be Razer USA Ltd. Init and InitSDK will return RZRESULT_DLL_INVALID_SIGNATURE if the signature check fails.

General

  • The WYVRN SDK allows an application or game to set the details in the Chroma Apps list within the Chroma App.

This document provides a guide to integrating AI, Chroma, and haptics using the WYVRN C++ SDK. Here is the list of available methods from the API:

WYVRN SDK

The WYVRN SDK is the combination of AI, Chroma, and Razer Sensa HD Haptics in a single SDK. By integrating AI, RGB lighting and haptics into game environments and events, players can enjoy a truly immersive gaming experience. The WYVRN SDK is capable of playing Chroma animations and haptics on the Razer Sensa HD Haptics devices. SetEventName() can trigger AI interaction, RGB lighting, or haptics or all of the above.

image-8

Downloads

SDKs

  • WYVRN SDK
EngineGit RepoDownload LinkGit RepoDownload LinkGit RepoDownload Link
EncodingUNICODEASCIIMULTI-BYTE
WYVRN Design TemplateGitDownload
WYVRN C++ SDKGitDownloadGitDownloadGitDownload
WYVRN Unreal SDKGitDownload
WYVRN Unity SDKGitDownload

Event names can follow a naming convention which assists with the generation of the event configuration for your title. Event names are specified with the SetEventName() method. The event name suffix can be left off or used to prepopulate common settings for _ON, _OFF, and _MERGE.

  • "Jump" - (without a suffix) Existing haptics stop, the named haptic plays to completion and then ends

  • "Attack_ON" - Existing haptics continue to play, the named haptic plays as a continuous looping haptic

  • "Attack_OFF" - Existing haptics continue to play, the named looping haptic stops

  • "Punch_MERGE" - Existing haptics continue to play, the named haptic plays to completion and ends

  • "Block_MERGE" - Existing haptics continue to play, the named haptic plays to completion and ends

Upon completion of event implementation, the list of Chroma events and game triggers should be shared with the team for QA to verify they execute as expected.

Targeting features can be optionally described for each haptics effect.

Namespace

Add the WYVRN SDK namespace to use the API.

using WyvrnSDK;

API Class

The WyvrnAPI class provides a wrapper for the WYVRN SDK Library.

Initialize SDK

Initialize the WYVRN SDK in order to utilize the API. The InitSDK method takes an AppInfo parameter which defines the application or game details that will appear in Synapse and the Chroma App within the Chroma Apps tab. The expected return result should be RZRESULT_SUCCESS which indicates the API is ready for use. If a non-success result is returned, the WYVRN implementation should be disabled until the next time the application or game is launched. Reasons for failure are likely to be the user does not have the Synapse or the Chroma App installed. After successfully initializing the WYVRN SDK, wait approximately 100 ms before setting events.

image-5

private int _mResult = 0;

public IEnumerator Start()
{
if (!WyvrnAPI.IsWyvrnSDKAvailable())
{
_mResult = RazerErrors.RZRESULT_DLL_NOT_FOUND;
yield break;
}

WyvrnSDK.APPINFOTYPE appInfo = new APPINFOTYPE();
appInfo.Title = "Razer WYVRN Unity Game Sample Application";
appInfo.Description = "A sample application using Razer WYVRN SDK";

appInfo.Author_Name = "Razer";
appInfo.Author_Contact = "https://WYVRN.com";

// 0x01 | // Utility. (To specifiy this is an utility application)
// 0x02 // Game. (To specifiy this is a game);
appInfo.Category = 1;

_mResult = WyvrnAPI.CoreInitSDK(ref appInfo);
if (_mResult == RazerErrors.RZRESULT_SUCCESS)
{
// Init Success! Ready to use the WYVRN SDK!
}
else
{
// Init Failed! Stop using the WYVRN SDK until the next game launch!";
}
}

Set Event Name

Game events can be named to add supplemental technology to your lighting experience. By naming game events and game triggers, the event name can be used as a lookup to do things for AI, Chroma, and haptics. SetEventName("Jump") could be used to play a Chroma animation for the jump game event. The Jump event can also use A corresponding haptic effect to enhance emersion for the title. No other APIs are required to add Chroma and haptics other than to invoke SetEventName(). Some game events can have lighting or haptics or both. It just depends on the game design to create an experience that makes sense.

if (_mResult == RazerErrors.RZRESULT_SUCCESS)
{
// Trigger AI, Chroma, and haptics
int result = WyvrnAPI.CoreSetEventName("Jump");
if (result == RZRESULT_SUCCESS)
{
// Event named successfully!"
}
else
{
// Unable to set event name. Unexpected result!"
}
}

Uninitialize SDK

Applications should uninitialize the WYVRN SDK with Uninit() for a clean exit. Uninitialization is only needed if the WYVRN SDK was successfully initialized. The expected successful return result should be RZRESULT_SUCCESS.

if (_mResult == RazerErrors.RZRESULT_SUCCESS)
{
int result = WyvrnAPI.CoreUnInit();
if (result == RazerErrors.RZRESULT_SUCCESS)
{
// WYVRN has been uninitialized!
}
else
{
// WYVRN uninitialization was unsuccessful!
}
}

Getting Started

Frameworks supported

  • Windows WyvrnSDK (32-bit)

  • Windows WyvrnSDK (64-bit)


Assets

A game uses SetEventName to name game triggers. No other assets need to be included in the game to add haptics and lighting effects. Playback is controlled from the external Events.config for the named events.


Full API

WYVRN SDK Library Methods:

PluginCoreInitSDK

Direct access to low level API.

// DLL Interface
EXPORT_API RZRESULT PluginCoreInitSDK(
ChromaSDK::APPINFOTYPE* AppInfo);

// Class Plugin
int result = WyvrnAPI.CoreInitSDK(ref appInfo);

PluginCoreSetEventName

Direct access to low level API.

// DLL Interface
EXPORT_API RZRESULT PluginCoreSetEventName(LPCTSTR Name);

// Class Plugin
int result = WyvrnAPI.CoreSetEventName("Effect1");

PluginCoreUnInit

Direct access to low level API.

// DLL Interface
EXPORT_API RZRESULT PluginCoreUnInit();

// Class Plugin
int result = WyvrnAPI.CoreUnInit();