@rbxts/yetanothernet
v0.10.0-alpha.2
Published
A Networking Library, inspired by BridgeNet2 & Bevy_Renet, made for ECS.
Downloads
16
Readme
Quick Start
- Documentation
- Basic Use
- To-do
- Getting Started
- Setup Guides
- Support & Contribution
- Installation
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
- [ ] Flamework Binary Serializer 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 YetAnotherNet = require("@packages/YetAnotherNet")
local Route = YetAnotherNet.Route
type Route<U...> = YetAnotherNet.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("@shared/routes")
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
Discord
We have a Project Thread in the Roblox OSS Community Server, please read the Code of Conduct on that link before joining. You can find the Project thread under the #Projects threads channel titled as "YetAnotherNet," or you can follow 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.
Please also be patient when awaiting a response in the thread, I will get to it when I can.
Contributing
See the CONTRIBUTING.md file for a detailed guide on contributing. If you need any assistance, don't hesitate to ping me in the project thread or on GitHub.
Installation
Wally
Add YetAnotherNet to your project with Wally by adding the following to your wally.toml
file:
[dependencies]
YetAnotherNet = "yetanotherclown/[email protected]"
[!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:
./scripts/build.sh
For more help, check out the Rojo documentation.
Derived Works
The Darklua setup and Github Workflows are inspired and built off of the work of grilme99's roblox-project-template.