DRAGON NINJA BYOKA now has an official Steam Store page. At this stage there are over 20 maps created for the game with the final release targeting 60 crafted levels.
This is a major milestone for the development of Dragon Ninja Byoka and puts the game within player's grasp. Integrating with Steam was an involved process we will break down in this post with some high level points regarding:
- Steam Input, gamepads and event loops
- Steam Stats and Achievements
- Steam Leaderboards
Steam does a great job of abstracting the concept of buttons and gestures from the physical devices into Actions expected by the game, but as such requires some rethinking regarding implementation and inclusion of other states.
Some of the amazing advantages of Steam Input include supporting a wide variety of controller types, gamepads, buttons and gestures and providing a very fluent rebinding system native to the Steam Application. However, inversely their is not support for Keyboard / Mouse bindings and at any point a player can use a controller that is not managed by Steam and thus your system needs fallback mechanisms to handle this. And all of these changes and scenarios must be handled on-the-fly within your game. Here is a breakdown of some Steam Input considerations:
- Actions are generalized events your game responds to
- Action Sets are collections of actions relevant to a state of your game, eg menu or in-game
- Action Sets must be activated before they can be read in game
- Action Sets must be re-enlisted whenever a controller connects or disconnects
- Actions must be checked for either Digital (boolean) data or Analog (vector) data
- Controllers can connect and disconnect at any point
- Controllers may not have a bound configuration in Steam
- Configurations can be player created (as In Game Action Files) or dev created (as Action Manifest Files)
- Input Sources are the phyiscal inputs (buttons, gestures) that produce an Action
- Input Sources can be one or many for each Action
- Input Sources have correlated Glyph icons we can use to show what buttons are bound to an action
- Glyphs must not be cached since the player can change them at any point, but we can cache the texture for the filename
- Keyboard / Mouse is not supported in Steam Configurations so those must be supported and extra glyphs produced
The following is a block of code for Detecting Controllers with Steam, and is polled every 16 frames in game. It is limited to one controller at this time.
Function calls like "SteamInput()->GetDeviceBindingRevision()" can help us determine if the player has indeed used a controller that is managed by Steam, because Steam will report all controllers even if there is not a loaded configuration for it.
Steam Stats and Achievements
Stats can be used to write primitive data like kill counts etc to a player's account. Then there are Global Stats that are an aggregated value of all players version of the stat. This can be confusing and it is imperitive that for a global stat we write the player's Stat as their own value, and read it as the global across all players. In Dragon Ninja Byoka these are used to track global kill counts.
In addition to primitive stats, Steam will allow you to define Achievements based on the Stat progress, or you can set Achievements directly with the API. Here are some considerations when using Steam Stats
- Player Stats must be requested through a callback before any Stats can be read or written
- Player Stats take the form of Int32 or Floats and can have rules around their incrementation
- Global Stats are just accumulated totals of a Player Stat
- Global Stats must be fetched in a seperate Async call after the main Player stats are requested
- Global Stats are not written to with totals, you write the Player's stat value only
- Global stats appear to update every few minutes to client side
- Achievements can be achieved directly or tied to a stat that unlocks automatically
- Achievements Player Stat Min Value is when it starts tracking the progress, Max Value is when it unlocks
Dragon Ninja Byoka takes advantage of leaderboards to upload best times and scores for maps completed. These leaderboards are built into Steam with their API and more work is to be completed as we will be letting the player download competitor recordings to watch and race themselves. Leaderboard integration was more involved as most operations are asynchronous in nature, so a heavy use of callbacks are required.
Leaderboards can also appear in the Steam Community if a display name is set.
- Leaderboards can be created in the Admin or with the API
- Rankings are calculated by Steam and based on a single Int32 Score, additional Int32s can store custom user data we desire
- Scores can be displayed as either numbers, seconds or milliseconds in the Steam Community
- Scores uploads are Rate Limited to 10 calls per 10 minutes so we must track our upload times and queue any pending uploads
- Scores can attach User Generated Content files uploaded to the Steam API to store playback recordings etc
- Leaderboard Rankings can be downloaded based on a start and end range or for particular Steam User accounts
This integration with Steam was very important to the progress of Dragon Ninja Byoka. Hit me up if you have any questions and of course, check out the game for yourself: