space

package
v0.0.0-...-37f97d0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthCoordinate        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCoordinate          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCoordinate = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthSector        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSector          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSector = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthTile        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTile          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTile = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthWorld        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowWorld          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupWorld = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Terrain_name = map[int32]string{
	0: "Sky",
	1: "Floor",
	2: "Pillar",
	3: "Wall",
}
View Source
var Terrain_value = map[string]int32{
	"Sky":    0,
	"Floor":  1,
	"Pillar": 2,
	"Wall":   3,
}

Functions

func IsCollidable

func IsCollidable(t Terrain) bool

IsCollidable returns true if terrain t has collision.

Types

type App

Application layer for space domain.

type Coordinate

type Coordinate struct {
	Position  geometry.Vec3                         `protobuf:"bytes,1,opt,name=Position,proto3" json:"Position"`
	Direction geometry.Vec3                         `protobuf:"bytes,2,opt,name=Direction,proto3" json:"Direction"`
	TS        uint64                                `protobuf:"varint,3,opt,name=TS,proto3" json:"TS,omitempty"`
	EntityID  github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,4,opt,name=EntityID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"EntityID"`
}

func NewPopulatedCoordinate

func NewPopulatedCoordinate(r randyCoordinate, easy bool) *Coordinate

func (*Coordinate) Descriptor

func (*Coordinate) Descriptor() ([]byte, []int)

func (*Coordinate) Equal

func (this *Coordinate) Equal(that interface{}) bool

func (*Coordinate) GetDirection

func (m *Coordinate) GetDirection() geometry.Vec3

func (*Coordinate) GetPosition

func (m *Coordinate) GetPosition() geometry.Vec3

func (*Coordinate) GetTS

func (m *Coordinate) GetTS() uint64

func (*Coordinate) GoString

func (this *Coordinate) GoString() string

func (*Coordinate) Marshal

func (m *Coordinate) Marshal() (dAtA []byte, err error)

func (*Coordinate) MarshalTo

func (m *Coordinate) MarshalTo(dAtA []byte) (int, error)

func (*Coordinate) MarshalToSizedBuffer

func (m *Coordinate) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Coordinate) ProtoMessage

func (*Coordinate) ProtoMessage()

func (*Coordinate) Reset

func (m *Coordinate) Reset()

func (*Coordinate) Size

func (m *Coordinate) Size() (n int)

func (*Coordinate) String

func (this *Coordinate) String() string

func (*Coordinate) Unmarshal

func (m *Coordinate) Unmarshal(dAtA []byte) error

func (*Coordinate) XXX_DiscardUnknown

func (m *Coordinate) XXX_DiscardUnknown()

func (*Coordinate) XXX_Marshal

func (m *Coordinate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Coordinate) XXX_Merge

func (m *Coordinate) XXX_Merge(src proto.Message)

func (*Coordinate) XXX_Size

func (m *Coordinate) XXX_Size() int

func (*Coordinate) XXX_Unmarshal

func (m *Coordinate) XXX_Unmarshal(b []byte) error

type FilterCoordinate

type FilterCoordinate struct {
	EntityID  gulid.ID
	Rectangle geometry.Rectangle
}

FilterCoordinate object for entity domain.

type FilterSector

type FilterSector struct {
	ID  gulid.ID
	IDs []gulid.ID
}

FilterSector object for space domain.

type FilterTileSet

type FilterTileSet struct {
	ID  gulid.ID
	IDs []gulid.ID
}

FilterTileSet store filters for tileset.

type FilterWorld

type FilterWorld struct {
	gulid.ID
}

type Orientation

type Orientation uint64
const (
	Horizontal Orientation = iota
	Vertical
)

func NewOrientationRand

func NewOrientationRand() Orientation

func (Orientation) Orthogonal

func (o Orientation) Orthogonal() Orientation

type Path

type Path struct {
	Start    Platform
	End      Platform
	Width    uint64
	Variance uint64
}

type Platform

type Platform struct {
	Position geometry.Vec3
	Shape    Shape
}

Platform represents tm floor area.

type Sector

type Sector struct {
	ID        github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"ID"`
	Dim       geometry.Vec3                         `protobuf:"bytes,2,opt,name=Dim,proto3" json:"Dim"`
	Adjacents map[string]geometry.Vec3              `` /* 149-byte string literal not displayed */
	TileMap   TileMap                               `protobuf:"bytes,4,opt,name=TileMap,proto3" json:"TileMap"`
}

