mapgen

package module
v0.0.0-...-ac38966 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2018 License: MIT Imports: 9 Imported by: 0

README

Map Generator

Create beautiful and pseudo-random terrain-like maps.

a sample mat bit

Build Go Report Card Documentation

Install

To use it as a library, you need to get it through:

go get github.com/hacdias/mapgen

Soon, more documentation will be added about the final executable.

Usage

Documentation about using it as a library can be found on godoc.

Usage of mapgen:
  -t, --color transition         Color Transition in map generation overrites color palette transition
  -c, --colors filename string   File name with the color palette (default "defaultPalette.txt")
  -f, --filename string          File name to output (default "img.png")
  -h, --height int               Height of image (default 100)
  -l, --lacunarity float         Lacunarity (default 2.5)
  -o, --octaves int              Number of octaves (default 5)
  -p, --persistence float        Persistence (default 0.5)
  -x, --scale float              Scale (default 20)
  -s, --seed int                 Seed to generate the map (default random)
  -w, --width int                Width of image (default 100)

Contributing

PRs accepted.

License

MIT © All Contributors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(o *Options) (image.Image, error)

Generate generates a image using the options object you defined. It returns an image that can be saved to a file or used to be later parsed.

func ParseHex

func ParseHex(s string) colorful.Color

ParseHex parses string to hex color

Types

type GradientTable

type GradientTable []struct {
	Color      colorful.Color
	Pos        float64
	Transition bool
}

GradientTable contains the "keypoints" of the colorgradient you want to generate. The position of each keypoint has to live in the range [0,1]

func GenerateGradient

func GenerateGradient(filename string, transitionFlag bool) GradientTable

GenerateGradient generates a gradient with the information given, in filename, by user

type Options

type Options struct {
	Width       int
	Height      int
	Octaves     int
	Seed        int64
	Scale       float64
	Persistence float64
	Lacunarity  float64
	Transition  bool
	ColorsFile  string
}

Options are used to generate the image map. You can set the width, height, octaves, seed, scale, persistence and lacunatiry.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL