diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-14 06:43:53 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-15 02:50:57 +0100 |
commit | 69584a302d132dc2bcc3837437e7347a3e0a5114 (patch) | |
tree | fae29ea706451e91a0dee99200fa661b78de3517 /src/main.rs | |
parent | 9671dd79163e654f61896ec4f61142a71c2f82c0 (diff) |
feat: players can teleport
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..cdd7c17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,27 @@ +use lightyear::transport::io::TransportConfig; +use shared::SERVER_PORT; +use std::net::Ipv4Addr; +use std::net::SocketAddr; +use std::thread; + +mod client; +mod protocol; +mod server; +mod shared; + fn main() { - println!("Hello, world!"); + let (from_server_send, from_server_recv) = crossbeam_channel::unbounded(); + let (to_server_send, to_server_recv) = crossbeam_channel::unbounded(); + + thread::spawn(|| { + let server_addr = SocketAddr::new(Ipv4Addr::new(0, 0, 0, 0).into(), SERVER_PORT); + server::main(TransportConfig::Channels { + channels: [(server_addr, to_server_recv, from_server_send)].to_vec(), + }); + }); + + client::main(TransportConfig::LocalChannel { + recv: from_server_recv, + send: to_server_send, + }); } |