- Version
- 2.0.6
- Note
- Minimum iOS version: 11.4
Minimum Xcode version: 11.0
-
Integrating the EazeGames SDK provides an opportunity to use all the features of the EazeGames platform functionality and will allow users to compete in your game for cash prizes.
Gameplay
Game play process consists of two phases:
SDK calls and callbacks that trigger during application runtime are shown on sequence diagram below. More detailed description of this sequence is written underneath the diagram.
- Warning
- Methods which names start with lower case letter are platform messages handlers, are case sensitive and must not be erased, removed or renamed. Other methods, which names start with uppercase must be implemented too.
Game preparation
Communication with SDK during this phase is done via GamePreparationManager, in order to receive callbacks from Manager set GamePreparationDelegate as soon as possible (ideally at Application start ).
Sequence
- When user chooses the game he would like to play, GamePreparationManager will send callback with startLoadingGameResourcesFor indicating that Application must load resources for game specified by gameId parameter.
- After all resources are loaded/prepared, Application must call gameDidLoad function - informing the GamePreparationManager that everything is set and ready to go further along the process.
- Then GamePreparationManager will make final callback with provideGameControllerWithStartGameInfo (EAZGameStartInfo startGameInfo) In this callback Application must create, setup and return a Game Controller that will be presented on the main Window by SDK. The startGameInfo parameter contains all valuable information for the game: gameDuration, levels, gameSoundOn, lang, gameTimeoutGap.
Here the Preparation phase is finished and we proceed to Actual gameplay.
Actual gameplay
Communication with SDK during this phase is done via GamePlayManager, in order to receive callbacks from Manager set GamePlayDelegate as soon as Game Scene is ready for playing.
Sequence
- Start. In order to start playing Application must call didStartPlaying function when the Game Scene becomes visible. In Unity3d games this place can be provideGameControllerWithStartGameInfo callback received by GamePreparationDelegate. Calling didStartPlaying function when game scene is loaded will not work, as there is a delay between loading resources and actual matching with opponent, when GameView becomes active. All games must have a timer, that will indicate the remaining time for playing. This timer also should be instantiated and launched with didStartPlaying call. When timer runs out, Application must end game play with last acquired (final) score of player via FinishGame. Duration value for timer is provided in the Game preparation phase inside startGameInfo, object of type EAZGameStartInfo.
- Note
- Game launched directly in Unity Editor (on your PC/Mac) returns in startGameInfo hardcoded values from local test environment
It contains:
- gameDuration - game’s duration in seconds. Setting on the EazeGames platform.
- levels - string that represents the sequence of levels for all opponents of current gameplay sequence.
- gameSoundOn - indicating sound setting.
- lang - language ISO 639-1 code. E.g. en.
- gameTimeoutGap - time gap in seconds.
- Scoring. After Start, Application will be able to :
- receive opponent’s score in case of Live game (callback):
- End game play. Game can end in two ways:
- Player leaves game with help of Leave button that must trigger action LeaveGame of the GamePraparationManager in LeaveGame method of GamePlayManager. In general it will inform Platform that user decided to leave the game, but depending on Game type it may have different scenarios:
- Live game - informs Platform that user decided to leave the game. It will automatically match user with state LOST
- Delayed game - there are few possible cases for Leave in delayed games:
- if player is the one who finishes the delayed game, it will inform platform that user decided to leave. Platform will automatically match user with state LOST
- if player is not the one who finishes the game by leaving it, his Leave result is saved, and final game results will be set later, when all opponents are found or game is finished by timeout.
- in case if all the other users in this certain delayed game also left, and user finishes it by Leaving a game as well, platform will automatically match all users with the DRAW state.
- Contest - informs platform that user finishes playing contest game and his last score is set as a final result in certain contest.
- When timer will run out Application must call FinishGame(long finalScore) with Player’s final score.
- as result SDK will :
- send callback: didEndGame - informs about end of game play, and that Game sequence should be stopped.
- Note
- Score sending won’t be handled by the SDK after this callback.
- or if there will be a need to wait for the opponent to finish playing in the Live game, SDK will fire firstly waitingForOpponent - in this case Game Scene will remain on the screen until Opponent finishes and Game’s job is to inform Player about this event (e.g. on EazeGames Platform we show a toast message bar with text “Waiting for opponent”).
- Note
- Score sending won’t be handled by the SDK after this callback.
Secondly, after waitingForOpponent, platform will fire didEndGame when opponent finishes playing.
- Note
- Additional scenarios
- Connection lost
If during gameplay, internet connection has been lost, game will continue running without any problems, but if connection won't be re-established until gameplay sequence end, last sent score before connection loss will be result of current game sequence. So, if connection will be re-established before time runs out, new sent score will be used on platform.
- Application is put to background (Phone call received)
If during gameplay, user receives a call, application will change its state to paused. When player reopens it platform UI will be displayed. If timer didn’t run out, User would have the ability to rejoin his gameplay with last score sent as his current score. Remaining time will be provided in provideGameControllerWithStartGameInfo callback parameter startGameInfo of type EAZGameStartInfo in gameDuration value.
This manual is divided in the following sections:
- Note
- Make sure you have read carefully information provided on this page and proceed to the Configuration guide section.