@rbxts/yetanothernet
TypeScript icon, indicating that this package has built-in type declarations

0.8.0 • Public • Published
YetAnotherNet — A Data-Driven Networking Library, inspired by Bevy_Renet & BridgeNet2, made for ECS.

Quick Start

About

YetAnotherNet is a Networking Library for Roblox, which wraps around Roblox's RemoteEvents to improve developer experience, offer efficient networking, and provide other tools, utilities, and features relating to Networking on Roblox.

Features

  • Hassle-free Buffer Compression
  • Complete Typechecking & Intellisense
  • No Overhead from RemoteEvents
  • Ordered Networking
  • Middleware
  • Data-Driven Design
  • Simple Integration & API
  • Hot-reloading Support with Rewire

Data-driven by design

One thing that separates YetAnotherNet from other networking libraries on Roblox is this key design choice. YetAnotherNet was made to work with ECS, a Data-driven approach to game design, which has influenced the design of the library largely and makes it unique from the rest.

With inspiration from Bevy_Renet, a Networking crate for use with the Bevy ECS in Rust, and another networking library on Roblox, BridgeNet2, YetAnotherNet pushes to provide similar functionality to these two libraries for ECS on Roblox.

Why go for Data-Driven Design?

Data-driven design opposes Event-driven design, which is what you can commonly see on Roblox, such as RemoteEvents themselves. Event-driven design has it's woes, which is why we opt for ECS and generally Data-driven design.

Event-driven design is sensitive to ordering, this makes it difficult to know when you might get data from an event. To solve this, YetAnotherNet does not use Events, it encourages you to query and send data in an ordered manner frame-by-frame, preferably with ECS.

Since it's encouraged to use ECS with YetAnotherNet, though not required, we suggest reading Matter — Why ECS? by Evaera.


To-do

Tasks to complete before version 1.0.0 is released.

  • [x] Basic Functionality
  • [x] Stable Core API
  • [x] Strict Typing
  • [x] Unreliable Channel
  • [X] Middleware
  • [X] Typescript Support
  • [X] Automatic Buffer Compression
  • [x] Unit + Integration Tests w/ Jest
  • [ ] Rate limiting
  • [ ] Debugger

Other Tasks

  • [ ] Support more Unsupported Datatypes in internal Ser/Des library
  • [ ] More extensive tests with Jest
  • [ ] Minimal Example
  • [ ] ECR Setup Guide
  • [ ] ECR Example
  • [ ] Docs Page for Technical Details

Basic Usage

[!TIP] See full documentation on How to Use Routes and How to Setup with Matter on the Documentation Site.

Setup

Basic Setup for Routes

local Net = require("Net.luau")

local Route = Net.Route
type Route<U...> = Net.Route<U...>;

-- You can specify the type(s) between the <> for Typechecking + Intellisense
local ExampleRoute: Route<any> = Route.new()

return {
    ExampleRoute = ExampleRoute
}

Example Use

Example of how to use YetAnotherNet in a Matter System

local routes = require("routes.luau")
local ExampleRoute = routes.ExampleOne

local function exampleSystem(world)
    -- Query through every networking call that frame on the Server
    for i, player, ...data in ExampleRoute:query() do
        -- Do something
    end

    -- Query through every networking call that frame on the Client
    for i, _, ...data in ExampleRoute:query() do
        -- Do something
    end

    -- Send data from the Client to the Server
    ExampleRoute:send(...)

    -- Send data to a Client from the Server
    ExampleRoute:send(...):to(Player)
end

Support and Contribution

YetAnotherNet has a project thread in the Roblox OSS Community, which you can join with this invite. You can find our thread using this link.

Please be mindful that the Roblox OSS Community is a professional workspace and not a general help desk, please keep questions and discussions about YetAnotherNet in our Project Thread and keep any other appropriate conversations in their respective channels.

If you find any bugs, feel free to create an Issue or a Pull Request with an appropriate fix. I'm open to conversations about contributions in the Project Thread or in DMs on Discord, you can reach me with @YetAnotherClown!


Installation

Wally

Add YetAnotherNet to your project with Wally by adding the following to your wally.toml file:

[dependencies]
Net = "yetanotherclown/yetanothernet@0.8.0"

[!NOTE] Wally does not export types automatically, if you wish to use Strict Typing with YetAnotherNet, install Wally Package Types with Aftman.

NPM for Roblox Typescript

You can find YetAnotherNet on NPM, or install it with the command line:

npm i @rbxts/yetanothernet

Building

To build yourself with Rojo, use:

rojo build -o "Net.rbxm"

For more help, check out the Rojo documentation.

Readme

Keywords

Package Sidebar

Install

npm i @rbxts/yetanothernet

Weekly Downloads

73

Version

0.8.0

License

MIT

Unpacked Size

95.4 kB

Total Files

43

Last publish

Collaborators

  • yetanotherclown