AppWarp brings you yet another game sample where you can understand how a simple turn-based game works. The objective of this game is to navigate the spaceship, according to die rolls and turn by turn, from starting milestone to the finish.
The game is a simple race where the winner is decided based on sheer luck. Like any turn-based racing game, in this the movement of the spaceship is decided by a single die roll, players move based on the number die gives on their respective turns.
AppWarp provides out-of-the-box APIs for real time turn-based games. This eliminates the client side effort required for the following
- distributed timer management
- distributed turn management
- distributed state management
The entire management is done on the server side by AppWarp cloud when a turn-based room is created. Notifications are sent to clients when a move is made or a player’s turn expires. The turns are assigned in the order in which the room is joined. Developers have the flexibility of defining the maximum turn time to be allotted for each turn. If a player fails to send their move in the allotted time or leaves the room, their turn expires and is passed on to the next player. The complete timer and turn management logic is implemented on the server by AppWarp and clients simply need to react to the events.
Note that turns are allotted in a fixed order and can’t be altered by the client. If the game requires assigning turns in variable manner (such as repeating or skipping certain turns, etc.) or variable turn time for each player, then the readymade cloud APIs are not the way to go. It’s best to either build your custom solution using a combination of chat/update messages and room properties on the cloud.
The following flowchart will get you started with AppWarp integration in your turn-based game. It will give you insights on the flow of data and command among various API functions. It will also guide you through each steps required for setting the turn-based environment.
Please refer to this link for clarity on APIs. For more information on turn-based game development please click here.
Should you have any questions or need any further assistance, please feel free to write us at firstname.lastname@example.org.