Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1917: Rewriting the network library to provide a nicer baseline r=TimonPost a=jstnlef

## Description
Kind of a big one here I know. This is an attempt to both make the networking library play a bit more nicely with Specs and to also decouple it from laminar while still providing the ability to use laminar as a transport backend.

I wanted to get this up to get some feedback from people. Comments, alternative approaches, criticisms are all welcomed and desired!

I'm hoping to use this new implementation as a new baseline with which we can build new functionality off of like component synchronization, matchmaking, etc. This also paves the way for us to implement a websocket implementation backend for wasm games in, what I think, is a fairly painless manner.

I'm also aware that the testing situation is extremely lacking but I'm mostly curious if this is the route we'd like to go down before I shore up the tests.

## Additions
- Complete rewrite of the current networking crate.

## Removals
- The old networking crate

## PR Checklist

By placing an x in the boxes I certify that I have:

- [x] Updated the content of the book if this PR would make the book outdated.
- [x] Added a changelog entry if this will impact users, or modified more than 5 lines of Rust that wasn't a doc comment.
- [x] Added unit tests for new code added in this PR.
- [X] Acknowledged that by making this pull request I release this code under an MIT/Apache 2.0 dual licensing scheme.

If this modified or created any rs files:

- [x] Ran `cargo +stable fmt --all`
- [x] Ran `cargo clippy --all --features "empty"`
- [x] Ran `cargo test --all --features "empty"`


Co-authored-by: Justin LeFebvre <[email protected]>
Co-authored-by: Timon <[email protected]>
  • Loading branch information
3 people authored Oct 8, 2019
2 parents 06f3c04 + 89609bb commit 0e996cf
Show file tree
Hide file tree
Showing 25 changed files with 1,387 additions and 1,478 deletions.
15 changes: 5 additions & 10 deletions amethyst_network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version = "0.6.1"
authors = [
"Joël Lupien (Jojolepro) <[email protected]>",
"Lucio Franco (LucioFranco) <[email protected]>",
"Timon Post (TimonPost) <https://github.com/TimonPost>"
"Timon Post (TimonPost) <https://github.com/TimonPost>",
"Justin LeFebvre (jstnlef) <https://github.com/jstnlef>"
]
edition = "2018"
description = "Amethyst networking crate"
Expand All @@ -24,13 +25,7 @@ nightly = [ "amethyst_core/nightly" ]
[dependencies]
amethyst_core = { path = "../amethyst_core", version = "0.8.1" }
amethyst_error = { path = "../amethyst_error", version = "0.3.0" }
serde = { version = "1", features = ["derive"] }
shrev = "1.0"
shred = "0.9"
bincode = "1.0"
log = "0.4.6"
uuid = { version = "0.7.1", features = ["v4","serde"] }
bytes = "0.4"
laminar = "0.3"
log = "0.4"
thread_profiler = { version = "0.3" , optional = true }
laminar = "0.2.3"
err-derive = "0.1"
crossbeam-channel = "0.3.9"
26 changes: 14 additions & 12 deletions amethyst_network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@
[s5]: https://img.shields.io/discord/425678876929163284.svg?logo=discord
[l5]: https://discord.gg/GnP5Whs

The networking crate for the `amethyst` game engine. This crate provides the API and functionality which application developers will normally use to develop multiplayer games. The main engine can be found at https://amethyst.rs.
This is the networking crate for the `amethyst` game engine. This crate provides the building blocks which
application developers can use to develop online multiplayer games. The main engine can be found at https://amethyst.rs.

This project is still at an early stage. We are currently designing and implementing a fast/robust networking system on top of specs. To exercise our implementation, we are creating a small test game which we will make public when we feel it's in a good place. Eventually, as we gain more confidence in our solution, we will move stable functionality over from that game to amethyst network.
This project is still at an early stage. We are currently designing and implementing a robust networking system on
top of specs. To exercise our implementation, we are creating a small test game which we will make public when we feel
it's in a good place. Eventually, as we gain more confidence in our solution, we will move stable functionality over
from that game to amethyst network.

Currently, amethyst network supports:
- Reliable (ordered, sequenced) UDP.
- Unreliable (sequenced) UDP.
- Connect/Disconnect events from clients.
- Automatic creation of `NetConnection` on client connect.
- Automatic Fragmentation of big packets

We use [laminar](https://github.com/amethyst/laminar) as the application layer communication protocol.
- `NetworkSimulationTime` resource to decouple simulation frame rate from ECS frame rate
- An API abstraction for various transport layer network systems
- Implementations of the [laminar](https://github.com/amethyst/laminar) and UDP transport layers
- Connection lifecycle management

## 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.
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.

For more information or help, please come find us on the amethyst discord server's `#net` channel. We are working on architecture, design, and roadmaps and can definitely use some helping hands, don't hesitate :).
For more information or help, please come find us on the amethyst discord server's `#net` channel. We are working on
architecture, design, and roadmaps and can definitely use some helping hands, don't hesitate :).

## License

Expand Down
60 changes: 0 additions & 60 deletions amethyst_network/src/bundle.rs

This file was deleted.

224 changes: 0 additions & 224 deletions amethyst_network/src/connection.rs

This file was deleted.

Loading

0 comments on commit 0e996cf

Please sign in to comment.