engine

package module
v0.0.0-...-0cd4edb Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

README

Playthos Game Engine Logo

godoc Go Report Card Coverage Status

Playthos Game Engine

Tutorial, Examples, Documentation
Feedback
Twitter
Facebook

Development

Alpha

Playthos is still under development. The current version is still alpha and will only go out of alpha once it can build the same game (using all of its features) on all three major platforms (Windows, Linux, and OS X) and development dependencies are automatically resolved when someone tries to use the engine.

Editor

The ultimate goal for Playthos is to become a game editor. The game engine is the first step to get there but it can only get there only once the source code and its continues development has become stable.

Intro

Playthos a open source game engine that promises to make game development easy. The goal is the lay out a foundation for anyone to contribute, and end up with an engine that puts a game together based on set of basic instructions.

Screenshots/GIFs

(Shape Rendering, Vector Animation, Color Animation, Physics, Collision) Playthos Game Engine Feature Demo

Games

Ludum Dare 39: Power Hero

Ludum Dare 40: Runner

Current Features

  • Windows, Linux, MacOS, Chrome, Firefox support
  • ECS
  • Standards library
  • 2D Graphics (GLFW & OpenGL)
  • 2D Sprite rendering (.png files only)
  • Fullscreen, window size, resolution settings
  • Camera manipulation
  • Keyboard input
  • Cursor input
  • Animation (vectors and sprites)
  • Audio (no Windows support yet, .wav files only)
  • Physics (velocity and acceleration)
  • Collision detection (simple AABB)
  • Custom scripting
  • Deployable executables
  • Assets library deploy with executable
  • Cross compilation (from Linux to Linux, Windows, and Mac OS X)
  • Dynamic compilation (only using systems that are supported)
  • Documentation