func NewPopulatedSector

func NewPopulatedSector(r randySector, easy bool) *Sector

func (*Sector) Descriptor

func (*Sector) Descriptor() ([]byte, []int)

func (*Sector) Equal

func (this *Sector) Equal(that interface{}) bool

func (*Sector) GetAdjacents

func (m *Sector) GetAdjacents() map[string]geometry.Vec3

func (*Sector) GetDim

func (m *Sector) GetDim() geometry.Vec3

func (*Sector) GetTileMap

func (m *Sector) GetTileMap() TileMap

func (*Sector) GoString

func (this *Sector) GoString() string

func (*Sector) Marshal

func (m *Sector) Marshal() (dAtA []byte, err error)

func (*Sector) MarshalTo

func (m *Sector) MarshalTo(dAtA []byte) (int, error)

func (*Sector) MarshalToSizedBuffer

func (m *Sector) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Sector) ProtoMessage

func (*Sector) ProtoMessage()

func (*Sector) Reset

func (m *Sector) Reset()

func (*Sector) Size

func (m *Sector) Size() (n int)

func (*Sector) String

func (this *Sector) String() string

func (*Sector) Unmarshal

func (m *Sector) Unmarshal(dAtA []byte) error

func (*Sector) XXX_DiscardUnknown

func (m *Sector) XXX_DiscardUnknown()

func (*Sector) XXX_Marshal

func (m *Sector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Sector) XXX_Merge

func (m *Sector) XXX_Merge(src proto.Message)

func (*Sector) XXX_Size

func (m *Sector) XXX_Size() int

func (*Sector) XXX_Unmarshal

func (m *Sector) XXX_Unmarshal(b []byte) error

type Sectors

type Sectors []Sector

func (Sectors) IDsMap

func (ss Sectors) IDsMap() map[string]uint64

IDsMap return IDs in a convenient format to assign world.sectors.

type Shape

type Shape int32
const (
	Square Shape = iota
	Rectangle
	Circle
	Cross

	// Keep this at the end plz, convenience hack
	LenShape
)

type StoreCoordinate

type StoreCoordinate interface {
	UpsertCoordinate(context.Context, Coordinate) error
	FetchManyCoordinate(context.Context, FilterCoordinate) (map[string]Coordinate, error)
	DeleteCoordinate(context.Context, FilterCoordinate) (Coordinate, error)
}

StoreCoordinate object for entity domain.

type StoreSector

type StoreSector interface {
	UpsertSector(context.Context, Sector) error
	UpsertManySector(context.Context, []Sector) error
	FetchSector(context.Context, FilterSector) (Sector, error)
	FetchManySector(context.Context, chan<- Sector, FilterSector) error
	DeleteSector(context.Context, FilterSector) error
}

Store layer for space domain.

type StoreTileSet

type StoreTileSet interface {
	UpsertTileSet(context.Context, TileSet) error
	FetchTileSet(context.Context, FilterTileSet) (TileSet, error)
	FetchManyTileSet(context.Context, chan<- TileSet, FilterTileSet) error
	DeleteTileSet(context.Context, FilterTileSet) error
}

StoreTileSet layer for tileset domain.

type StoreWorld

type StoreWorld interface {
	UpsertWorld(context.Context, World) error
	FetchWorld(context.Context, FilterWorld) (World, error)
	DeleteWorld(context.Context, FilterWorld) error
}

type Terrain

type Terrain int32
const (
	Sky    Terrain = 0
	Floor  Terrain = 1
	Pillar Terrain = 2
	Wall   Terrain = 3
)

