Skip to content
/ naia Public

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt
Notifications You must be signed in to change notification settings

naia-lib/naia

Repository files navigation

Build Status Latest Version API Documentation Discord chat MIT/Apache

naia

a networking architecture for interactive applications

A cross-platform (including Wasm!) networking engine that intends to make multiplayer game development in Rust dead simple and lightning fast.

naia helps you to easily define a common, shared Protocol that allows Server & Client to exchange information. Then, naia facilitates sending/receiving parts of that Protocol as reliable/unreliable Messages between Server & Client, and also keeps a pool of tracked Entities synced with each Client for whom they are "in-scope". Entities are "scoped" to Clients with whom they share the same Room, as well as being sufficiently customizable to, for example, only keep Entities persisted & synced while within a Client's viewport or according to some other criteria.

It is built on top of naia-socket, which provides a cross-platform unreliable & unordered transport layer.

The API is heavily inspired by the Nengi.js & Colyseus Javascript multiplayer networking libraries. The internals follow the Tribes 2 Networking model fairly closely.

Thank very much to Kyren for support & webrtc-unreliable, and to the Laminar authors, for the cannibalized code within.

Any help is very welcome, please get in touch! I'm still very new to Rust and this project is overly ambitious, and so I intend to be very open to any criticism / feedback in order to better this project.

Currently guaranteed to work on Web & Linux, although Windows & MacOS have been reported working as well. Please file issues if you find inconsistencies and I'll do what I can.

Demos

More comprehensive documentation / tutorials are on their way, but for now, the best way to get started with naia is to go through the basic demo, which demonstrates most of the functionality.

Server:

To run the UDP server demo on Linux: (that will be able to communicate with Linux clients)

1. cd /naia/demos/basic/server
2. cargo run --features "use-udp"

To run the WebRTC server demo on Linux: (that will be able to communicate with Web clients)

1. cd /naia/demos/basic/server
2. cargo run --features "use-webrtc"

Client:

To run the UDP client demo on Linux: (that will be able to communicate with a UDP server)

1. cd /naia/demos/basic/client/wasm_bindgen
2. cargo run

To run the WebRTC client demo on Web: (that will be able to communicate with a WebRTC server)

1. cargo install cargo-web  // should only need to do this once if you haven't already
2. Enter in your IP Address at the appropriate spot in /demos/basic/shared/src/lib.rs
3. cd /naia/demos/basic/client/wasm_bindgen
4. npm install              // should only need to do this once to install dependencies
5. npm run start            // this will open a web browser, and hot reload
6. Web page will be blank - check debug console to see communications from the server

About

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.txt
MIT
LICENSE-MIT.txt

Stars

Watchers

Forks

Sponsor this project