All Projects → amethyst → Laminar

amethyst / Laminar

Licence: other
A simple semi-reliable UDP protocol for multiplayer games

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Laminar

Enet Csharp
Reliable UDP networking library
Stars: ✭ 464 (-12.45%)
Mutual labels:  gamedev, networking, protocol, udp
Valvesockets Csharp
Managed C# abstraction of GameNetworkingSockets library by Valve Software
Stars: ✭ 273 (-48.49%)
Mutual labels:  gamedev, networking, udp
Quic.net
A .NET C# Implementation of QUIC protocol - Google's experimental transport layer.
Stars: ✭ 173 (-67.36%)
Mutual labels:  networking, protocol, udp
Ngtcp2
ngtcp2 project is an effort to implement IETF QUIC protocol
Stars: ✭ 589 (+11.13%)
Mutual labels:  networking, protocol, udp
Hazel Networking
Hazel Networking is a low level networking library for C# providing connection orientated, message based communication via TCP, UDP and RUDP.
Stars: ✭ 194 (-63.4%)
Mutual labels:  networking, protocol, udp
Anette
Simple haxe network library
Stars: ✭ 35 (-93.4%)
Mutual labels:  gamedev, networking, protocol
Ruffles
Lightweight and fully managed reliable UDP library.
Stars: ✭ 131 (-75.28%)
Mutual labels:  networking, protocol, udp
Netdynamics
Data-oriented networking playground for the reliable UDP transports
Stars: ✭ 65 (-87.74%)
Mutual labels:  gamedev, networking, udp
Enet
⚡️ ENet reliable UDP networking library
Stars: ✭ 202 (-61.89%)
Mutual labels:  gamedev, networking, udp
Libzt
ZeroTier Sockets - Put a network stack in your app
Stars: ✭ 486 (-8.3%)
Mutual labels:  networking, udp
ethereum-dissectors
🔍Wireshark dissectors for Ethereum devp2p protocols
Stars: ✭ 82 (-84.53%)
Mutual labels:  udp, protocol
Wireguard Docs
📖 Unofficial WireGuard Documentation: Setup, Usage, Configuration, and full example setups for VPNs supporting both servers & roaming clients.
Stars: ✭ 3,201 (+503.96%)
Mutual labels:  networking, udp
STUP-Protocol
Secure/Speedup TCP-like UDP protocol
Stars: ✭ 12 (-97.74%)
Mutual labels:  udp, protocol
rmnp
Realtime Multiplayer Networking Protocol
Stars: ✭ 41 (-92.26%)
Mutual labels:  udp, protocol
jfastnet
Fast, reliable UDP messaging for Java. Designed for games.
Stars: ✭ 26 (-95.09%)
Mutual labels:  gamedev, udp
Web Udp Public
Public demand for Web UDP
Stars: ✭ 312 (-41.13%)
Mutual labels:  networking, udp
Exscript
A Python module making Telnet and SSH easy
Stars: ✭ 337 (-36.42%)
Mutual labels:  networking, protocol
kcp-dotnet
KCP dotNet Core implementation
Stars: ✭ 26 (-95.09%)
Mutual labels:  gamedev, udp
Drop watch
Monitor reasons why and where linux drops UDP packets
Stars: ✭ 289 (-45.47%)
Mutual labels:  networking, udp
Game Networking Resources
A Curated List of Game Network Programming Resources
Stars: ✭ 4,208 (+693.96%)
Mutual labels:  gamedev, networking

Laminar

Build Status Latest Version docs.rs Join us on Discord MIT/Apache Lines of Code Coverage

Laminar is an application-level transport protocol which provides configurable reliability and ordering guarantees built on top of UDP. It focuses on fast-paced fps-games and provides a lightweight, message-based interface.

Laminar was designed to be used within the Amethyst game engine but is usable without it.

If you are new to laminar or networking in general, We strongly recommend taking a look at the laminar book

Concepts

This library is loosely based off of Gaffer on Games and shares features similar as RakNet, Steam Socket, netcode.io. The idea is to provide an in rust written, low-level UDP-protocol which supports the use of cases of video games that require multiplayer features. The library itself provides a few low-level types of packets that provide different types of guarantees. The most basic are unreliable and reliable packets. Also ordering, sequencing can be done on multiple streams. For more information, read the projects README.md, book, docs or examples.

Table of contents:

Features

These are the features this crate provides:

  • [x] Fragmentation
  • [x] Unreliable packets
  • [x] Unreliable sequenced packets
  • [x] Reliable unordered packets
  • [x] Reliable ordered packets
  • [x] Reliable sequenced packets
  • [x] Rtt estimations
  • [x] Protocol version monitoring
  • [x] Basic connection management
  • [x] Heartbeat
  • [x] Basic DoS mitigation
  • [x] High Timing control
  • [x] Protocol Versioning
  • [x] Well-tested by integration and unit tests
  • [x] Can be used by multiple threads (Sender, Receiver)

Planned

  • [ ] Handshake Protocol
  • [ ] Advanced Connection Management
  • [ ] Cryptography
  • [ ] Congestion Control

Getting Started

Add the laminar package to your Cargo.toml file.

[dependencies]
laminar = "0.3"

Useful Links

Examples

Please check out our examples for more information.

UDP API | see more

This is an example of how to use the UDP API.

Send packets

use laminar::{Socket, Packet};

// Creates the socket
let mut socket = Socket::bind("127.0.0.1:12345")?;
let packet_sender = socket.get_packet_sender();
// Starts the socket, which will start a poll mechanism to receive and send messages.
let _thread = thread::spawn(move || socket.start_polling());

// Bytes to sent
let bytes = vec![...];

// Creates packets with different reliabilities
let unreliable = Packet::unreliable(destination, bytes);
let reliable = Packet::reliable_unordered(destination, bytes);

// Specifies on which stream and how to order our packets, checkout our book and documentation for more information
let unreliable = Packet::unreliable_sequenced(destination, bytes, Some(1));
let reliable_sequenced = Packet::reliable_sequenced(destination, bytes, Some(2));
let reliable_ordered = Packet::reliable_ordered(destination, bytes, Some(3));

// Sends the created packets
packet_sender.send(unreliable_sequenced).unwrap();
packet_sender.send(reliable).unwrap();
packet_sender.send(unreliable_sequenced).unwrap();
packet_sender.send(reliable_sequenced).unwrap();
packet_sender.send(reliable_ordered).unwrap();

Receive Packets

use laminar::{SocketEvent, Socket};

// Creates the socket
let socket = Socket::bind("127.0.0.1:12346")?;
let event_receiver = socket.get_event_receiver();
// Starts the socket, which will start a poll mechanism to receive and send messages.
let _thread = thread::spawn(move || socket.start_polling());

// Waits until a socket event occurs
let result = event_receiver.recv();

match result {
    Ok(socket_event) => {
        match  socket_event {
            SocketEvent::Packet(packet) => {
                let endpoint: SocketAddr = packet.addr();
                let received_data: &[u8] = packet.payload();
            },
            SocketEvent::Connect(connect_event) => { /* a client connected */ },
            SocketEvent::Timeout(timeout_event) => { /* a client timed out */},
        }
    }
    Err(e) => {
        println!("Something went wrong when receiving, error: {:?}", e);
    }
}

Authors

Notice

This library is not fully stable yet, and there may be breaking changes to the API. For more advanced examples of using laminar, you can check out the Amethyst-Network crate.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

License

Licensed under either of

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].