Forest Logo
search
package_2

weave

By @nazumahk

Roblox

Mirrored

Weave

A high-performance, strictly-typed game framework for Roblox featuring Contract-based binary networking via ByteFlow 2.1.

Features

  • Contract-Based Networking: Define your communication interface in a shared module. Weave handles the serialization, routing, and type-safety based on this contract.
  • Auto Bit-Packing: Powered by ByteFlow 2.1. Consecutive bool fields within a struct are automatically packed into single bytes, reducing bandwidth consumption by up to 800% for state flags.
  • Lazy Service Proxies: GetService returns a transparent proxy that dynamically binds to its service upon registration. This eliminates "Service not found" errors during the client boot sequence.
  • Transactional Writes: Packets are written atomically. If a write fails, the buffer cursor is rolled back to prevent corruption of the global packet stream.
  • Unified Lifecycle Hooks: Services and Controllers can implement OnHeartbeat, OnStepped, and OnRenderStepped directly, reducing manual RunService connection boilerplate.
  • Deterministic ID Generation: Alphabetical sorting and FNV-1a hashing of contract members ensure perfect parity between server and client without manual IDs.

Installation

Add to your wally.toml:

[dependencies]
Weave = "nazumahk/weave@1.3.0"

Quick Start

1. The Contract (Shared/EnemyContract.luau)

local Weave = require(Packages.Weave)
local t = Weave.t

return function()
    return {
        -- Automatically packed into 1 byte
        UpdateState = Weave.Signal(t.struct({
            isStunned = t.bool,
            isBurning = t.bool,
            isFrozen = t.bool,
            isSlowed = t.bool,
        })),
        GetEnemyCount = Weave.Method({ request = t.none, response = t.uint16 })
    }
end

2. Server Implementation

local EnemyContract = require(Shared.EnemyContract)
local EnemyService = Weave.CreateService({
    Name = "EnemyService",
    Client = EnemyContract()
})

function EnemyService:OnHeartbeat(dt)
    -- Automated heartbeat logic
end

function EnemyService.Client.GetEnemyCount:onInvoke(function()
    return #allEnemies
end)

3. Client Consumption

local EnemyController = Weave.CreateController({ Name = "EnemyController" })

function EnemyController:WeaveStart()
    -- Lazy proxy: resolvable even if the service module is required later
    local EnemyService = Weave.GetService("EnemyService")
    
    -- Methods can be called directly as functions
    local count = EnemyService.GetEnemyCount()
    
    EnemyService.UpdateState:Connect(function(state)
        print("Updated state:", state)
    end)
end

Documentation

  • Why Use Weave? -- Benefits and Comparison
  • Technical Architecture -- Internal Design & Bit-Packing
  • API Reference -- Full Method Specification

License

MIT

Package Details

Install command (Click to copy)


Version

1.3.0

License

MIT

check_circle

Safe for commercial use

Automated license review — not legal advice.