Jolt | A high-performance, type-safe, and developer-friendly networking library for Roblox

Jolt

Networking library for Roblox that serializes data into binary buffers and batches transmissions per frame.


What It Does

  • Binary serialization: Encodes Luau values (numbers, strings, vectors, CFrames, etc.) into compact binary buffers instead of relying on Roblox’s default serialization.
  • Per-frame batching: Accumulates all :Fire() calls during a frame and sends them in a single packet on RunService.Heartbeat.
  • Channel hashing: Channel names are hashed to 16-bit integers (FNV-1a) to reduce packet header size.
  • Two-way invocations: :Invoke() provides request-response semantics with a 30-second timeout.
  • Typed API: Fully typed in Luau with --!strict and generic type parameters.

Installation

Wally

[dependencies]
Jolt = "toriumslurs/jolt@4.4.1"

Manual

Place the Jolt folder inside ReplicatedStorage and require it:

local Jolt = require(game.ReplicatedStorage.Jolt)

API

Server

local channel = Jolt.Server("ChannelName")
Method Description
channel:Fire(player, ...) Send reliable event to a player
channel:FireUnreliable(player, ...) Send unreliable event to a player
channel:FireAll(...) Broadcast reliable event to all players
channel:FireAllUnreliable(...) Broadcast unreliable event to all players
channel:FireExcept(player, ...) Broadcast to all players except one
channel:FireList(players, ...) Send to a list of players
channel:Invoke(player, ...): ... Request-response to a client (yields, 30s timeout)
channel:Connect(callback): Connection Listen for client events
channel:Once(callback): Connection Listen for one event then disconnect
channel:Wait(): (Player, ...) Yield until next event
channel:Destroy() Tear down the channel
channel.OnInvoke = function(player, ...): ... Handler for client invocations

Client

local channel = Jolt.Client("ChannelName")
Method Description
channel:Fire(...) Send reliable event to server
channel:FireUnreliable(...) Send unreliable event to server
channel:Invoke(...): ... Request-response to server (yields, 30s timeout)
channel:Connect(callback): Connection Listen for server events
channel:Once(callback): Connection Listen for one event then disconnect
channel:Wait(): ... Yield until next event
channel:Destroy() Tear down the channel
channel.OnInvoke = function(...): ... Handler for server invocations

Connection

Member Description
connection:Disconnect() Stop listening
connection.Connected Whether the connection is active

Examples

Events

-- Server
local Jolt = require(game:GetService("ReplicatedStorage").Jolt)
local Combat = Jolt.Server("Combat")

Combat:Connect(function(player, targetId, attackType)
    print(player.Name, "attacked", targetId, "with", attackType)
    Combat:FireExcept(player, targetId, attackType)
end)

-- Client
local Jolt = require(game:GetService("ReplicatedStorage").Jolt)
local Combat = Jolt.Client("Combat")

Combat:Connect(function(targetId, attackType)
    print("Attack:", targetId, attackType)
end)

Combat:Fire("Enemy_123", "Slash")

Invocations

-- Server
local Inventory = Jolt.Server("Inventory")
Inventory.OnInvoke = function(player, itemId, amount)
    -- validate and process
    return true, 150
end

-- Client
local Inventory = Jolt.Client("Inventory")
local success, balance = Inventory:Invoke("Potion_Health", 2)

Typed Channels

type Payload = { entityId: number, position: Vector3, velocity: Vector3 }

-- Server
local Positions = Jolt.Server("Positions") :: Jolt.Server<Payload>
Positions:FireAll({ entityId = 1, position = Vector3.new(0, 5, 0), velocity = Vector3.zero })

-- Client
local Positions = Jolt.Client("Positions") :: Jolt.Client<Payload>
Positions:Connect(function(data)
    print(data.entityId, data.position)
end)

Supported Types

Category Types
Primitives nil, boolean, number (auto-selects integer/float width), string, buffer
Vectors & Spatial Vector2, Vector2int16, Vector3, Vector3int16, CFrame, Ray, Rect, Region3, Region3int16
Roblox Objects Instance, EnumItem, BrickColor, Color3, ColorSequence, NumberRange, NumberSequence, DateTime, TweenInfo, UDim, UDim2
Collections Arrays, dictionaries, and homogeneous typed arrays (integers, floats, booleans, strings, vectors, colors, CFrames)

Numbers are automatically compressed to the smallest representation that fits (u8, i16, f32, etc.). Booleans in arrays are bitpacked (8 per byte).


Limits

Limit Value What happens
Max buffer size 256 KB Packet dropped
Max arguments per packet 64 Packet dropped
Max pending invocations 128 per target Error thrown
Max serialization depth 16 levels Serialization stops
Invocation timeout 30 seconds Yields resume with error
Max instances per packet 256 Non-Instance values stripped; surplus dropped
72 Likes

This is cool, but I keep seeing networking libraries

Will you benchmark this library against other popular alternatives?

7 Likes

Most probably when it’s in a better state! Right now im looking for help with this. Feel free to create pull requests and create issues on the github page.

3 Likes

I have added benchmark screenshots to the post. I will benchmark it against other networking libraries sooner or later.

2 Likes

Would you like to suggest which networking libraries?

1 Like

Hi, i noticed most of the network usage optimizations of this module come from packet batching which is a very easy thing to implement, literally just an array.

The buffer serde itself contributes a much smaller amount of network usage improvement compared to packet batching

This is because you are using schemaless buffer serde which results in roughly the same byte size as what Roblox serdes values by default

Im wondering whats the usecase behind having a buffer serde like this other than the 1% of cases where you are running insanely tight network loops where every byte matters? Most of us only send maybe a packet or few a frame max and the buffer serde doesn’t really do anything to optimize that further aside from making Jolt less lightweight

4 Likes

Do you plan on publishing to wally.

1 Like

Holy ChatGPT
Why do you need all the components? Bruh
Just save position and rotation

Just make it a separate serializer. I don’t understand the point of all these “network libraries” when it’s a serializer slapped on top of bloated abstractions.

Anyway, all these libraries kill the entire point of what performance is; you must hardcode everything, or else it’s a placebo.

6 Likes

Thank you all for your feedback. I will continiously work to make this networking library better. Expect a new patch today!

2 Likes

Yes im planning to do so in the near future.

Jolt v1.1.0 is now live!

This update brings expanded features, improved stability, and better overall performance.
You can download the latest release here: v1.1.0 or Jolt.rbxm (9.3 KB)

Check it out and let me know what you think!

1 Like

Can you make this usable for Bind-Ables As Well? also is this one of those types of module that only creates a instance of a event only when it needs to be fired? therefor it doesn’t take up alot of server or client memory?

@ToriumSlurs Can you fix this problem that @Yarik_superpro pointed out? I have never used any type of networking library in my life so far and if this one wants to be the first then it needs to maintain the point of improving performance

2 Likes

If you really take performance seriously you don’t need networking library since they have own overhead
You need to serialize everything manually and put them into buffers alghoritmically
That sounds more complex than it really is honestly

4 Likes

A new event is created for each new id you provide to the Jolt.Server(). In the future im planning for jolt to only use two remotevents for everything, an reliable one and an unreliable one.

This issue has been fixed in v1.1.0. Now writing the cframe uses ToAxisAngle to further slim down down the size

How would that work if alot of different events are being sent from server to client or client to server?

one event would handle all data and act as if its a separate remotevent but it really isnt

1 Like

Creating a new remotevent for each new id (current behavior) shouldnt be too heavy on the memory

it would be awesome to see jolt compared with bytenet, as that’s what i’ve been using for a while.

3 Likes