• Stars
    star
    116
  • Rank 292,146 (Top 6 %)
  • Language
    Go
  • License
    zlib License
  • Created over 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

👾 Navigation mesh pathfinding and spatial reasoning library

go.dev reference Test Actions Status Go Report Card codecov

go-detour - port of recast/detour in Go

Recast library

Recast is state of the art navigation mesh construction toolset for games.

  • It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out
  • It is fast which means swift turnaround times for level designers
  • It is open source so it comes with full source and you can customize it to your heart's content.

The Recast process starts with constructing a voxel mold from a level geometry and then casting a navigation mesh over it. The process consists of three steps, building the voxel mold, partitioning the mold into simple regions, peeling off the regions as simple polygons.

  1. The voxel mold is build from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move.
  2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously.
  3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level.

Recast command line interface

This package embeds a command line interface tool named recast to build navigation meshes:

$ recast -h
This is the command-line application accompanying go-detour:
        - build navigation meshes from any level geometry,
        - save them to binary files (usable in 'go-detour')
        - easily tweak build settings (YAML files),
        - check or show info about generated navmesh binaries.

Usage:
  recast [command]

Available Commands:
  build       build navigation mesh from input geometry
  config      generate a config file with default build settings
  infos       show infos about a navmesh

Use "recast [command] --help" for more information about a command.

Installation of the cli tool:

go get -u github.com/arl/go-detour/cmd/recast

Detour library

Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly.

Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes.

Compatibility with original Detour & Recast

The Go version and the original works both with the same binary format to save navmeshes, that means:

  • you can use in the original Detour the navmeshes built in Go.
  • you can use in Go the navmeshes built with the original Recast.

In other words, you can visualize and tweak your navmeshes with the handy GUI tool RecastDemo. Once you are satisfied with the navmesh of your geometry, use the same build settings with either the recast Go package or the cli tool in order to have identical results.

Samples

todo

... speak about the implemented sample from RecastDemo ...

Package structure

todo: ... speak about the package structure or at least explain the big idea ...

Minimum Go Version

Go 1.8+ is required

Credits

go-detour has been ported to the Go language. As such, it's not an original work.

The Detour & Recast libraries (which go-detour is port of) is an original work from, and has been written by, Mikko Mononen, and released under the following:

copyright (c) 2009 Mikko Mononen [email protected].

License

go-detour is licensed under ZLib license, see LICENSE for more information.

More Repositories

1

statsviz

🚀 Visualise your Go program runtime metrics in real time in the browser
Go
3,061
star
2

gitmux

💻 Git in your tmux status bar
Go
512
star
3

tmux-gitbar

Git in your tmux status bar
Shell
171
star
4

go-rquad

📌 State of the art point location and neighbour finding algorithms for region quadtrees, in Go
Go
129
star
5

macdeployqtfix

To bundle a Qt application on Mac OSX, there is macdeployqt. To finish the job there is macdeployqtfix! ✅
Python
60
star
6

golq

📡 2D locality queries in Go
Go
31
star
7

assertgo

Conditionally compiled assertions in Go
Go
18
star
8

scripts

this is my collection of bash scripts for everyday use
Shell
15
star
9

dotfiles

My dotfiles config... Feel free to use
Vim Script
8
star
10

udpnet

Game networking library in Go, based on UDP
Go
6
star
11

gogeo

Geometry library in Go
Go
5
star
12

gitstatus

Retrieve the Git status of a working tree, in Go.
Go
5
star
13

bitfield

Go-generate code to emulate C bit fields
Go
4
star
14

gioexp

Experiments with Gio, the cross-platform gui for Go
Go
3
star
15

evolve

Evolutionary Computation Framework
Go
3
star
16

fastlfu

LFU cache with O(1) runtime complexity for all operations: insertion, access and deletion (eviction). In Go.
Go
3
star
17

imgtools

Utilities for working with images in Go, completing the standard image package.
Go
3
star
18

urlserv

URL shortener demo for First Steps with Go training
Go
2
star
19

zsort

Useful additions to the sort package
Go
2
star
20

iolib2

Output device abstraction. Mask device differences (serial port, LPT, file, ethernet, etc.). Extendable
Go
2
star
21

gotypes

Automatically generate Go code from Go structures
Go
2
star
22

serve

Serves the content of a directory as HTTP.
Go
2
star
23

gencli

Go-generate your urfave/cli flags from a structure
Go
1
star
24

go-gencon

Go Generic Containers - Reduce boilerplate by generating containers for your datastructures
Go
1
star
25

gsettings-upd

A systemd service that updates gsettings values
Go
1
star
26

get-up-and-go

Solutions for exercices of the Tour of Go
Go
1
star
27

training

Firs steps with go (Go introduction training)
Go
1
star
28

artificial

Artificial art framework and experiement
Go
1
star
29

beggining-with-go

Go
1
star
30

monitoring

Monitoring workshop source code
Go
1
star
31

math32

32 bits wrapper around the standard go math package
Go
1
star
32

opencog-workbench

A tool to assist in the control and visualization of the OpenCog AtomSpace. It should facilitate the comprehension of AGI dynamics and allow a researcher to guide, tune, and understand the various mind processes in action, handle the parsing of log files and dynamic configuration of a running OpenCog instance. (developed with Angular, Bootstrap)
JavaScript
1
star