Skip to content

About

Backend for a turn-based game running on a serverless architecture using Microsoft Azure. >>> Project deprecated - continuing as Network-Backend

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

124 Commits

Folders and files

Repository files navigation

Functions Game Backend

Backend for a turn-based game running on a serverless architecture. The game implemented is rock-paper-scissors for the Azure Functions platform, but the code is modular enough to change the game and the service provider more easily.

Rock-Paper-Scissors Game GIF

The front-end is implemented in a rock-paper-scissors game for Unity here using the following parts: C-sharp base scripts, with Unity specific utility scripts, an implementation of Scriptable Objects Architecture to emit UI Signals, and a modular network framework.

How it Works

The main functionality is implemented in the class MatchFunctions. I comment the functions in more detail below. The interaction between the client and the 'server' is by polling, so the client must ckeck on the server repeatedly to know if the state of the game has changed and treat the changes.

Functions

Every function is called using a Request and responds with a Response.

Log In

The first interaction between the client and server on every session. Must be called with an unique device identifier. Creates (if new) or updates a PlayerRegistry to the database.

Get Game Settings

Each PlayerRegistry has a PlayerInfo field, which in turn has a CustomData field with public data about that player. This function allows to send custom data to that field.

Find Match

Registers this player as looking for match and tries to match them right away if enough players are available. A temporary entry will be written to the database with this player info for future players finding matches.

Get Match

Get info about a match, or tries to match the requester player if not matched yet. If a match is created, a MatchRegistry will be written to the database.

Leave Match

Takes measures to mark this player as retreated from the match. If only looking for match, deletes the entry from this player. If already in a match, sets this player as a "RetreatedPlayer".

Send Action

Sends an ActionInfo with custom information to alter the match state. The game implemented must check and interpret the action sent.

Get Match State

Get the current match state if it's different from the last known state. Writes and updates a StateRegistry.

Interfaces

IService (Link)

Provides methods to be implemented for a service that will make specific reads and writes to the database.

IGame (Link)

Contains methods to be implemented according to the rules of the game. It checks actions sent and modifies the match state.

About

Backend for a turn-based game running on a serverless architecture using Microsoft Azure. >>> Project deprecated - continuing as Network-Backend

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages