server

package
v0.0.0-...-95be186 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package server contains server-side code.

It runs sequential turns until the end of the game. Note that turn means a "day", and a Season ends with a disaster.

The server's EntryPoint function returns a slice of historic GameStates of the game until the end of the game.

The current structure of the turn is as follows:

runTurn
	startOfTurn
	runOrgs
		runIIGO
		runIIFO
		runIITO
	endOfTurn
		runOrgsEndOfTurn
			runIIGOEndOfTurn
			runIIFOEndOfTurn
			runIITOEndOfTurn
		runForage
		probeDisaster
		incrementTurnAndSeason
		deductCostOfLiving
		updateIslandLivingStatus

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultClientConfig

func DefaultClientConfig() map[shared.ClientID]ClientFactory

Types

type ClientFactory

type ClientFactory func(shared.ClientID) baseclient.Client

type SOMASServer

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

SOMASServer implements Server.

func (*SOMASServer) EntryPoint

func (s *SOMASServer) EntryPoint() ([]gamestate.GameState, error)

EntryPoint function that returns a list of historic gamestate.GameState until the game ends.

type Server

type Server interface {
	// EntryPoint function that returns a list of historic gamestate.ClientInfos until the
	// game ends.
	EntryPoint() ([]gamestate.GameState, error)
}

Server represents the primary server interface exposed to the simulation.

func NewSOMASServer

func NewSOMASServer(gameConfig config.Config) (Server, error)

NewSOMASServer returns an instance of the main server we use.

type ServerForClient

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

ServerForClient is a reference to the server for particular client. It implements baseclient.ServerReadHandle

func (ServerForClient) GetGameConfig

func (s ServerForClient) GetGameConfig() config.ClientConfig

GetGameConfig returns ClientConfig which is a subset of the entire Config that is visible to clients.

func (ServerForClient) GetGameState

func (s ServerForClient) GetGameState() gamestate.ClientGameState

GetGameState gets the ClientGameState for the client matching s.clientID in s.server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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