Partial: Dedicated Peer distribution system
All checks were successful
CI / Formatting (push) Successful in 1m7s
All checks were successful
CI / Formatting (push) Successful in 1m7s
This is an uncompleted commit to move the work over to my other machine. Should compile though.
This commit is contained in:
parent
4db82f328b
commit
1a5a628000
6 changed files with 161 additions and 53 deletions
|
@ -4,10 +4,9 @@ use bevy::prelude::*;
|
|||
use uuid::Uuid;
|
||||
|
||||
use super::{
|
||||
distribution::Networked,
|
||||
io::{Config, handle_network_input, handle_network_output, heartbeat, timeout},
|
||||
io::{handle_network_input, handle_network_output, heartbeat, timeout},
|
||||
packet::{InboundPacket, OutboundPacket},
|
||||
peer::{Peer, PeerChangeEvent, PeerMap, handle_new_peer, handle_peer_change},
|
||||
peer::{PeerChangeEvent, PeerData, PeerMap, handle_new_peer, handle_peer_change},
|
||||
queues::{NetworkReceive, NetworkSend},
|
||||
socket::bind_socket,
|
||||
state::NetworkState,
|
||||
|
@ -41,7 +40,6 @@ impl Plugin for NetIOPlugin {
|
|||
FixedPostUpdate,
|
||||
handle_network_output.run_if(in_state(NetworkState::MultiPlayer)),
|
||||
)
|
||||
.insert_resource(Config::new())
|
||||
.add_event::<PeerChangeEvent>()
|
||||
.add_event::<InboundPacket>()
|
||||
.add_event::<OutboundPacket>();
|
||||
|
@ -54,7 +52,10 @@ impl Plugin for NetIOPlugin {
|
|||
|
||||
let mut peer_map = PeerMap::default();
|
||||
if let Some(socket) = self.peer {
|
||||
let entity = app.world_mut().spawn(Peer::new(socket, Uuid::nil()));
|
||||
let entity = app.world_mut().spawn(PeerData {
|
||||
addr: socket.into(),
|
||||
me: Uuid::nil(),
|
||||
});
|
||||
peer_map.insert(Uuid::nil(), entity.id());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue