AI plays a small escape room game, written in rust

Overview

Escape AI

AI learns escape a room.

This is a rust based implementation of a genetic algorithm and reinforcement learning simulation that trains an AI named Zoe to escape from five rooms of increasing difficulty. The simulation is built using the macroquad library.

Demo

youtube

Usage

  • Clone the repo
    git clone [email protected]:bones-ai/rust-escape-ai.git
    cd rust-escape-ai
    
  • Run the simulation
    cargo run --release
    
  • To update the simulation configurations use the configs file located at src/configs.rs

Create custom rooms

  • Tiled map editor is used for building the 2d levels
  • To create custom levels and play around with the AI, use tile layers with names player, keys, door, walls, spikes, enemies and background. I suggest taking a look at how other maps are built to understand how things are to be setup.

Configurations

  • The project config file is located at src/configs.rs
  • The game rooms have to be manually configured in the config file.

Inputs

  • Spacebar - Pause/Unpause the simulation
  • Tab - Show/hide the egui control menu
  • r - Restart the simulation
  • Backspace - Slow mode
  • Backslash - Enable AI, start the AI training process (Use this to play the game yourself, using keyboard inputs wasd)
  • Right Shift - Run at 5x speed
  • Mouse wheel - Zoom in/out
  • Mouse wheel with ctrl - Large zoom in/out
  • Right mouse click drag - Pan through the world
  • To draw all training AI agents, use the egui menu, then select Show Multi. Caution, if you have too many game rooms being simulation, this could freeze your machine.

Assets

If Zoe isn't able to solve a room

  • Try restarting (using shortcut r). It's impossible to get the same results as in the youtube video as every simulation run is random. Sometimes Zoe might get stuck (or spend a lot of time/steps) in a region, letting the simulation run for a longer is an option (but it'll take a long time).
  • Update NUM_FRAMES to a larger value. Once the room is solved, Zoe will try to solve the room more efficiently (i.e taking less steps)
  • Run the simulation at 5x (by using shortcut Right Shift). Some rooms can take a lot of generations to solve.
  • Disable the drawings in the egui menu to speed up the training process
You might also like...
Stalin Binary Search, Rust implementation
Stalin Binary Search, Rust implementation

Stalin Binary Search Idea is based on Stalin Sort It's alike binary search but any checking element which is not target one is eliminated. Complexity

Supervised discretization in Rust

Discrust Supervised discretization in Rust The discrust package provides a supervised discretization algorithm. Under the hood it implements a decisio

"Algorithms for approximate string matching" in Rust, with Python bindings.

ukkonen Implementation of a bounded Levenshtein distance by Esko Ukkonen in "Algorithms for approximate string matching" in Rust, with Python bindings

Common data structures and algorithms for competitive programming in Rust
Common data structures and algorithms for competitive programming in Rust

algorithm-rs algorithm-rs is common data structures and algorithms for competitive programming in Rust. Contents TBA How To Contribute Contributions a

zine/book about bitmap drawing algorithms and math with code examples in Rust
zine/book about bitmap drawing algorithms and math with code examples in Rust

A Bitmapper's Companion - zine/book about bitmap drawing algorithms and math with code examples in Rust A small zine/book written in LaTeX. In progres

Pure Rust implementation of the Double Ratchet algorithm
Pure Rust implementation of the Double Ratchet algorithm

Double Ratchet A pure Rust implementation of the Double Ratchet, as specified by Trevor Perrin and Moxie Marlinspike. The Double Ratchet allows two us

A rust implementation of Alexey Akhunov's multiproof algorithm

multiproof.rs A rust implementation of Alexey Akhunov's multiproof algorithm. At the time of creation, multiproof is still a work in progress and this

Algorithms implemented in Rust, explained.

Rusty Algorithms & Data Structures for Learners This repository presents Rust implementations of common algorithms and data structures, many of which

 Example of a genetic algorithm in Rust and Python
Example of a genetic algorithm in Rust and Python

Example of a genetic algorithm in Rust and Python Monkey typewriter Finding the phrase 'To be or not to be. That is the question.' Inspired by the exa

Owner
Bones-ai
I make AI simulations
Bones-ai
Fast, parallel, extensible and adaptable genetic algorithms framework written in Rust

oxigen Oxigen is a parallel genetic algorithm framework implemented in Rust. The name comes from the merge of OXIdación (Rust translated to Spanish) a

Martín Pozo 146 Dec 18, 2022
A tool used to evaluate the output of retrieval algorithms. Written in Rust.

Rusteval A tool used to evaluate the output of retrieval algorithms. Written in Rust. Building Install Rust with curl -sSf https://static.rust-lang.or

Giorgos Sfikas 17 Mar 22, 2022
A browser app that evolves vehicles using genetic algorithms, written in Rust and Bevy

Vehicle Evolver Deluxe This is a simulation that uses AI (to be specific: genetic algorithms) to try to build better and better vehicles. The vehicles

null 95 Dec 26, 2022
darwin-rs, evolutionary algorithms with rust

darwin-rs This library allows you to write evolutionary algorithms (EA) using the Rust programming language. Written by Willi Kappler, License: MIT -

Willi Kappler 95 Jan 1, 2023
Genetic Algorithm library in Rust

RsGenetic Summary and Features RsGenetic is a framework for executing genetic algorithms in Rust. It is designed to have a simple but modular API. Exa

Mathieu De Coster 74 Dec 27, 2022
Rust implementation of real-coded GA for solving optimization problems and training of neural networks

revonet Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also know

Yury Tsoy 19 Aug 11, 2022
Linear Programming for Rust, with an user-friendly API. This crate allows modeling LP problems, and let's you solve them with various solvers.

good_lp A Linear Programming modeler that is easy to use, performant with large problems, and well-typed. use good_lp::{variables, variable, coin_cbc,

Rust Operations Research 101 Dec 27, 2022
Raft implementation in Rust

rsraft Raft implementation in Rust. The aim of this project is implementing the Raft Consensus Algorithm as described in the paper, with the goal of f

Lauro Caetano 42 Dec 24, 2022
This crate implements fast route planning algorithms in Rust.

This crate implements fast route planning algorithms in Rust. Algorithms Currently implemented: Contraction Hierarchies: The implementat

Payas Rajan 4 Aug 15, 2021
Rust implementation of AstroBWT Proof-Of-Work algorithm

AstroBWT AstroBWT is a proof-of-work (PoW) algorithm based on Burrows-Wheeler transform (BWT). Developed and used by the DERO Project for Mobile (arm)

null 6 Mar 7, 2022