3 Requirements Models
3.2 Behavioural Requirements (Operation Model and Protocol Model)
Operation Schema:
Operation: CGS::setupRemoteClient() Scope: ClientConfiguration,Error
New: newNetworkClient : NetworkClient;newError:Error Messages: Server::{displayClientSetup}
Client::{displayErrors}
Description: The following operations is applied by the RemoteClient during game setup/initialization in order to create a new Unity NetworkClient object to facilitate networked gameplay. Consequently, this must be done prior to game launch/play and cannot be issued by the RemoteClient when a game is already underway. Upon success, the Server issues
CGS::displayClientSetup() to the RemoteClient to inform of a successful client creation. Otherwise, in the event of any errors, the system will notify the RemoteClient of these by a call to CGS::displayErrors().
Operation: CGS::setupLocalClient()
Scope: ClientConfiguration, ServerConfiguration,Error New: newNetworkClient : NetworkClient;newError:Error Messages: Server::{displayClientSetup}
LocalClient::{displayErrors}
Description: The following operations is applied by the LocalClient during game setup/initialization in order to create a new Unity NetworkClient object for localhost to facilitate networked gameplay. Note, since the client is local, it automatically connects to the local server, i.e. localhost. Consequently, this must be done prior to game launch/play and cannot be issued by the LocalClient when a game is already underway. Upon success, the Server issues CGS::displayClientSetup() to the LocalClient to inform of a
successful client creation. Otherwise, in the event of any errors, the system will notify the LocalClient of these by a call to
CGS::displayErrors().
Operation: CGS::initiateNewGame()
Scope: GameState, ServerConfiguration,Error
New: serverConfiguration:ServerConfiguration,newError:Error
Messages: Server::{serverCreatedAck(ServerConfiguration serverConfig)}
Server::{displayErrors}
Description: The operation is applied when a user of CGS wants to start to hosting a game. This operation is a dispatcher function from Server to tell CGS to host a Server with the default setup and configurations for starting a new game. When CGS receives the request, CGS does a system call to setup a UDP socket on a currently available port. Then, it returns a serverConfig object - containing important network information like IP, Port and LAN DNS - back to the server process to notify of a successful server creation by calling CGS::serverCreatedAck(serverConfig). During the process, if there is any errors while setting up the server, return error to the Server by CGS::displayErrors(error).
Operation: CGS::initiateLoadGame()
Scope: GameState, ServerConfiguration,Error
New: newError:Error
Messages: Server::{serverCreatedAck(ServerConfiguration serverConfig)}
Server::{displayErrors(Error error)}
Description: The operation is applied when a user of CGS wants to start hosting a past saved game. This operation is a dispatcher function from Server to tell CGS to host a Server with a previously saved setup and
configuration. When CGS receives the request, CGS first parses a saved game configuration on the local file system. Then, CGS does a system call to setup a UDP socket on a currently available port. It then returns a serverConfig object - containing important network information like IP, Port and LAN DNS - back to the server process to notify of a successful server creation by calling CGS::serverCreatedAck(serverConfig). During the process, if there is any errors while setting up the server, return error to the Server by CGS::displayErrors(error).
Operation: CGS::setSettings(int[] settingVector) Scope: GameState, Board,Error
New: newError:Error
Messages: Client::{displayGameSetup, displayErrors}
Description: The following operation is applied by the Server during the game setup phase in order to set a fixed setting for the various game settings such as victory point, board size etc; as such, this must be executed prior to game launch/play. Upon execution, the Server will call
CGS::displayGameSetup() to notify Client of the current game settings.
In the event of any errors, the system will notify the Client of these by a call to CGS::displayErrors().
Operation: CGS::selectBoard (Board newBoard) Scope: GameState, Board,Error
New: newError:Error
Messages: RemoteClient::{displayGameSetup, displayErrors}
Description: The following operation is applied by the Server during the game setup phase in order to select a board that RemoteClients can vote on and as such must be executed prior to game launch/play. Upon execution, the Server will call CGS::displayGameSetup() to notify RemoteClient of the current board selection. In the event of any errors, the system will notify the RemoteClient of these by a call to CGS::displayErrors().
Operation: CGS::lockBoardVote (Boolean vote) Scope: GameState, Board,Error
New: newError:Error
Messages: Server::{lockBoardVoteAck}
RemoteClient::{displayErrors}
Description: The following operation is applied by Server during game setup in order to lock in board selection after consensus to prevent further voting by RemoteClients. This must be done prior to game launch/play and during the game setup phase. Upon successful completion, the system issues CGS::lockBoardVoteAck() to the Server to notify that board voting has been disabled. In the event of errors, the system will notify the
RemoteClient of these by a call to CGS::displayErrors().
Operation: CGS::selectSavedGame (Game saveGame)
Scope: GameState, Error
New: newGameState : GameState,newError:Error
Messages: Server::{displayGameSetup}
Client::{displayError}
Description: The following operation is applied by the Server, prior to loading (ie. prior to game launch/play), in order to select a previously saved game to load.
Consequently, this must be done prior to game launch/play and cannot be issued by the Server when a game is already underway. Upon
selection, a new GameState object for the selected game is created from which the requested game is then loaded. The system then calls
CGS::displayGameSetup() to inform the Server that a game setup has been selected. In the event of any errors, the system will notify the Client of these by a call to CGS::displayErrors().
Operation: CGS::startGame()
Scope: Player, Board, GameState,Error
New: newGameState : GameState; newPlayer : Player; newBoard : Board, newError:Error
Messages: Server::{startGameAck}
Client::{displayError}
Description: The following operation is applied by the Server, after game initialization and setup, to launch the initialized and setup game. Consequently, this must be done prior to game play and cannot be issued by the Server when a game is already underway. Upon successful completion, a new GameState object is created (from the locked in board selection and game settings) and the system issues CGS::startGameAck() to the Server to inform that the game is starting. As always, in the event of any errors, the system will notify the Client of these by a call to
CGS::displayErrors().
Operation: CGS::joinGame(String IP)
Scope: GameState, ClientConfiguration, ServerConfiguration,Error
New: newError:Error
Messages: Server::{joinGameAck}
RemoteClient::{onConnection, displayErrors}
Description: The following operation is applied by RemoteClient at game setup/
initialization when attempting to join a game lobby. To do this, the Client must indeed be RemoteClient - as LocalClient creates the game and is connected to it locally (localHost) - and as stated logically this is must done prior to game setup and game play. Upon successful joining, the Server issues CGS::joinGameAck() to acknowledge that the
RemoteClient has indeed successfully joined the game - note, as stated above, this is a prerequisite to starting a game. The system then calls CGS::onConnection() to inform the RemoteClient of a successful
connection to the Server. In the event of any errors, the system will notify the RemoteClient of these by a call to CGS::displayErrors().
Operation: CGS::boardVote(Boolean vote) Scope: Board, GameState,Error
New: newError:Error
Messages: RemoteClient::{displayBoardVote displayErrors}
Description: The following operation is applied by RemoteClient at game setup when attempting to agree on a board selection for the forthcoming game.
Clearly, the game must not already be underway for this to be done correctly. Upon execution, the Server will call CGS::displayBoardVote() to confirm the RemoteClient’s board vote. In the event of any errors, the system will notify the RemoteClient of these by a call to
CGS::displayErrors().
Operation: CGS::selectCharacter(Player player) Scope: Player, GameState, Board,Error
New: newError:Error
Messages: Client::{displayGameSetup, displayErrors}
Description: The following operation is applied by Client at game setup when selecting an in-game character to play as. To do this, a game must not already be underway, i.e. not in-game. After a character selection, the system will respond by calling CGS::displayGameSetup() to notify Client of the current avatar placement in the game board and board selection.
In the event of any errors, the system will notify the Client of these by a call to CGS::displayErrors().
Operation: CGS::saveGame( )
Scope: Player, Message, GameState,Error
New: newError:Error
Messages: Server::{saveGameAck}
LocalClient::{displayError}
Description: The following operation is applied by the LocalClient in order to save the current game state to disk. LocalClient must currently be active in-game, (ie. a game is currently underway) and must indeed be local, i.e. not RemoteClient, as only LocalClient may save the game. Upon issuing of this command, the system will respond by creating a save file for the current game and writing the game state to it accordingly. The Server then calls CGS::saveGameAck() in the event that the game has been saved correctly, without any errors. Otherwise, the system will notify the LocalClient of these by a call to CGS::displayError().
Operation: CGS::sendGameSaveMsg(String message) Scope: Player, Message,Error
New: newMessage : Message,newError:Error
Messages: LocalClient::{displayGameSaveMsg, displayErrors}
Description: The following operation is applied by the Server after the LocalClient has issued a saveGame() call, i.e. LocalClient::{saveGame}, to confirm whether the LocalClient’s game state has been correctly saved to disk;
an appropriate Message object is created and issued to LocalClient. In the event of any errors, the system will notify the LocalClient of these by a call to CGS::displayErrors().
Operation: CGS::rollDice()
Scope: Player, Die, GamePiece, BarbarianShip,Error
New: newError:Error
Messages: Server::{diceOutcomeAck}
Description: The following operation is applied when the Client requests a dice roll from the system. To do this, it must currently be the Client’s turn and the Client must not have already rolled the dice as dice rolls are allowable only once per turn for all Clients. The system then responds by calling CGS::diceOutcomeAck(), to notify the Server of the dice roll outcome.
Operation: CGS::broadcastDiceOutcome(Array<Die> diceOutcome) Scope: Player, Die, GamePiece, BarbarianShip, StackedProgressCard, New: newResource : Resource; newCommodity : Commodity;
newProgressCard : ProgressCard
Description: The following operation is applied when a dice roll has been successfully accomplished by a player, following a Client::rollDice() call and a
corresponding system CGS::diceOutcomeAck() call. The system will then call one or more of the following:
Client::forceResourceAndCommoditiesDiscard - if a 7 is rolled and the Client currently has too many of these,
Client::forceProgressCardDiscard - if a Client is allowed to draw a progress card following the dice roll but exceeds the limit,
Client::displayRobberOutcome - if a 7 is rolled after the first barbarian attack has occurred and the Client moves the robber,
Client::displayRobberOutcome - if a 7 is rolled after the first barbarian attack has occurred and the Client moves the pirate,
Client::displayBarbarianAttackOutcome - if the barbarian ship is rolled (on the event die) and the barbarians then reach the last red-circled space,
Client::displayProgressCardOutcome - if the Client is eligible to draw a progress card this dice roll and elects to do so,
Once the outcome of the dice roll has been resolved by one or more of the above having been called, the system then updates the game state for all Clients across the network by calling CGS::updateGameState().
For non-7 numerical dice rolls, this operation may generate new resources and commodities depending on the number rolled and the Client’s build unit layout, i.e. if the Client has a build unit (settlement or city) adjacent to one of the tiles corresponding to the rolled numerical result.
It may also generate a new progress card client-side - depending on the result of the event die, the red-colored numbered die and the Client’s current city improvements - and finally may also award a victory point to the Client following an immediate play of a ‘Constitution’ or ‘Printer’ card after having possibly being drawn from the corresponding stacks
following the dice roll.
Operation: CGS::drawProgressCard
Scope: StackOfProgressCards, Player, GameState,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have gained eligibility to draw a progress card, either by a dice roll combination or by tieing up with another player in defending Catan. The effect of this operation will be to enable the Client to draw the topmost card from the appropriate progress card stack and a successful progress card draw message will be output. If the wrong card was attempted to be drawn, then a displayError message is shown.
Operation: CGS::discardProgressCard
Scope: StackOfProgressCards, Player, GameState,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have just played a progress card. The effect of this operation will be to remove that progress card from Client’s hand and place it at the bottom of its appropriate progress card stack. If there was a network connection error during this routine, then a displayError message is shown.
Operation: CGS::discardResourceAndCommodities Scope: Asset, Player, GameState,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Either Client must have purchased an in-game entity that would cause them to spend resources/commodities, or an in-game event must have caused ClientRemote to steal resource/commodities from Client, or a specific dice roll must force Client to discard some cards in their hand, or a trade must have been conducted between Client and ClientRemote/the bank. The effect of this operation will be to remove that resource/
commodity card from Client. If there was a network connection error during this routine, then a displayError message is shown.
Operation: CGS::moveRobber
Scope: Robber, Board, GameState,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have gained permission to move the robber (either by a dice roll, knight action or progress card). The effect of this operation will be to enable the Client to move the Robber game piece from one hex to another on the game board. The Client then is eligible to steal 1 random Resource/Commodity card from RemoteClient if they have a settlement/
city on an intersection of the new location of the Robber and a
successfully moved robber message will be output. In the case of Client attempting to move to an illegal location (sea hex, intersection, edge, etc.), then a displayError message is shown.
Operation: CGS::playProgressCard
Scope: Die, FlipChart, Commodity, Resource, Settlement, Road, Ship, City, Knight, Tile, Board, Player, Edge, Intersection, Robber, Pirate, Merchant, Trade, GameState,Error
New: newResource : Resource; newCommodity : Commodity; newCity : City;
newRoad : Road; newShip : Ship; newTrade : Trade ;newError:Error Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have at least one progress card in their hand. The effect of this operation will be to invoke the respective effect of the Progress Card that the Client selected. The required routine will run, conclude, the Progress Card will then be removed from the Client’s hand of progress cards and a successful progress card activation message will be output.
If at any point within the sub-routine an illegal action was performed, then a displayError message is shown.
Operation: CGS::promoteKnight Scope: Knight, Board, Player,Error;
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must at least have either one Basic Knight unit or one Strong knight unit and level 3 politics city improvement. If Client has enough resources, the effect of this operation will be to promote the strength level of the selected knight by 1 stage, switch the coin asset of that knight’s game object to its higher strength successor on the GUI and send a successful promotion message to the Client. In the case of insufficient resources, the operation outputs a display error message.
Operation: CGS::moveKnight
Scope: Knight, Board, Player,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have at least one currently active knight that has not
performed an action in the current turn, and there should be at least one adjacent empty intersection to the knight that is connected by Client’s roads and/or ships. The effect of this operation will be to move a knight game object to another intersection on the board that can be reached by Client’s roads/ships, render the knight’s game object at its new location on the GUI, switch the coin asset of that knight’s game object to its inactive (black-and-white) side on the GUI, set it to its inactive mode and send a successful move action message to the Client. If a knight was attempted to move to an illegal intersection, the operation outputs a display error message.
Operation: CGS::chaseKnight
Scope: Knight, Board, Player,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have at least one currently active knight that has not performed an action in the current turn, and that knight’s location must have at least 1 intersection, connected to by Client’s roads, which is occupied by ClientRemote’s knight of a lower strength stage. The effect of this operation will be to move a knight game object to another
intersection on the board that can be reached by Client’s roads/ships which was occupied by ClientRemote’s knight initially. Then it moves back ClientRemote’s knight following the same ruleset and render the displaced knight at another empty intersection that ClientRemote’s roads are connected to on the GUI. Then render Client’s knight’s game object at its new location on the GUI, switch the coin asset of that knight’s game object to its inactive (black-and-white) side on the GUI, set it to its
inactive mode and send a successful displacement action message to Client.
Operation: CGS::activateKnight Scope: Knight, Board, Player,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have at least one currently active knight that has not
performed an action in the current turn. If Client has enough resources, the effect of this operation will be to trigger the active mode of the selected knight, switch the coin asset of that knight’s game object to its active (coloured) side on the GUI, and send a successful knight
activation message to the Client. In the case of insufficient resources, the operation outputs a displayError message indicating insufficient
resources.
Operation: CGS::chaseRobber
Scope: Knight, Board, Player, Robber,Error
New: newError:Error
Messages: Server::{receiveGameState};
Client::{displayError};
Description: Client must have at least one currently active knight that has not performed an action in the current turn, and that knight must be at an intersection adjacent to the hex that the Robber currently occupies. The effects of this operation will be to give the Client the opportunity to move the robber game piece to another hex on the game board. Then if Client has moved to the robber to a hex which has an intersection occupied by ClientRemote’s settlement or city, Client can steal 1 resource/commodity card from them. Then switch the coin asset of that knight’s game object to its inactive (black-and-white) side on the GUI, set it to its inactive mode and send a successful robber chase action message to the Client.
If the robber was attempted to be moved to an illegal location, then
If the robber was attempted to be moved to an illegal location, then