Skip to content

Commit

Permalink
Add LICENSE and improve README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
IanTayler committed Nov 20, 2020
1 parent 1651dc8 commit c147eac
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Ian Tayler <iangtayler@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
33 changes: 31 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,41 @@
# FBSim

Some kind of football-related strategy game written in Rust.
Game-like football simulation environment for trying out AI ideas, written in Rust.

I wrote all of this in my free time to learn a bit about Rust and game development. The code is very scarcely documented and there is no testing at all. Consider yourself warned.

## Instructions

To load this install amethyst's dependencies and then do:

```
source env.sh
source env.sh # Needed because of a bug with rendy in vulkan.
cargo build
```

You may need to change amethyst's features in the `Cargo.toml` file if you're not on linux!

You can use `cargo run` to run it.

## Agents

Currently this only implements a `Basic` engine, where all players but the defender and the goalie run after the ball, and `BasicWingWait` which is (just a bit) slightly more complicated.

## Adding a new agent.

If you want to write your own engine, the way to do it is:

1. Create a structure implementing the trait `src/engines/engine.rs::Engine`. (Look at `src/engines/basic.rs` implementations as a guide)
2. Add it to the default engine registry in `src/resources/engine_registry.rs::EngineRegistry::default`.
3. Modify `assets/sprites/player.ron` so that `entities.data.extras.player.robot.logic_module` is `EngineRunner("<registered_name_for_your_engine>").
4. Run `cargo run` and see your agents play against the default `Basic` engine!

## Roadmap

- Implement Reinforment Learning-based agents. (What I did this all for).
- Add support for implementations in a scripting language.
- Add more game-like features?

# Copyright

Copyright Ian Tayler <iangtayler@gmail.com> 2020. Licensed under the [MIT license](/LICENSE). Use and distribute without restriction, according to the license text.
1 change: 1 addition & 0 deletions src/resources/engine_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl EngineRegistry {
}
}
}

impl Default for EngineRegistry {
fn default() -> Self {
let mut registry =
Expand Down
2 changes: 1 addition & 1 deletion src/systems/animate_player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use amethyst::{
renderer::SpriteRender,
};

const MIN_MOVEMENT: f32 = 2.0;
const MIN_MOVEMENT: f32 = 1.0;

fn rotate_player(movement_x: f32, movement_y: f32, transform: &mut Transform) {
let has_movement = movement_x.abs() + movement_y.abs() > 0.0;
Expand Down

0 comments on commit c147eac

Please sign in to comment.