Created
October 20, 2018 04:35
-
-
Save LucioFranco/28b76392ed7d548c5e2af1495c0bfd76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the position of some entity. | |
// It is syncable but has no reliability guarentees. | |
// Questions: | |
// - How do we let the server determine values and | |
// verify them and replicate them properly? | |
#[derive(Deserialize, Serialize, Sync)] | |
struct Position { | |
x: u16, | |
y: u16, | |
} | |
// This component would be synced and replicated | |
// reliably accross all clients. | |
// Questions: | |
// - How do we want to differentiate between a producer and a consumer | |
// of this type of entity? So what does this look like on the server side | |
// and the client side? | |
#[derive(Deserialize, Serialize, SyncReliable)] | |
struct Score(u8, u8); | |
fn main() -> Result<()> { | |
//... | |
let game_data = GameDataBuilder::default() | |
//... | |
.with_bundle(NetworkBundle::new("0.0.0.0:12345")))? | |
//... | |
let mut game = Application::build("./", State1)? | |
.with_frame_limit( | |
FrameRateLimitStrategy::SleepAndYield(Duration::from_millis(2)), | |
1, | |
).build(game_data)?; | |
game.run(); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment