Plugin to generate flowfields from tilemaps in the Godot Engine!

Overview

Godot Tilemap Flowfields

RTS-Style optimized path-finding for crowds of agents. Built for the Godot game engine, written with performance in mind in Rust with godot-rust.

Installation

Download this repository as zip and unpack to your game folder. Its not yet currently on the Godot asset place.

Usage

Create a "FlowFieldGenerator" node and assign to it the TileMap you wish to use. For each tile, a "FlowFieldTileCost" node must be added as a child Node of the Generator.

Note that currently only Euclidean Path-Finding is implemented.

If you require a different approach, feel free to open an issue or contribute! :)

AdHoc flow field calculation

Use $FlowFieldGenerator.calculate_flow_field(to : Vector2) to retrieve a flow field towards the target vector. Note that this to vector must be in tile-space of your tile-map. Transfer coordinate systems with TileMap.world_to_map and TileMap.to_local accordingly, before invocation.

The return-value supports a function flow(to: Vector2) (with to also in map-space) to query the calculated flow field from the agent's position.

Open the Example Scene to see it all in action.

Baked flow field calculation

With $FlowFieldGenerator.bake_flow_fields() you receive an instance of BakedFlowFields supporting the Function flow_from_to(from:Vector2,to:Vector2), with all flow-fields cached. Pathfinding is then happening in constant time.

Baking all flow-fields creates huge files, however, and is also not recommended for scenarios where your game map changes dynamically. It is recommended to use $FlowFieldGenerator.calculate_flow_field(to : Vector2). Only use baked fields if your map is static and fast-paced path-finding is essential.

The Baked Example Scene is an example on how to save your baked flow-field as a resource.

Platforms

Currently Linux/X11 x86_64 and windows-x64 is officially compiled. If you have the resources to build for darwin or other targets, please don't hesitate to open a PR!

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Compiling

A justfile is provided: development binaries are built with just, releasing is done via just build-release. The Godot editor must be closed prior to building, else it segfaults because the FlowfieldGenerator is a tool-script.

Known Issues

  • Because of this issue in the Godot-Engine, it is currently not possible to type-hint the "FlowField" or "BakedFlowFields" Resources properly. The only type hint that you can use within gdscript Resource.

  • Not a bug but if your Agent wanders onto an impassable tile (either its cost is impassable or there is no tile at their position) it will no longer move. It is on you to prevent Agent's wandering or pushing one another into such locations. Either by using Physics and proper collision shapes, or by an approach such as Boids or the like.

You might also like...
An extendable system made up of autonomous execution services known as nodes organized in a tree of processes. Inspired by Godot!

NodeTree NodeTree is a framework to create large scalable programs and games through a tree of processes. Each process is fully autonomous and is capa

Inspector plugin for the bevy game engine
Inspector plugin for the bevy game engine

bevy-inspector-egui This crate provides the ability to annotate structs with a #[derive(Inspectable)], which opens a debug interface using egui where

Crossterm plugin for the bevy game engine
Crossterm plugin for the bevy game engine

What is bevy_crossterm? bevy_crossterm is a Bevy plugin that uses crossterm as a renderer. It provides custom components and events which allow users

A Bevy Engine plugin for making 2D paths, smooth animations with Bezier curves
A Bevy Engine plugin for making 2D paths, smooth animations with Bezier curves

bevy_pen_tool A Bevy Engine plugin for making 2D paths and smooth animations with Bezier curves TODO: Mesh-making functionality for building 2D shapes

Hanabi β€” a particle system plugin for the Bevy game engine.

Hanabi β€” a particle system plugin for the Bevy game engine

Tweening animation plugin for the Bevy game engine.
Tweening animation plugin for the Bevy game engine.

πŸƒ Bevy Tweening Tweening animation plugin for the Bevy game engine. Features Animate any field of any component or asset, including custom ones. Run

Bevy engine + miniquad render plugin

Bevy engine + miniquad renderer This is a plugin for Bevy engine that replaces default windowing and rendering plugins with miniquad based one. Usage

A plugin to enable random number generation for the Bevy game engine.

bevy_turborand A plugin to enable random number generation for the Bevy game engine, built upon turborand. Implements ideas from Bevy's Deterministic

A spectator camera plugin for the Bevy game engine

bevy_spectator A spectator camera plugin for the Bevy game engine. Controls Action Key Forward W Left A Backward S Right D Up Space Down LControl Alt.

Comments
Releases(v0.1.1)
Owner
Arne Winter
he/him. πŸ’»πŸ‘” software engineer ❀️ functional programmer 🌐 docker, nix πŸ‘Ύ hobbyist game developer πŸ€– hardware tinkerer
Arne Winter
A tool to generate inbetweens for animated sprites, written in godot-rust

Bitmapflow is a tool to help you generate inbetweens for animated sprites. In other words, it makes your animations smoother. It uses optical flow to

null 411 Dec 21, 2022
A crate for using Bevy with the Godot Engine.

bevy_godot A crate for using Bevy with the Godot Engine. This crate is in active development and is not ready for production use. Features Godot Scene

Abby Bryant 63 Dec 17, 2022
A CLI tool to manage your godot-rust projects

ftw A CLI tool to manage your godot-rust project! Table of contents General Information Setup Usage Contact General Information This is a tool to help

Michael Angelo Calimlim 77 Dec 13, 2022
compare gdnative rust based physics against Godot built-in physics

Godot vs. Rapier Rapier is an open source physics framework written in Rust. This project pits godots built-in physics against Rapier. It uses godot-r

Stephan Dilly 75 Nov 17, 2022
An egui backend for godot-rust

Godot Egui An egui backend for godot-rust. Rationale Godot has a perfectly valid GUI system, so why egui? Here are my personal reasons: Simplicity: No

null 109 Jan 4, 2023
GDDB is a superfast in-memory database designed for use in Godot

GDDB GDDB is a superfast in-memory database designed for use in Godot. This database aims to provide an easy frontend to an efficient in-memory databa

Richard Patching 5 Dec 4, 2022
jlang--godot bridge, built in rust

jlang-rs-gd J is an extremely high-level mathematical notation and programming language. Godot is a game / gui / multimedia engine. jlang-rs-gd lets y

tangentstorm 2 Feb 15, 2022
A Godot 3.4 binding for Live2D

godot-cubism A Godot 3.4 binding for cubism-rs which itself is a binding for the native cubism sdk. Usage var factory = load("path_to_your_native_scri

null 16 Dec 23, 2022
An artisanally made PSD Importer for Godot, written in Rust

PSD Importer for Godot Speed up your import workflow ✨ An artisanally made PSD Importer for Godot 3.5, written in Rust. ✨ Getting Started | ?? Documen

Bram Dingelstad 4 Jan 26, 2023
A direct ecs to low-level server implementation for Godot 4.1

godot_ecs What if Godot 4.1 and Bevy got married? Well, you'd get one interesting duo of data driven goodness. In Development This crate is not produc

null 5 Oct 6, 2023