evoke - easy netcode
Evoke provides building blocks to add networking capabilities to game engines.
Evoke supports:
- Client-Server model with authoritative server
Client-Server
For client-server model Evoke automatically performs state replication with delta compression from server to client
and commands replication from clients to server.
Evoke makes no assumption of components used in the game.
User needs to register server::Descriptor in server and client::Descriptor in client for components that need to be replicated.
There're blanket implementations for components that are comparable for equality and serializable.
For server and for client.
Core
Evoke's core provides very abstract client and server sessions,
supporting sending and receiving commands like
Connect, AddPlayer, SendInput, Update etc
with generic payload.
Evoke's core is available as separate crate evoke-core and re-exported from this crate as evoke::core
Unlike the evoke crate (this one) evoke-core does not depends on edict and can be used
in any game engine, even written in language other than Rust if packed into FFI-ready library.
Usage
To start using Evoke simply configure and run ServerSystem and ClientSystem on server and client respectively.
Server
To configure ServerSystem provide descriptors for components replication and RemotePlayer implementation.
/// Information associated with player.
;
/// Player input serializable representation.
;
/// This type drives player lifecycle and input processing.
;
/// Component that is own descriptor.
;
/// Prepare channel listener.
let listener = bind.await?;
/// Build server system.
let mut server = builder
.
.
.build;
let mut world = new;
let scope = new;
// game loop
loop
Client
To configure ClientSystem provide descriptors for components replication and LocalPlayer implementation.
/// Information associated with player.
;
/// Player input serializable representation.
;
/// This type drives player lifecycle and input processing.
;
/// Component that is own descriptor.
;
/// Build client system.
let mut client = builder
.
.
.build;
let mut world = new;
let scope = new;
client.connect.await?;
let player_id: PlayerId = client.add_player.await?;
// The player can controls all entities to which server attaches same `PlayerId` as component.
// game loop
loop
License
Licensed under either of
- Apache License, Version 2.0, (license/APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (license/MIT or http://opensource.org/licenses/MIT)
at your option.
Contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.