Upcoming Features

  • Robust shader system
  • Creator Hub (Prototype -> http://playthos.io)
  • Network (POC verified)
  • Euler camera (POC verified)
  • 3D graphics (POC verified)
  • Game Editor (POC verified)
  • Android platform (POC verified)
  • iOS platform

Documentation

Overview

Package engine orchestrates all the platforms, systems, entities, assets, and deploy procedures of an application.

ECS

Playthos uses the ECS pattern to manage how objects are perceived in the virtual space. ECS stands for Entity-component-system. What this means is that as a developer, you will be working with these in order to build an application and manipulate objects at runtime.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadAsset

func LoadAsset(path string)

LoadAsset instructs the current platform to load the asset correctly to be used for the application (binary, blob, etc.).

func NewIntegrant

func NewIntegrant(i IntegrantRoutine)

NewIntegrant registers and organises the integrant into its appropriate registries (Platformer, Listener).

func NewSystem

func NewSystem(s SystemRoutine)

NewSystem registers and organises the system into its appropriate registries (Drawer, Updater).

func RegisterPackage

func RegisterPackage(pckg *Package)

RegisterPackage adds a Package to engine's package registry.

TODO(F): Create a database of official package names.

func RegisterPlatform

func RegisterPlatform(n string, p *Platform)

RegisterPlatform adds a Platform to engine's platform registry.

TODO(F): Create a database of official platform names.

Types

type Component

type Component struct {
	// contains filtered or unexported fields
}

Component is added to an entity and used by systems to simulate the scene

func (*Component) Active

func (u *Component) Active() bool

Active returns unit active state

func (*Component) Engine

func (u *Component) Engine() *Engine

Engine returns unit engine pointer

func (*Component) Entity

func (c *Component) Entity() *Entity

Entity returns component's entity

func (*Component) ID

func (c *Component) ID() string

ID returns component id

func (*Component) SetActive

func (u *Component) SetActive(active bool)

SetActive sets unit active state

func (*Component) SetTag

func (u *Component) SetTag(t uint)

SetTag sets unit tag

func (*Component) Tag

func (u *Component) Tag() uint

Tag returns unit tag

type ComponentRoutine

type ComponentRoutine interface {
	SetActive(bool)
	// contains filtered or unexported methods
}

ComponentRoutine interface allows for generic component types to be handled by the engine

type Desktoper

type Desktoper interface {
	Platformer
	Asset(string) []byte
}

Desktoper interface used to load Assets for desktops and return []byte

type Drawer

type Drawer interface {
	SystemRoutine
	Draw()
}

Drawer interface used on components that render on screen.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine ties the ECS pattern together, manages application running state, and stores meta information.

func New

func New(n string, s ...*Settings) *Engine

New initializes an Engine instance that could either deploy (platforms and packages are detected automatically) or run the application with an optional Settings parameter.

func (*Engine) DeleteEntity

func (e *Engine) DeleteEntity(entity *Entity)

DeleteEntity removes entity from all systems (also empties its components) and the engine's registry

func (*Engine) Drawer

func (e *Engine) Drawer() Drawer

Drawer returns drawer system pointer

func (*Engine) Entities

func (e *Engine) Entities() []*Entity

Entities returns slice entity pointers

func (*Engine) Entity

func (e *Engine) Entity(id uint) *Entity

Entity returns Entity pointer by given ID

TODO(F): Find better way of searching entities by ID

func (*Engine) Integrant

func (e *Engine) Integrant(lookup IntegrantRoutine) IntegrantRoutine

Integrant returns an Integrant based on the given Integrant type

func (*Engine) Listener

func (e *Engine) Listener(lookup Listener) Listener

Listener returns a Listener based on the given Listener type

func (*Engine) Listeners

func (e *Engine) Listeners() []Listener

Listeners returns slice updater system pointers

func (*Engine) NewEntity

func (e *Engine) NewEntity() *Entity

NewEntity initializes and returns an empty Entity

TODO(F): Generate unique entity ID in "NewEntity()"

func (*Engine) Once

func (e *Engine) Once()

Once executes a single engine update call.

func (*Engine) Platformer

func (e *Engine) Platformer() Platformer

Platformer returns platformer integrant pointer

func (*Engine) SetSettings

func (e *Engine) SetSettings(settings *Settings)

SetSettings overwrites the engines settings

func (*Engine) Settings

func (e *Engine) Settings() *Settings

Settings returns the engines settings

func (*Engine) Start

func (e *Engine) Start()

Start updates engine state and executes the first update call.

func (*Engine) Stop

func (e *Engine) Stop()

Stop updates engine state in order to commence gracefully shutdown

func (*Engine) UPS

func (e *Engine) UPS() float64

UPS returns engine's updates per second (based on the latest 4 seconds)

func (*Engine) Updaters

func (e *Engine) Updaters() []Updater

Updaters returns slice updater system pointers

type Entity

type Entity struct {
	// contains filtered or unexported fields
}

Entity is used to group components with an unique identifier in order to form a virtual/game object

func (Entity) Active

func (u Entity) Active() bool

Active returns unit active state

func (*Entity) AddComponent

func (e *Entity) AddComponent(component ComponentRoutine)

AddComponent adds a new component to an entity

func (*Entity) Component

func (e *Entity) Component(lookup interface{}) ComponentRoutine

func (*Entity) Components

func (e *Entity) Components() []ComponentRoutine

ID returns unique entity identifier

func (Entity) Engine

func (u Entity) Engine() *Engine

Engine returns unit engine pointer

func (*Entity) ID

func (e *Entity) ID() uint

ID returns unique entity identifier

func (Entity) SetActive

func (u Entity) SetActive(active bool)

SetActive sets unit active state

func (Entity) SetTag

func (u Entity) SetTag(t uint)

SetTag sets unit tag

func (Entity) Tag

func (u Entity) Tag() uint

Tag returns unit tag

type Integrant

type Integrant struct {
	// contains filtered or unexported fields
}

Integrant used to sporadically execute with engine.

func (*Integrant) Active

func (u *Integrant) Active() bool

Active returns unit active state

func (*Integrant) Engine

func (u *Integrant) Engine() *Engine

Engine returns unit engine pointer

func (*Integrant) SetActive

func (u *Integrant) SetActive(active bool)

SetActive sets unit active state

func (*Integrant) SetTag

func (u *Integrant) SetTag(t uint)

SetTag sets unit tag

func (*Integrant) Tag

func (u *Integrant) Tag() uint

Tag returns unit tag

type IntegrantRoutine

type IntegrantRoutine interface {
	InitIntegrant()
	AddIntegrant(IntegrantRoutine)
	SetActive(bool)
	Destroy()
	// contains filtered or unexported methods
}

IntegrantRoutine plugs into engine to sporadically alter components.

type Listener

type Listener interface {
	IntegrantRoutine
	On(int, func(...int))
	IsDeploy()
	IsSet(int) bool
	Emit(int, int)
}

Listener interface used to listen and emit engine events.

type Package

type Package struct {
	Name         string
	Dependencies []string
	Resolves     []string
	Platforms    []string
}

Package defines a package name, it's dependencies on other packages, what it resolves, and the platforms it is targeted for.

type Platform

type Platform struct {
	Command             string
	Args                []string
	TagsArg             string
	Tags                []string
	GOOS                string
	CC                  string
	ARCH                string
	DeployFileExtension string
	BuildDependency     string
}

Platform defines how a platform is identified, deployed against, and packaged.

type Platformer

type Platformer interface {
	IntegrantRoutine
	IsDeploy()
	LoadAsset(string)
}

Platformer interface used to load and retrieve platform specific assets.

type Settings

type Settings struct {
	Fullscreen  bool
	ResolutionX float32
	ResolutionY float32
	Cursor      bool
}

Settings define how the engine is configured with the hardware or operating system

type System

type System struct {
	// contains filtered or unexported fields
}

System used to procedurally execute with engine.

func (*System) Active

func (u *System) Active() bool

Active returns unit active state

func (*System) Engine

func (u *System) Engine() *Engine

Engine returns unit engine pointer

func (*System) SetActive

func (u *System) SetActive(active bool)

SetActive sets unit active state

func (*System) SetTag

func (u *System) SetTag(t uint)

SetTag sets unit tag

func (*System) Tag

func (u *System) Tag() uint

Tag returns unit tag

type SystemRoutine

type SystemRoutine interface {
	InitSystem()
	Destroy()
	AddComponent(ComponentRoutine)
	DeleteEntity(*Entity)
	AddIntegrant(IntegrantRoutine)
	ComponentTypes() []ComponentRoutine
	SetActive(bool)
	// contains filtered or unexported methods
}

SystemRoutine plugs into engine to procedurally alter components.

type Updater

type Updater interface {
	SystemRoutine
	Update()
}

Updater interface used on components that update every game loop.

Notes

Bugs

  • Game loop currently performing very badly on windows

Directories

Path Synopsis
Package animation adds the Animation updater system with the clip and keyframe components
Package animation adds the Animation updater system with the clip and keyframe components
Package audio adds the Audio listener integrant with the clip, sound, source, and listener components.
Package audio adds the Audio listener integrant with the clip, sound, source, and listener components.
Package collision adds the Collision updater system with the collider component as well as helpers for collision detection
Package collision adds the Collision updater system with the collider component as well as helpers for collision detection
Package cursor adds the Cursor updater system.
Package cursor adds the Cursor updater system.
Package glfw adds the GLFW integrant.
Package glfw adds the GLFW integrant.
Package keyboard adds a empty Keyboard listener integrant to be overwriten by the platform specific integrant.
Package keyboard adds a empty Keyboard listener integrant to be overwriten by the platform specific integrant.
Package openal adds the OpenAL listener integrant.
Package openal adds the OpenAL listener integrant.
Package opengl adds the OpenGL drawer system.
Package opengl adds the OpenGL drawer system.
Package physics adds the Physics updater system with the rigidbody component.
Package physics adds the Physics updater system with the rigidbody component.
platforms
linux
Package linux adds linux support to engine.
Package linux adds linux support to engine.
web
Package web adds web/javascript support to engine.
Package web adds web/javascript support to engine.
windows
Package windows adds windows support to engine.
Package windows adds windows support to engine.
Package render adds an empty Render system to be overwritten by platform specific drawer with material, mesh, camera, and texture components.
Package render adds an empty Render system to be overwritten by platform specific drawer with material, mesh, camera, and texture components.
Package scripting adds the Scripting updater system.
Package scripting adds the Scripting updater system.
Package std add circle, rect, mesh, transform, vector, and color components
Package std add circle, rect, mesh, transform, vector, and color components
Package webgl adds the WebGL drawer system.
Package webgl adds the WebGL drawer system.

Jump to

Keyboard shortcuts

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