Usage
Kernel does the work. Dispatcher decides how.
Workers use the kernel to declare what they can do. The dispatcher decides when and how many threads to run. weave handles batching, routing, and result aggregation for you.
local kernel = weave.kernel.new(actor)
-- register a handler that returns results
kernel:On("sweep", function(id)
return workspace:Raycast(
origins[id], directions[id]
)
end)
-- register a fire-and-forget handler
kernel:OnDetached("update", function(id)
simulateParticle(id, dt)
end)
kernel:Ready()
local dispatcher = weave.dispatcher.new(
16, script.Parent.worker
)
-- results collected, callback fires when done
dispatcher:Dispatch("sweep", 10000,
function(buf)
processSweepResults(buf)
end
)
-- no callback, no allocation, no waiting
dispatcher:DispatchDetached("update", 10000)
Why weave
Parallelism, but we took the headache out of it
No Frame Drops
Your game loop keeps rendering and simulating while workers crunch in the background. You get to keep the frame budget for smoother gameplay.
Fire and Forget
Use DispatchDetached when you only care about side effects: terrain writes, physics updates, state mutations. No result buffer allocated, no callback, no overhead.
Optimal Routing
Batching and work distribution are handled automatically. Add more actors and the same dispatch call spreads thinner slices across more cores.
Minimal Setup
Register handlers with :On or :OnDetached, call :Ready, and weave wires everything else. No boilerplate, no manual actor management.