Skip to content

Implement direct vehicle socket#245

Draft
stefan750 wants to merge 1 commit into
BeamMP:masterfrom
stefan750:direct-vehicle-socket
Draft

Implement direct vehicle socket#245
stefan750 wants to merge 1 commit into
BeamMP:masterfrom
stefan750:direct-vehicle-socket

Conversation

@stefan750
Copy link
Copy Markdown

Allows multiple individual VE Lua instances to connect directly to the launcher through a single UDP socket.
This skips having to queue data between VE and GE Lua reducing latency and processing needed on the Lua side.

Requires changes on the Lua side as well to make use of the new feature, but is fully backward compatible with the existing Lua mod.

How it works:

  1. Vehicles need to be registered before any data will be accepted over the direct VE socket. This can be done using V packets and the serverVehicleID in CoreNetwork. A Va packet will register a vehicle, and a Vd packet will unregister it. e.g. Va:0-0 registers a vehicle, and Vd:0-0 unregisters it.
  2. Any data sent to the direct VE socket needs to contain a registered serverVehicleID to be valid. After the first valid packet is received from a vehicle, the port the packet was sent from is saved and the vehicle is considered connected.
  3. Any data that is received from the vehicle socket will be sent to the server as normal, provided the serverVehicleID in the packet matches the one registered for that port. All vehicle specific data received from the server for a connected vehicle will be redirected to its direct socket connection.
  4. If a vehicle is not fully connected, the data will be sent over GameNetwork as normal.

This started out as a proof of concept, but initial testing showed very promising results, especially with high amounts of vehicles.


By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.

Allows multiple individual VE Lua instances to connect directly to the launcher through a single UDP socket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant