cxong / gomapgen

A 2d map generator written in Go
BSD 2-Clause "Simplified" License
42 stars 4 forks source link
ascii go map-generator procedural-generation tiled

GoMapGen

A 2d map generator written in Go

$ go run main.go --algo=rogue
Using seed 1512389956399933000
+--------------------------------+
|  WWWWWWW   WWWW                |
|  W.....W   W..W                |
|  W.....+## W..W    WWWWWWW     |
|  WWW+WWW ##+..+##  W.....W     |
|     #      W..W ###+.....W     |
|     #      W..W    WWW+WWW     |
|     #      WW+W       #        |
|     #        #        #        |
|     #        #        #        |
|     #        #        #        |
|     #      WW+W      ##        |
|     #      W..W      #         |
|  WWW+WWW   W..W      #         |
|  W.....W   W..W      #         |
|  W.....W ##+.<+###   #         |
|  W.....+## W..W  #   #         |
|  W.....W   W..W  #####         |
|  WWW+WWW   W..W      #         |
|    ##      WW+W      #         |
|    #         #       #         |
|WWWW+WWWW  ####       ###       |
|W.......W  #            #       |
|W.......W  #            #       |
|W.......W  #            #       |
|W.......+###            #       |
|W.......W            WWW+WWW    |
|W.......W            W.....W    |
|WWWWWWWWW            W..>..W    |
|                     WWWWWWW    |
|                                |
|                                |
|                                |
+--------------------------------+

This map generator implements a number of different algorithms and can output to ASCII, CSV and TMX tile map.

See main.go for all the options.

--algo=rogue --width=30 --height=18

rogue

--algo=village

village village build

--algo=shop --width=16 --height=13

shop shop build

--algo=bspinterior --corridorWidth=2

bspinterior bspinterior build

--algo=bsp --width=24 --height=20

bsp

--algo=walk --width=16 --height=16 --iterations=500

walk

--algo=interior --minroomsize=4 --maxroomsize=8 --width=24 --height=24

interior

--algo=cell --width=24 --height=20 --template=kenney

cell

Developer Getting Started

  1. Install go
  2. go get github.com/cxong/gomapgen
  3. Go to the source location, run go run main.go
  4. This should create a folder named tmx_export/
  5. Install Tiled
  6. Open tmx_export/map.tmx in Tiled
  7. Look at the generated map!