0% found this document useful (0 votes)
120 views1 page

Gamemaster

This document describes a state machine for a game master that oversees gameplay. It has states for waiting for a game to start, playing the game, and a final countdown state. When events are received, like a timer expiring or new game status data, the state machine will transition between states and take different actions depending on the current state. For example, if a timer expires while waiting for the game to start, it will query for new game data. If construction is active once that data is received, it will transition to the playing state.

Uploaded by

api-350941923
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views1 page

Gamemaster

This document describes a state machine for a game master that oversees gameplay. It has states for waiting for a game to start, playing the game, and a final countdown state. When events are received, like a timer expiring or new game status data, the state machine will transition between states and take different actions depending on the current state. For example, if a timer expires while waiting for the game to start, it will query for new game data. If construction is active once that data is received, it will transition to the playing state.

Uploaded by

api-350941923
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Game Master State Machine

ES_Event runGameMaster(ES_Event ThisEvent){ //This function runs the top level hierarchical state machine for
the gameplay service
//store the current event
//declare a return event
//assume no errors
//set the next state equal to the current state, assume no state transition
//assume we're not changing states

//Respond to an ES_GAMEOVER event at this level


//take different actions depending on the state of the gameMaster state machine
//if we're waiting for the game to start
// Set currentEvent to the output of duringWaitingForGameToStart(currentEvent);
//take different actions depending on the current event
//if a timer has expired
//if the expired timer was the waiting for game to start timer
//indicate that we want new data from the LOC
//set the parameter to indicate a query for new game
//status data from the LOC
//send the event to the SSI service for sending to the
//LOC
// end if
//if the SSI service has retrieved new game status data
//update the local module-level game status variables with the
//new LOC response data
//if construction is active
//move to the gamePlaying state
// Set MakeTransition to true;
//else if the game has not yet started
//restart the timer to query the SSI to see if the game has
//started
// end if
//end if
// if current state is gamePlaying
//run the during function of this state before handling the event at this level
// if this event type
//if we want to switch to our end game strategy
//change to the final countdown state
//indicate that we're changing states
//end if

// end if
// if current state is finalCountdown
//run the during function of this state before handling the event at this level
// if this event type
//if a timer timed out
//if the game is over
//declare a new event
//the event indicates we should shut off the motors at
// the game's end
//turn on the construction active LED
//go back to the initial state of waiting for the game
//to start
//indicate that we're changing states
//end if
// end if
// if MakeTransition is set to true
{
// set current event to ES_EXIT currentEvent.EventType = ES_EXIT;
// run GameMaster using currentEvent
// set currentState to nextState
// runGameMaster using EntryEventKind
}
//return the event, assume no errors
}

You might also like