executor

package
v0.0.0-...-f88b513 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 13 Imported by: 0

README

Game Executor

DownFlux game engine.

Documentation

Overview

Package executor contains the logic for the core game loop.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor encapsulates logic for executing the core game loop.

func New

func New(
	visitors *visitorlist.List,
	state *gamestate.GameState,
	dcs *dirty.List,
	fsmSchedule *schedule.Schedule,
) *Executor

func (*Executor) AddClient

func (e *Executor) AddClient() (id.ClientID, error)

AddClient creates a new Client to be tracked by the Executor.

func (*Executor) ClientChannel

func (e *Executor) ClientChannel(cid id.ClientID) (<-chan *apipb.StreamDataResponse, error)

ClientChannel returns a read-only game state channel. This is consumed by the gRPC server and forwarded to the end-user.

func (*Executor) ClientExists

func (e *Executor) ClientExists(cid id.ClientID) bool

ClientExists tests for if the specified Client UUID is currently being tracked by the Executor.

func (*Executor) Run

func (e *Executor) Run() error

Run executes the core game loop.

func (*Executor) Schedule

func (e *Executor) Schedule(actions []action.Action) error

func (*Executor) StartClientStream

func (e *Executor) StartClientStream(cid id.ClientID) error

StartClientStream instructs the Executor to mark the associated client ready for game state updates.

func (*Executor) Status

func (e *Executor) Status() *gdpb.ServerStatus

Status returns the current Executor status.

func (*Executor) Stop

func (e *Executor) Stop() error

Stop will teardown the Executor and close all client channels. This is called at the end of the game.

func (*Executor) StopClientStreamError

func (e *Executor) StopClientStreamError(cid id.ClientID) error

StopClientStreamError instructs the Executor to mark the associated client as having been disconnected, and stop broadcasting future game states to the linked channel.

Jump to

Keyboard shortcuts

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