This is a mod for SynthRiders. It allows you to connect to the websocket server and receive updates about the game.
To install you need to either download a release, or build the mod yourself.
- Download the latest release from GitHub
- Extract the zip file
- Copy the dlls to your SynthRiders MelonLoader Mods folder (typically a folder called
Mods
in your SynthRiders installation. If you see a text file named "PLACE MODS HERE.txt", you're in the right place.)
- Clone the repository
- Inside visual studio, open
/src
as the project - Build the project
- The resulting dll will be in
/src/bin/Debug/
asSynthRidersWebsockets.dll
- Copy the dll to your SynthRiders MelonLoader Mods folder
- Copy
websocket-sharp.dll
to the Mods folder
- Host: The hostname of the websocket server
- Port: The port of the websocket server
Connect to the websocket server; the server will send updates about the game. By default, the websocket host will run at ws://localhost:9000
. Host and Port can be configured in the MelonPreferences.cfg file if an alternate config is required (e.g. for 2 PC stream setups)
All events are JSON and follow this general structure:
{ "eventType": "EventType", "data": {} }
Emitted when the map begins playing.
{
"eventType": "SongStart",
"data": {
"song": "2 Phut Hon (Kaiz Remix)",
"difficulty": "Master",
"author": "Phao",
"beatMapper": "ICHDerHorst",
"length": 191.857,
"bpm": 128.0,
"albumArt": ""
}
}
song
- Song titledifficulty
- Song difficultyauthor
- Song artist/authorbeatMapper
- Map creatorlength
- Song length in secondsbpm
- Song beats per minutealbumArt
- If album art is available, this contains a data url containing a base64-encoded PNG image. (You can use this URL as-is in a web browser or browser source to display the image). Otherwise it's an empty string.
Emitted as the last note of the map is completed.
{
"eventType": "SongEnd",
"data": {
"song": "2 Phut Hon (Kaiz Remix)",
"perfect": 350,
"normal": 126,
"bad": 281,
"fail": 2,
"highestCombo": 482
}
}
song
- Song titleperfect
- Number of perfect hitsnormal
- Number of normal hitsbad
- Number of bad hitsfail
- Number of failed hitshighestCombo
- Highest number of consecutive hits during song
Emitted once per second when the song is playing.
{
"eventType": "PlayTime",
"data": {
"playTimeMS": 19662.48
}
}
playTimeMS
- Current play time position, in milliseconds.
Emitted on every note hit successfully
{
"eventType": "NoteHit",
"data": {
"score": 938,
"combo": 1,
"multiplier": 1,
"completed": 1.0,
"lifeBarPercent": 1.0,
"playTimeMS": 19662.48
}
}
score
- Total score after the note is hitcombo
- Number of consecutive hits made so far. This resets after a note miss.multiplier
- Current score multiplier. Runs from 1 to 6.completed
- Running total of all notes hit (perfect + normal + bad, no fails)lifeBarPercent
- A number between 0 and 1 indicating life bar percentage.playTimeMS
- Current play time position, in milliseconds.
{
"eventType": "NoteMiss",
"data": {
"multiplier": 2,
"lifeBarPercent": 0.8333333,
"playTimeMS": 19662.48
}
}
multiplier
- Score multiplier before this miss resets it.lifeBarPercent
- A number between 0 and 1 indicating life bar percentage.playTimeMS
- Current play time position, in milliseconds.
{
"eventType": "EnterSpecial",
"data": {}
}
{
"eventType":"CompleteSpecial",
"data": {}
}
{
"eventType": "FailSpecial",
"data": {}
}
Emitted when changing 'scenes'. For example, changing to game play, summary, main menu, etc.
Some scene names of interest:
3.GameEnd
- The summary scene after successfully completing a map where it shows your score, accuracy, etc.
{
"eventType": "SceneChange",
"data": {
"sceneName": "3.GameEnd"
}
}
sceneName
- Name of scene being entered
Emitted when the user selects the "Return to Menu" button on the game pause screen.
{
"eventType": "ReturnToMenu",
"data": {}
}
To easily consume these events from another Synth Riders mod:
- Target .NET 4.8 to match this project
- Add a Reference to SynthRidersWebsockets.dll
- Implement the ISynthRidersEventHandler interface
- Create a new
SynthRidersEventsManager
afterAwake()
is called (to make sure the socket is created before connecting)
See SRPerformanceMeter as an example implementation.