com.hashbang.showdown
v1.1.6
Published
Hashbang Showdown card game server & client
Downloads
1
Maintainers
Readme
Showdown Cadence Engine & Client
Showdown is a two player card game similar to poker. It's cadence is driven by a Beamable set of microservices and has a client that can listen for messages from the miroservice.
Microservice Engine
The Microservice engine consist of two files and the Beamable microservice will generate the Client File which is then wrapped by ShowdownClient
There are three main parts to the Engine, CommonModels
, MatchCadence
& MatchInfo
CommonModels
- This file holds all the shared models between the client and the server
MatchCadence
- This is the Microservice which has multiple client callable API's. The auto generated client will look at this to determine which Client API's to include.
- As a child of MatchCadence there is a MatchCadenceService which is used as a helper class which provides helper functionality functions.
MatchInfo
- This holds the recference to create the MongoDB Microservice Storage capabilities. For the most part no one should ever need to modify this.
Note: You will need a Beamable Realm for this Engine to work.
Installation of The Unity Package
Note: Upon installation of this package it will be broken, this is normal.
Once you have installed the latest version of this package you will need to install the autogenerated client so that the project can compile without errors. To do this:
- Install the sample for AutoGenerated Files
- Copy to files in that folder to /Assets/Beamable/AutoGenerated/Microservices
If there is already a beamable.autogenerated file in this folder in your project already then only copy the .cs files.
- Click on the ASMDEF file named
beamable.autogenerated
and change the name in the name property frombeamable.autogenerated_samples
tobeamable.autogenerated
.
Initializing a client
To initialize the client for a player, pass in a matchId which should be obtained by whatever matchmaking system and a playerId. PlayerId for Beamable can by found on the context.playerId
.
var client = new ShowdownClient(_matchId, _player);
client.Initialize();
Standard API
CreateJoinMatch ()
- Creates a match based on MatchId if one exists it will join that match instead.
ReadyForCards ()
- Sends a signal to the server that the player is ready to receive new cards. This typically happens at startup & when player receives notification of the next round.
ConfirmHand (IEnumerable<CardHand>)
- This will create a card submission to the server sending the GUID's for the cards they are Playing this round from their hand.
ConfirmWager (IEnumerable<CardHand>, int)
- This will confirm the hand & set a wager to the server which is used by the server to evaluate the hand and bet cadence. When both players submit this it triggers a Resolution of the hand to determine if the hand was won or lost or if a player needs go to a call/fold scenario.
Destroy
- Call this when a player has been removed or the game stops to cleanup all subscriptions.
Events
UnityEvent<JoinedNotification> OnJoined
- this event is fired when a player has joined the match
UnityEvent<List<CardHand>> OnHandDealt
- This event is fired when a player has been dealt new cards.
UnityEvent<string,int> OnOtherPlayerHandDealt
- This event is fired when the other player received their cards
UnityEvent<List<CardHand>> OpponentConfirmedHand
- This event is fired when the other player has confirmed their hand
UnityEvent<DamageNotification> OnDamaged
- this event is fired when players receive / report damage
UnityEvent<NextRoundNotification> OnNextRound
- this event is fired when a round is started / incremented
UnityEvent<GameOverNotification> OnGameOver
- this event is fired when a the game ends
UnityEvent<bool, CallFoldNotification> OnCallFold
- this event is fired when a player is required to call or fold due to a bet mismatch. (e.g. Poker term: Raise)