SNET – a networking interface for Lua over UDP

A Lua networking module that grew out of the SL:MP multiplayer: UDP with delivery acknowledgement and packet priorities.

Author: Project: 2020Updated: 1 min read

SNET is a Lua networking module that runs over UDP via LuaSocket. I published a guide to it on BLAST.HK on September 24, 2020. The library grew out of the networking code of the SL:MP multiplayer.

SNET logo
SNET logo from the BLAST.HK guide

What it adds to UDP

UDP is fast but guarantees nothing: packets get lost or arrive out of order. A game needs low latency, but it can't afford to lose key events either. So SNET has delivery acknowledgement for important packets and priorities: some data can go "best effort", other data has to arrive. The library itself puts no limit on the number of clients.

Where it runs

  • LuaJIT on Windows and Linux, for servers;
  • MoonLoader, for client scripts in GTA: San Andreas.

The protocol is the same on the client and the server, so you can write a network mod entirely in Lua, whether it's a chat, player sync or a multiplayer of your own.

Ports

The community made a Node.js port (node-snet), and there was also an experimental Go port.

Frequently asked questions

How is SNET related to SL:MP?

SNET grew out of the networking part of the SL:MP multiplayer – in the project description, SL:MP is explicitly named as the predecessor of SNET.

Are there ports of SNET to other languages?

Yes, the community made a Node.js port (node-snet), and there was also an experimental Go port.