Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into prefab_data_on_enums
Browse files Browse the repository at this point in the history
  • Loading branch information
alec-deason committed May 22, 2019
2 parents 798e4be + 6bdc329 commit c3c81b3
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 43 deletions.
30 changes: 14 additions & 16 deletions amethyst_assets/src/prefab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,22 +380,20 @@ where
progress: &mut ProgressCounter,
system_data: &mut Self::SystemData,
) -> Result<bool, Error> {
let handle = if let AssetPrefab::File(ref name, ref format, ref options) = *self {
Some(system_data.0.load(
name.as_ref(),
format.clone(),
options.clone(),
progress,
&system_data.2,
))
} else {
None
};
if let Some(handle) = handle {
*self = AssetPrefab::Handle(handle);
Ok(true)
} else {
Ok(false)
match *self {
AssetPrefab::File(ref name, ref format, ref options) => {
*self = AssetPrefab::Handle(system_data.0.load(
name.clone(),
format.clone(),
options.clone(),
progress,
&system_data.2,
));
Ok(true)
}

// Already loaded
_ => Ok(false),
}
}
}
Expand Down
41 changes: 36 additions & 5 deletions amethyst_network/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
# Amethyst Networking

The networking crate for the `amethyst` game engine. The main engine can be found at https://amethyst.rs.
[![Build Status][s2]][l2] [![Latest Version][s1]][l1] [![docs.rs][s4]][l4] [![Join us on Discord][s5]][l5] [![MIT/Apache][s3]][l3]

## Status
[s1]: https://img.shields.io/crates/v/amethyst_network.svg
[l1]: https://crates.io/crates/amethyst_network
[s2]: https://jenkins.amethyst-engine.org/buildStatus/icon?job=amethyst%2Fmaster
[l2]: https://jenkins.amethyst-engine.org/job/laminar/job/master/badge/icon
[s3]: https://img.shields.io/badge/license-MIT%2FApache-blue.svg
[l3]: docs/LICENSE-MIT
[s4]: https://docs.rs/amethyst_network/badge.svg
[l4]: https://docs.rs/amethyst_network/
[s5]: https://img.shields.io/discord/425678876929163284.svg?logo=discord
[l5]: https://discord.gg/GnP5Whs

Right now this crate is very simple and it just supports sending messages through specs to other clients. It uses a combination of `EventChannel`s
to send events between the network thread. In its current state it is not ready to be used in a game but there is work going into [Laminar](https://github.com/amethyst/laminar) that will soon be the underlying socket implemenation for this crate.
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.

For more information or help, please come find us on the discord server's #net channel.
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.

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.

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

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 hessitate :).

## License

Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](docs/LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](docs/LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
45 changes: 23 additions & 22 deletions amethyst_renderer/src/formats/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,28 +254,29 @@ where
progress: &mut ProgressCounter,
system_data: &mut Self::SystemData,
) -> Result<bool, Error> {
let handle = match *self {
TexturePrefab::Data(ref data) => Some(system_data.0.load_from_data(
data.clone(),
progress,
&system_data.1,
)),

TexturePrefab::File(ref name, ref format, ref options) => Some(system_data.0.load(
name.as_ref(),
format.clone(),
options.clone(),
progress,
&system_data.1,
)),

TexturePrefab::Handle(_) => None,
};
if let Some(handle) = handle {
*self = TexturePrefab::Handle(handle);
Ok(true)
} else {
Ok(false)
match *self {
TexturePrefab::Data(ref data) => {
*self = TexturePrefab::Handle(system_data.0.load_from_data(
data.clone(),
progress,
&system_data.1,
));
Ok(true)
}

TexturePrefab::File(ref name, ref format, ref options) => {
*self = TexturePrefab::Handle(system_data.0.load(
name.clone(),
format.clone(),
options.clone(),
progress,
&system_data.1,
));
Ok(true)
}

// Already loaded
TexturePrefab::Handle(_) => Ok(false),
}
}
}
Expand Down

0 comments on commit c3c81b3

Please sign in to comment.