dikOM
This commit is contained in:
parent
a1ef0a0172
commit
13d6fe3907
16
src/main.rs
16
src/main.rs
@ -1,6 +1,18 @@
|
||||
use bevy::prelude::*;
|
||||
use protocol::ProtocolPlugin;
|
||||
|
||||
pub mod protocol;
|
||||
pub mod shared_net;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
struct ClientServerPlugin;
|
||||
impl Plugin for ClientServerPlugin {
|
||||
fn build(&self, app: &mut App) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
bevy::app::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_plugins(ClientServerPlugin)
|
||||
.add_plugins(ProtocolPlugin)
|
||||
.run();
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use client::{Authentication, ClientConfig};
|
||||
use lightyear::prelude::*;
|
||||
use server::ServerConfig;
|
||||
use std::time::Duration;
|
||||
|
||||
pub const PRIVIATE_KEY: Key = [
|
||||
@ -9,6 +10,24 @@ pub const PRIVIATE_KEY: Key = [
|
||||
pub const FIXED_TIMESTEP_HZ: f64 = 64.0;
|
||||
pub const REPLICATION_INTERVAL: Duration = Duration::from_millis(100);
|
||||
|
||||
pub fn server_config() -> ServerConfig {
|
||||
let netcode_config = server::NetcodeConfig::default();
|
||||
let io_config = server::IoConfig {
|
||||
transport: server::ServerTransport::UdpSocket("127.0.0.1:7000".parse().unwrap()),
|
||||
conditioner: None,
|
||||
compression: CompressionConfig::default(),
|
||||
};
|
||||
let net = server::NetConfig::Netcode {
|
||||
config: netcode_config,
|
||||
io: io_config,
|
||||
};
|
||||
ServerConfig {
|
||||
shared: shared_config(Mode::Separate),
|
||||
net: vec![net],
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn client_config() -> ClientConfig {
|
||||
let auth = Authentication::Manual {
|
||||
server_addr: "127.0.0.1:7000".parse().unwrap(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user