data

package
v0.0.0-...-567cf20 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2013 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area struct {
	ID        uint64
	Name      string
	Generated bool

	Version uint64
	Type    AreaType

	Rand *Rand

	Tiles [areaSize][areaSize]*Tile
}

func (*Area) Generate

func (a *Area) Generate(w *World)

type AreaType

type AreaType uint16
const (
	Road AreaType = iota
	Town
	Building
)

type Object

type Object struct {
	R, G, B uint8
}

func NewPlant

func NewPlant(r *Rand, significant bool) *Object

type Rand

type Rand struct {
	Source rand.Source
}

func NewRand

func NewRand(seed int64) *Rand

func (*Rand) Float32

func (r *Rand) Float32() float32

Float32 returns, as a float32, a pseudo-random number in [0.0,1.0).

func (*Rand) Float64

func (r *Rand) Float64() float64

Float64 returns, as a float64, a pseudo-random number in [0.0,1.0).

func (*Rand) Int

func (r *Rand) Int() int

Int returns a non-negative pseudo-random int.

func (*Rand) Int31

func (r *Rand) Int31() int32

Int31 returns a non-negative pseudo-random 31-bit integer as an int32.

func (*Rand) Int31n

func (r *Rand) Int31n(n int32) int32

Int31n returns, as an int32, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func (*Rand) Int63

func (r *Rand) Int63() int64

Int63 returns a non-negative pseudo-random 63-bit integer as an int64.

func (*Rand) Int63n

func (r *Rand) Int63n(n int64) int64

Int63n returns, as an int64, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func (*Rand) Intn

func (r *Rand) Intn(n int) int

Intn returns, as an int, a non-negative pseudo-random number in [0,n). It panics if n <= 0.

func (*Rand) Noise

func (r *Rand) Noise(octaves int) noise.Noise

Noise returns a perlin noise generator with the given number of octaves.

func (*Rand) Perm

func (r *Rand) Perm(n int) []int

Perm returns, as a slice of n ints, a pseudo-random permutation of the integers [0,n).

func (*Rand) Rand

func (r *Rand) Rand() *Rand

Rand returns a new *Rand with a seed given by Int63().

func (*Rand) Uint32

func (r *Rand) Uint32() uint32

Uint32 returns a pseudo-random 32-bit value as a uint32.

type Teleport

type Teleport struct {
	Area uint64
	X, Y int
}

type Terrain

type Terrain struct {
	R, G, B  uint8
	Passable bool
}

func NewBuildingTerrain

func NewBuildingTerrain(r *Rand, passable bool) *Terrain

func NewTerrain

func NewTerrain(r *Rand) *Terrain

type Tile

type Tile struct {
	Teleport *Teleport
	Terrain  *Terrain
	Objects  []*Object
}

type World

type World struct {
	Version uint64
	Seed    int64

	Rand *Rand

	AreaCount   uint64
	CurrentArea uint64
	// contains filtered or unexported fields
}

func (*World) Area

func (w *World) Area(index uint64) *Area

func (*World) Init

func (w *World) Init()

func (*World) NewArea

func (w *World) NewArea(r *Rand, t AreaType) *Area

func (*World) SaveArea

func (w *World) SaveArea(a *Area)

Jump to

Keyboard shortcuts

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