func (Terrain) EnumDescriptor

func (Terrain) EnumDescriptor() ([]byte, []int)

func (Terrain) String

func (x Terrain) String() string

type TileMap

type TileMap struct {
	Set TileSet       `protobuf:"bytes,1,opt,name=Set,proto3" json:"Set"`
	Dim geometry.Vec3 `protobuf:"bytes,2,opt,name=Dim,proto3" json:"Dim"`
	Map []Terrain     `protobuf:"varint,3,rep,packed,name=Map,proto3,enum=space.Terrain" json:"Map,omitempty"`
}

func NewPopulatedTileMap

func NewPopulatedTileMap(r randyTile, easy bool) *TileMap

func NewTileMap

func NewTileMap(dim geometry.Vec3) TileMap

NewTileMap creates a new unset tilemap.

func (*TileMap) Descriptor

func (*TileMap) Descriptor() ([]byte, []int)

func (*TileMap) Equal

func (this *TileMap) Equal(that interface{}) bool

func (*TileMap) GeneratePaths

func (tm *TileMap) GeneratePaths(ps []Platform, n, variance, width, widthVariance uint64)

GeneratePaths generates random paths between platforms. MUST BE APPLIED on previous generated platforms on SAME AREA.

func (*TileMap) GeneratePlatforms

func (tm *TileMap) GeneratePlatforms(n, size, variance uint64) []Platform

GeneratePlatforms generate n platforms with variant size and write them into tm. Returns platform array.

func (*TileMap) GetDim

func (m *TileMap) GetDim() geometry.Vec3

func (*TileMap) GetMap

func (m *TileMap) GetMap() []Terrain

func (*TileMap) GetSet

func (m *TileMap) GetSet() TileSet

func (*TileMap) GoString

func (this *TileMap) GoString() string

func (*TileMap) Marshal

func (m *TileMap) Marshal() (dAtA []byte, err error)

func (*TileMap) MarshalTo

func (m *TileMap) MarshalTo(dAtA []byte) (int, error)

func (*TileMap) MarshalToSizedBuffer

func (m *TileMap) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TileMap) ProtoMessage

func (*TileMap) ProtoMessage()

func (*TileMap) Reset

func (m *TileMap) Reset()

func (TileMap) SectorBreaks

func (tm TileMap) SectorBreaks(dim geometry.Vec3) []Sector

SectorBreaks returns sectors from a generated tilemap. dim is maximum sector size splitting.

func (*TileMap) Size

func (m *TileMap) Size() (n int)

func (*TileMap) String

func (this *TileMap) String() string

func (*TileMap) Unmarshal

func (m *TileMap) Unmarshal(dAtA []byte) error

func (*TileMap) XXX_DiscardUnknown

func (m *TileMap) XXX_DiscardUnknown()

func (*TileMap) XXX_Marshal

func (m *TileMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TileMap) XXX_Merge

func (m *TileMap) XXX_Merge(src proto.Message)

func (*TileMap) XXX_Size

func (m *TileMap) XXX_Size() int

func (*TileMap) XXX_Unmarshal

func (m *TileMap) XXX_Unmarshal(b []byte) error

type TileSet

