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.
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