ACSP - Assetto Corsa Server Protocol
Uses the UDP Plugin feature of Assetto Corsa v1.2+ to get realtime reports on car positions, collisions, lap times and more...
Install
npm install acsp
Usage
var ACSP = ; var a = ; // listen for car_info eventsa; // request car_info for car #0a; // getCarInfo() also returns a Promisea
Events
car_info
sent in response to a.getCarInfo()
callnew_session
triggered when a new session startsend_session
triggered when a session ends (see note below)collide_env
triggered when a car collides with the environmentcollide_car
triggered when a car collides with another carcar_update
triggered everyx
milliseconds after calling.enableRealtimeReport(x)
new_connection
a new driver has connectedconnection_closed
a driver has disconnectedlap_completed
a car has completed a lap
Note: ACServer must be able to write to the ./results
path (relative to ACserver.exe) in order for ACSP to emit this event. This directory does not exist by default - so you will need to create it! (This is an Assetto Corsa bug)
Methods
.getCarInfo(car_id)
request car_info for car_id.enableRealtimeReport(ms)
request realtime car updates everyms
milliseconds.sendChat(car_id, msg)
send a chat messagemsg
to drivercar_id
.broadcastChat(msg)
send a chat messagemsg
to all connected drivers