Crates.io | weasel |
lib.rs | weasel |
version | 0.11.0 |
source | src |
created_at | 2020-02-08 18:11:53.387957 |
updated_at | 2020-11-03 18:20:58.129132 |
description | A customizable battle system for turn-based games. |
homepage | |
repository | https://github.com/Trisfald/weasel |
max_upload_size | |
id | 206410 |
size | 539,122 |
weasel is a customizable battle system for turn-based games.
use weasel::{
battle_rules, rules::empty::*, Battle, BattleController,
BattleRules, CreateTeam, EventTrigger, Server,
};
battle_rules! {}
let battle = Battle::builder(CustomRules::new()).build();
let mut server = Server::builder(battle).build();
CreateTeam::trigger(&mut server, 1).fire().unwrap();
assert_eq!(server.battle().entities().teams().count(), 1);
You can find real examples of battle systems made with weasel in examples.
To use this library, you would create instances of its main objects: server
and client
.
You will notice that both of them are parameterized with a BattleRules
generic type.
A server
is mandatory to manage a game. A server can be also a client.
For example, a typical single player game needs only one server.
A client
is a participant to a game. It sends commands to a server on behalf of a player.
A multiplayer game would have one server and multiple clients.
Once you have instantiated a server
and possibly one or more clients
,
you are ready to begin a new game.
Games are carried forward by creating events
.
There are many kind of events, see the documentation to know more.
Through a server
or a client
you'll be able to access the full state of the battle,
including the entire timeline of events.
weasel provides many functionalities to ease the development of a turn based game:
Thanks for your interest in contributing! There are many ways to contribute to this project. See CONTRIBUTING.md.
weasel is provided under the MIT license. See LICENSE.