Crates.io | bevy_veilid |
lib.rs | bevy_veilid |
version | 0.4.0 |
source | src |
created_at | 2023-11-06 14:40:45.118007 |
updated_at | 2024-07-09 14:49:42.982969 |
description | Build turn-based p2p games with Veilid |
homepage | |
repository | https://github.com/stillonearth/bevy_veilid |
max_upload_size | |
id | 1026976 |
size | 437,312 |
Build p2p turn-based games with anonimity for both clients with help of Veilid.
https://github.com/stillonearth/bevy_veilid/assets/97428129/4c505eef-1dee-4ab4-b0e7-51262a3b3337
bevy version | veilid version | bevy_veilid version |
---|---|---|
0.11 | 0.2.4 | 0.1.0 |
0.11 | 0.2.5 | 0.1.2 |
0.12 | 0.3 | 0.2 |
0.13 | 0.3.2 | 0.3 |
0.14 | 0.3.3 | 0.4 |
Refer to examples/pingpong for basic example.
#[derive(Serialize, Deserialize, Debug, Clone, Default, Resource)]
struct SampleMessage {
pub counter: i32,
pub extra: String,
}
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(VeilidPlugin::<SampleMessage>::default())
.add_systems(
Update,
(
on_ev_veilid_initialized,
handle_ui_state,
on_host_game,
on_join_game,
on_ev_awating_peer,
on_ev_error,
on_ev_veilid_message,
on_ev_connected_peer,
on_ev_change_counter,
),
)
.run();
}
EventConnectedPeer
EventError
EventAwaitingPeer
EventVeilidInitialized
EventReceiveMessage<SampleMessage>
EventSendMessage<SampleMessage>
EventMessageSent
bevy_veilid
will inject this into bevy
pub enum VeilidPluginStatus {
Initializing,
Initialized,
ConnectedPeer,
AwaitingPeer,
Error,
}
A full veilid instance will run in background with settings defined in veilid_duplex.
veilid_duplex
manages veilid internals and provides an API to send a message to another peer by refering each other with dht_keys unique for each run.