Sockets specification
Sockets are currently available with Windows and Mac support only. Linux coming soon.
You can use https://github.com/RLBot/RLBot/tree/master/src/main/cpp/RLBotInterface/src as a reference implementation in c++.
Data Format
Unless otherwise specified, data is sent and received on the socket in this format:
- First two bytes are an integer (big-endian) which specifies the data type (see list below).
- Next two bytes are an integer (big endian) which specifies the number of bytes in the payload.
- Remaining bytes are a payload. The logic for parsing it will depend on the data type, but generally it will be binary data in flatbuffer format. Using tools provided by Google (i.e. flatc.exe) and rlbot.fbs you can auto-generate code in various languages suitable for writing / parsing the payload data.
Data Types
Types expected to flow from RLBot to the client are in bold. Some are bi-directional.
- Game tick packet (arrives at a high rate according to /Tick-Rate except "desired tick rate" is not relevant here)
- Field info (sent once when a match starts, or when you first connect)
- Match settings (sent once when a match starts, or when you first connect)
- Player input
- Actor mapping data (deprecated, related to Remote RLBot)
- Computer id (deprecated, related to Remote RLBot)
- Desired game state
- Render group
- Quick chat
- Ball prediction (sent every time the ball diverges from the previous prediction, or when the previous prediction no longer gives a full 6 seconds into the future).
- Ready Message (clients must send this after connecting to the socket)
- Message Packet: List of messages, having one of the following types:
- PlayerStatEvent - Event when a player performs an action or earns an accolade recognized in statistics, e.g. BicycleHit, HatTrick, MostBoostPickups.
- PlayerSpectate - Spectator camera is now focusing on a new player.
- PlayerInputChange - Human or bot has touched their controller, e.g. turned on boost, changed steering, etc.
RLBot v5
- None
- Aka the disconnect request.
- GameTickPacket
- Received by sessions at a high rate according to tick rate (except "desired tick rate" is always 120hz in v5)
- FieldInfo
- Received by a session after it sends
ConnectionSettings
.
- Received by a session after it sends
- StartCommand
- Starts a new match after reading the given config file.
- MatchSettings
- Received by a session after it sends
ConnectionSettings
. - Can be sent by sessions to start a new match.
- Received by a session after it sends
- PlayerInput
- Sent by sessions to control their cars.
- DesiredGameState
- Sent by sessions to change the game state.
- Ignored if state setting was disabled in the match settings.
- RenderGroup
- Sent by sessions to render lines & text in the game.
- Ignored if render setting was disabled in the match settings.
- RemoveRenderGroup
- Sent by sessions to remove a render group.
- Ignored if render setting was disabled in the match settings.
- MatchComm
- A copy is received by sessions when another session sends the message.
- Messages may not be received if the message was filtered due to
team_only
being requested in the message. - Only received if enabled in
ConnectionSettings
.
- BallPrediction
- Received by sessions right before every
GameTickPacket
if enabled inConnectionSettings
.
- Received by sessions right before every
- ConnectionSettings
- Sessions send this immediately after connecting.
- Tells the server what kind of data it wants to receive.
- StopCommand
- Ends the current match, and optionally tells
RLBotServer.exe
to shut itself down.
- Ends the current match, and optionally tells
- SetLoadout
- Sent by sessions to change the loadout of their cars.
- Will always work if a loadout was not specified in match settings and when sent before
InitComplete
. - Ignored if state setting was disabled in the match settings, and a loadout was set in match settings.
- InitComplete
- Indicates that the session has finished all initialization and is ready to start receiving game messages without delay.
- The match will not start until all sessions have sent this message.
SpawnId
will be used to set the name of the session in RLBot's performance monitor and when filtering messages. Hiveminds should simply send the first spawn id they received from the framework.
Connecting
Prerequisites (handled automatically by RLBotGUI / the RLBot framework):
- Rocket League must be running under the
-rlbot
flag. -
RLBot.exe must be running. After it successfully connects to Rocket League, it will start listening on TCP port 23234.
-
As a client, connect to TCP port 23234. Note: please expect to receive the port as a parameter in the future rather than hard coding
- Send a 'ready' message, as defined here. Be sure to use the data format explained above (two bytes for data type, two bytes for size...)
Some attributes in the ready message are not used yet. Once you're connected, you will start receiving data on the socket, with one of the data types specified above.
Sending Data
Send data to the same TCP socket, using the same format (two bytes for type, two bytes for size). You can send match settings (starts a new match), player input, desired game state, render group, and quick chat.
Consult google.github.io/flatbuffers to learn how to construct the byte array for your payload in the language of your choice.
Client Libraries
Python
Who's Using Sockets
- The core RLBot framework uses sockets from Python to start matches.
- The core RLBot framework uses sockets from within RLBotInterface.dll to run bots.
- Javascript / Typescript: easyrlbot
- RLBotControllerOverlay
- This little test script