porygion

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

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

Go to latest
Published: Aug 2, 2020 License: MIT Imports: 7 Imported by: 0

README

Porygion

Porygion is a procedural region map generator in the Gen-3 Pokémon style.

It's available online in the Porygion Playground.

This repository contains the library code for generating the region map, and the interactive website's code is located in the Porygion Playground repository.

Below are some examples region maps that this library can generate.

Example 1 Example 2 Example 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderBaseRegionMap

func RenderBaseRegionMap(regionMap RegionMap) image.Image

RenderBaseRegionMap renders a region map using only its elevations.

func RenderFullRegionMap

func RenderFullRegionMap(regionMap RegionMap) image.Image

RenderFullRegionMap renders a full region map.

func RenderRegionMapWithCities

func RenderRegionMapWithCities(regionMap RegionMap) image.Image

RenderRegionMapWithCities renders a region map using only its elevations and cities.

Types

type RegionMap

type RegionMap struct {
	PixelWidth  int
	PixelHeight int
	Elevations  [][]float64
	Cities      []Tile
	Routes      []Tile
}

RegionMap represents a generated region map.

func GenerateBaseRegionMap

func GenerateBaseRegionMap(seed int64, pixelWidth, pixelHeight int) RegionMap

GenerateBaseRegionMap generates a new region map containing only elevations.

func GenerateRegionMap

func GenerateRegionMap(seed int64, pixelWidth, pixelHeight int, numCities int) (RegionMap, error)

GenerateRegionMap generates a new complete region map.

func GenerateRegionMapWithCities

func GenerateRegionMapWithCities(seed int64, numCities int, regionMap RegionMap) RegionMap

GenerateRegionMapWithCities generates a new region map with new city locations, using the provided region map.

func GenerateRegionMapWithRoutes

func GenerateRegionMapWithRoutes(seed int64, regionMap RegionMap) (RegionMap, error)

GenerateRegionMapWithRoutes generates a new region map with new route locations, using the provided region map.

type Tile

type Tile struct {
	X, Y int
}

Tile is a 8x8-pixel section in a region map.

func (Tile) Distance

func (t Tile) Distance(other Tile) int

Distance computes the manhattan distance between two Tiles.

Jump to

Keyboard shortcuts

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