type TileSet struct {
	// ID MUST be delivered by mapper API as filename.png
	// e.g: http://url/03432IUHUI.png
	ID github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"-"`
	// e.g: dungeon,desert,mountain,etc.
	Name string `protobuf:"bytes,2,opt,name=Name,proto3" json:"Name,omitempty"`
	// Size of 1 tile in x and y in pixels
	Size_ uint64 `protobuf:"varint,3,opt,name=Size,proto3" json:"Size,omitempty"`
	// Number of tile per line
	X uint64 `protobuf:"varint,4,opt,name=X,proto3" json:"X,omitempty"`
	// Number of tile per column
	Y uint64 `protobuf:"varint,5,opt,name=Y,proto3" json:"Y,omitempty"`
	// Terrains key -> Terrain enum (int32 default pb type)
	// Terrains value -> absolute index in tileset
	Terrains map[int32]uint64 `` /* 159-byte string literal not displayed */
}

func NewPopulatedTileSet

func NewPopulatedTileSet(r randyTile, easy bool) *TileSet

func (*TileSet) Descriptor

func (*TileSet) Descriptor() ([]byte, []int)

func (*TileSet) Equal

func (this *TileSet) Equal(that interface{}) bool

func (*TileSet) GetName

func (m *TileSet) GetName() string

func (*TileSet) GetSize_

func (m *TileSet) GetSize_() uint64

func (*TileSet) GetTerrains

func (m *TileSet) GetTerrains() map[int32]uint64

func (*TileSet) GetX

func (m *TileSet) GetX() uint64

func (*TileSet) GetY

func (m *TileSet) GetY() uint64

func (*TileSet) GoString

func (this *TileSet) GoString() string

func (*TileSet) Marshal

func (m *TileSet) Marshal() (dAtA []byte, err error)

func (*TileSet) MarshalTo

func (m *TileSet) MarshalTo(dAtA []byte) (int, error)

func (*TileSet) MarshalToSizedBuffer

func (m *TileSet) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TileSet) ProtoMessage

func (*TileSet) ProtoMessage()

func (*TileSet) Reset

func (m *TileSet) Reset()

func (*TileSet) Size

func (m *TileSet) Size() (n int)

func (*TileSet) String

func (this *TileSet) String() string

func (*TileSet) Unmarshal

func (m *TileSet) Unmarshal(dAtA []byte) error

func (*TileSet) XXX_DiscardUnknown

func (m *TileSet) XXX_DiscardUnknown()

func (*TileSet) XXX_Marshal

func (m *TileSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TileSet) XXX_Merge

func (m *TileSet) XXX_Merge(src proto.Message)

func (*TileSet) XXX_Size

func (m *TileSet) XXX_Size() int

func (*TileSet) XXX_Unmarshal

func (m *TileSet) XXX_Unmarshal(b []byte) error

type World

type World struct {
	ID      github_com_elojah_game_02_pkg_ulid.ID `protobuf:"bytes,1,opt,name=ID,proto3,customtype=github.com/elojah/game_02/pkg/ulid.ID" json:"ID"`
	Dim     geometry.Vec3                         `protobuf:"bytes,2,opt,name=Dim,proto3" json:"Dim"`
	Sectors map[string]uint64                     `` /* 146-byte string literal not displayed */
}

func NewPopulatedWorld

func NewPopulatedWorld(r randyWorld, easy bool) *World

func NewWorld

func NewWorld(dim geometry.Vec3, sectors []Sector) World

NewWorld returns a World with associated sectors.

func (*World) Descriptor

func (*World) Descriptor() ([]byte, []int)

func (*World) Equal

func (this *World) Equal(that interface{}) bool

func (*World) GetDim

func (m *World) GetDim() geometry.Vec3

func (*World) GetSectors

func (m *World) GetSectors() map[string]uint64

func (*World) GoString

func (this *World) GoString() string

func (*World) Marshal

func (m *World) Marshal() (dAtA []byte, err error)

func (*World) MarshalTo

func (m *World) MarshalTo(dAtA []byte) (int, error)

func (*World) MarshalToSizedBuffer

func (m *World) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*World) ProtoMessage

func (*World) ProtoMessage()

func (*World) Reset

func (m *World) Reset()

func (*World) Size

func (m *World) Size() (n int)

func (*World) String

func (this *World) String() string

func (*World) Unmarshal

func (m *World) Unmarshal(dAtA []byte) error

func (*World) XXX_DiscardUnknown

func (m *World) XXX_DiscardUnknown()

func (*World) XXX_Marshal

func (m *World) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*World) XXX_Merge

func (m *World) XXX_Merge(src proto.Message)

func (*World) XXX_Size

func (m *World) XXX_Size() int

func (*World) XXX_Unmarshal

func (m *World) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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