{"id":13822688,"url":"https://github.com/TimonPost/laminar","last_synced_at":"2025-05-16T17:31:32.101Z","repository":{"id":37265366,"uuid":"151304692","full_name":"TimonPost/laminar","owner":"TimonPost","description":"A simple semi-reliable UDP protocol for multiplayer games","archived":false,"fork":false,"pushed_at":"2023-10-18T18:45:00.000Z","size":9504,"stargazers_count":845,"open_issues_count":36,"forks_count":68,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-07T13:19:50.192Z","etag":null,"topics":["gamedev","networking","protocol","rust","udp"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimonPost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-10-02T18:38:49.000Z","updated_at":"2025-05-04T15:28:52.000Z","dependencies_parsed_at":"2022-08-24T15:51:58.980Z","dependency_job_id":"b8902591-3ff6-4add-8464-9332a9ffeddb","html_url":"https://github.com/TimonPost/laminar","commit_stats":null,"previous_names":["amethyst/laminar"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Flaminar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Flaminar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Flaminar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Flaminar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimonPost","download_url":"https://codeload.github.com/TimonPost/laminar/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254573589,"owners_count":22093731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gamedev","networking","protocol","rust","udp"],"created_at":"2024-08-04T08:02:12.761Z","updated_at":"2025-05-16T17:31:32.075Z","avatar_url":"https://github.com/TimonPost.png","language":"Rust","readme":"# Laminar\n\n[![Build Status][s2]][l2] [![Latest Version][s1]][l1] [![docs.rs][s4]][l4] [![Join us on Discord][s5]][l5] [![MIT/Apache][s3]][l3] ![Lines of Code][s6] ![Coverage][s7]\n\n[s1]: https://img.shields.io/crates/v/laminar.svg\n[l1]: https://crates.io/crates/laminar\n[s2]: https://jenkins.amethyst-engine.org/buildStatus/icon?job=laminar%2Fmaster\n[l2]: https://jenkins.amethyst-engine.org/job/laminar/job/master/badge/icon\n[s3]: https://img.shields.io/badge/license-MIT%2FApache-blue.svg\n[l3]: docs/LICENSE-MIT\n[s4]: https://docs.rs/laminar/badge.svg\n[l4]: https://docs.rs/laminar/\n[s5]: https://img.shields.io/discord/425678876929163284.svg?logo=discord\n[l5]: https://discord.gg/GnP5Whs\n[s6]: https://tokei.rs/b1/github/amethyst/laminar?category=code\n[s7]: https://codecov.io/gh/amethyst/laminar/branch/master/graphs/badge.svg\n\nLaminar is an application-level transport protocol which provides configurable reliability and ordering guarantees built on top of UDP. \nIt focuses on fast-paced fps-games and provides a lightweight, message-based interface.\n\nLaminar was designed to be used within the [Amethyst][amethyst] game engine but is usable without it.\n\nIf you are new to laminar or networking in general, We strongly recommend taking a look at the [laminar book][book]\n\n[amethyst]: https://github.com/amethyst/amethyst\n\n# Concepts\n\nThis library is loosely based off of [Gaffer on Games][gog] and shares features similar as RakNet, Steam Socket, netcode.io.\nThe 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.\nThe library itself provides a few low-level types of packets that provide different types of guarantees. The most\nbasic are unreliable and reliable packets. Also ordering, sequencing can be done on multiple streams.\nFor more information, read the projects [README.md][readme], [book][book], [docs][docs] or [examples][examples].\n\n[gog]: https://gafferongames.com/\n[readme]: https://github.com/amethyst/laminar/blob/master/README.md\n[book]: https://timonpost.github.io/laminar/\n[docs]: https://docs.rs/laminar/\n[examples]: https://github.com/amethyst/laminar/tree/master/examples\n[amethyst]: https://github.com/amethyst/amethyst\n\n## Table of contents:\n- [Useful links](#useful-links)\n- [Features](#features)\n- [Getting Started](#getting-started)\n- [Examples](#examples)\n- [Notice](#notice)\n- [Contributing](#contribution)\n- [Authors](#authors)\n- [License](#license)\n\n## Features\nThese are the features this crate provides:\n\n* [x] Fragmentation\n* [x] Unreliable packets\n* [x] Unreliable sequenced packets\n* [x] Reliable unordered packets\n* [x] Reliable ordered packets\n* [x] Reliable sequenced packets\n* [x] Rtt estimations\n* [x] Protocol version monitoring\n* [x] Basic connection management\n* [x] Heartbeat\n* [x] Basic DoS mitigation\n* [x] High Timing control\n* [x] Protocol Versioning\n* [x] Well-tested by integration and unit tests\n* [x] Can be used by multiple threads (Sender, Receiver)\n\n### Planned\n\n* [ ] Handshake Protocol\n* [ ] Advanced Connection Management\n* [ ] Cryptography\n* [ ] Congestion Control\n\n## Getting Started\nAdd the laminar package to your `Cargo.toml` file.\n\n```toml\n[dependencies]\nlaminar = \"0.5\"\n```\n\n### Useful Links\n\n- [Documentation](https://docs.rs/laminar/).\n- [Crates.io](https://crates.io/crates/laminar)\n- [Examples](https://github.com/amethyst/laminar/tree/master/examples)\n- [Contributing](https://github.com/amethyst/laminar/blob/master/docs/CONTRIBUTING)\n- [Book](https://amethyst.github.io/laminar/docs/index.html)\n\n## Examples\nPlease check out our [examples](https://github.com/amethyst/laminar/tree/master/examples) for more information.\n\n### UDP API | [see more](https://github.com/amethyst/laminar/blob/master/examples/udp.rs)\nThis is an example of how to use the UDP API.\n\n_Send packets_\n\n```rust\nuse laminar::{Socket, Packet};\n\n// Creates the socket\nlet mut socket = Socket::bind(\"127.0.0.1:12345\")?;\nlet packet_sender = socket.get_packet_sender();\n// Starts the socket, which will start a poll mechanism to receive and send messages.\nlet _thread = thread::spawn(move || socket.start_polling());\n\n// Bytes to sent\nlet bytes = vec![...];\n\n// Creates packets with different reliabilities\nlet unreliable = Packet::unreliable(destination, bytes);\nlet reliable = Packet::reliable_unordered(destination, bytes);\n\n// Specifies on which stream and how to order our packets, check out our book and documentation for more information\nlet unreliable = Packet::unreliable_sequenced(destination, bytes, Some(1));\nlet reliable_sequenced = Packet::reliable_sequenced(destination, bytes, Some(2));\nlet reliable_ordered = Packet::reliable_ordered(destination, bytes, Some(3));\n\n// Sends the created packets\npacket_sender.send(unreliable).unwrap();\npacket_sender.send(reliable).unwrap();\npacket_sender.send(unreliable_sequenced).unwrap();\npacket_sender.send(reliable_sequenced).unwrap();\npacket_sender.send(reliable_ordered).unwrap();\n```\n\n_Receive Packets_\n```rust\nuse laminar::{SocketEvent, Socket};\n\n// Creates the socket\nlet mut socket = Socket::bind(\"127.0.0.1:12346\")?;\nlet event_receiver = socket.get_event_receiver();\n// Starts the socket, which will start a poll mechanism to receive and send messages.\nlet _thread = thread::spawn(move || socket.start_polling());\n\n// Waits until a socket event occurs\nlet result = event_receiver.recv();\n\nmatch result {\n    Ok(socket_event) =\u003e {\n        match socket_event {\n            SocketEvent::Packet(packet) =\u003e {\n                let endpoint: SocketAddr = packet.addr();\n                let received_data: \u0026[u8] = packet.payload();\n            }\n            SocketEvent::Connect(connect_event) =\u003e { /* a client connected */ }\n            SocketEvent::Timeout(timeout_event) =\u003e { /* a client timed out */ }\n            SocketEvent::Disconnect(disconnect_event) =\u003e { /* a client disconnected */ }\n        }\n    }\n    Err(e) =\u003e {\n        println!(\"Something went wrong when receiving, error: {:?}\", e);\n    }\n}\n```\n\n## Authors\n\n- [Timon Post](https://github.com/TimonPost)\n- [Justin LeFebvre](https://github.com/jstnlef) \n- [Fletcher Haynes](https://github.com/fhaynes)\n\n## Notice\n\nThis library is not fully stable yet, and there may be breaking changes to the API.\nFor more advanced examples of using laminar, you can check out the [Amethyst-Network](https://github.com/amethyst/amethyst/tree/master/amethyst_network) crate.\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n## License\n\nLicensed under either of\n * Apache License, Version 2.0 ([LICENSE-APACHE](docs/LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](docs/LICENSE-MIT) or http://opensource.org/licenses/MIT)\nat your option.\n","funding_links":[],"categories":["Rust"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTimonPost%2Flaminar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTimonPost%2Flaminar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTimonPost%2Flaminar/lists"}