ACSM v2 is entirely compatible with the original Kunos UDP plugin implementations, so most existing plugins should work.
If you want to write your own plugin for ACSM, the additions to the plugin protocol have been documented below.
You can find many examples of the acServer UDP plugin protocol on the web, such as:
For brevity, only the changes/improvements added to ACSM v2 will be listed here.
Plugins (including built in plugin support for Real Penalty, sTracker and KissMyRank) must be enabled in the config.yml
by setting disable_plugins
to false
.
Custom Plugins can be configured in the config.yml
file of Server Manager, in the plugins
section. They will be started on server start, and stopped on server stop. More details about this can be found in the comments above the plugins
section.
An example plugin configuration is included below for reference.
plugins:
# runs the command '/my/cool/plugin/path/run.sh --some-opt config.json'
- executable: /my/cool/plugin/path/run.sh
arguments: ["--some-opt", "config.json"]
Your plugin can send these messages to the server.
To receive the new messages added to ACSM, you must first send a message to the UDP plugin requesting 'enhanced reporting'
to be enabled. This message only needs to be sent once per plugin run.
The main protocol is the same as the acServer implementation, but with a new message as follows:
{
uint8 messageType; // to enable enhanced reporting, send a uint8 with value '210'.
}
The server will then output "UDP Plugin: Enhanced reporting is enabled" to the log.
You will then start to receive the extra messages listed below.
Doesn't require 'Enable Enhanced Reporting'
{
uint8 messageType; // to request the Ping event, send a uint8 with value '211'.
int64 pluginTime; // time that the plugin sent the Request Ping event (unix milliseconds)
}
The server will send these messages to your plugin.
Sent on every sector/split complete. Message format is as follows:
{
uint8 messageType; // always 150 for sector complete messages
uint8 carID; // car ID of car that completed the sector
uint8 sectorIndex; // sector index just completed (indexed from 0)
uint32 sectorTime; // the time it took the car to complete the split
uint8 numCuts; // the number of cuts in the sector
}
Sent every time a car changes tyre. Note that when cars go into the pits, the game reports
tyre changes even if the user did not request a tyre change nor change their tyre.
{
uint8 messageType; // always 151 for tyre change messages
uint8 carID; // car ID of car that changed tyre
string currentTyre; // the current tyre that the car changed to. string == uint8 specifying the length, followed by the byte encoded string.
}
Sent whenever Request Ping is received.
Doesn't require 'Enable Enhanced Reporting'
{
uint8 messageType; // always 152 for ping messages
int64 pluginTime; // time that the plugin sent the Request Ping event (unix milliseconds), returned without modification
int64 serverTime; // server time on receipt of the Request Ping event (unix milliseconds)
}