Thursday, January 30, 2014

Chaos Moves, Time Moves and Leaderboards... Oh My!

Version 0.8 Released:

This past week has seen a whirlwind of development activity with the addition of not only two new game mode variations, but, also linking GumBall Fall to some global leaderboards. The player now has the option to ditch the frantic pace of Time mode and, instead, engage in the more leisurely paced strategic Moves mode where the player has 30 moves to rack up his/her high score.

Also, those scores aren't just local any more! Need some motivation to play? Check out how your scores match up with the rest of the world.

Major Changes in v0.7.1 (Jan 27, 2014):

[BUG FIX] (re)Corrected issue where the game might lock up when a round was finished (leaving gumballs uncleaned)

Introduced Game Mode Moves. Instead of 60 seconds, you now have 30 moves to rack up gumball chain

Revamped bonus scoring system. Instead of bonus points decaying with time, they now decay whenever the player fails to make a chain of size 4+ ( 1 point decay for each move under 4 )

Tweaked Score screen layout. The Top 10 list of your last play mode will now be listed first in the scroll view

Major Changes in v0.8 (Jan 29, 2014):

[BUG FIX] Fixed some problematic gumball animations

Introduced Global Leaderboards. The top ten players from around the world for each game mode are shown

NOTE: If you’re not online, your high scores will NOT be uploaded

Player Name can be set in the Setting menu (or during the initial tutorials)

The rapid development this week is the direct result of design decisions made early in development or, in the case of Leaderboards, decisions made during Bouncing Bombs! development.

Decoupled Modular Building Blocks:

I enjoy spaghetti... just not mixed in my code. As mentioned in a previous post, GumBall Fall makes liberal use of a messaging system that allows all of the various pieces and parts of the game to broadcast and subscribe to information they're interested in. This keeps my game objects decoupled from each other quite nicely. They don't care who (or how) the information is sent/received. They just care that they sent/received it.

Which now brings us to Time vs Move-based game play. If you think about it, 60 seconds is a heck of a lot like 30 moves. Something counts down and, when it reaches 0, the game's over. The only real difference is one countdown is dictated by nature and the other is dictated by the user.

The game object responsible for determining when a game is over listens for game 'tick' updates. When it receives a 'tick' it decrements its 'tick' counter by an appropriate amount and determines if that lowering is enough to end the game. Thanks to the messaging design decision, this GameOver game object doesn't care how the 'tick' was generated (or when it was generated); it just cares that it received one.

So, to switch the game from Time to Move-based, all one has to do is swap a countdown clock game object for a move count game object. Both broadcast their 'ticks' at appropriate times and the GameOver game object is none the wiser.

The result? An easy to implement game mode to diversify GumBall Fall's game play!

Generic Leaderboard Server Interface:

During Bouncing Bombs! development, I settled on using Scoreoid.com for my leaderboard backend. It provided a simple/stable/cross-platform RESTful interface to code to and has proven to be a reliable service.

By the time Bouncing Bombs! was released, I had developed a (mosty) generic leaderboard server interface. To interact with the system, a game object simply messaged a request to the leaderboard server game object and registered for a response. Porting this interface to GumBall Fall was a no-brainer.

You might have noticed 'mostly' from the last paragraph. Turns out, my 'generic' server I though I created wasn't quite as generic as I though it was. Small pieces of it were still directly tied to Bouncing Bombs! specific types. But, 98.4279% of the code was good-to-go. After about an hour of tinkering, the leaderboard server interface was transformed into a completely generic standalone piece of software. And, 15-20 minutes after that transformation, it was integrated with GumBall Fall.

As long as Scoreoid.com remains free and reliable, I'll definitely be reusing this lovely piece of generic code in all of my future game projects!

But, but, but... what about The Googles and Amazons?!? They offer various services to implement leaderboards and achievements and cloud saves!! While these services exist, they are (1) mutually exclusive (i.e. Google Play Games services don't run on Kindle devices and Amazon Game Circles services only run on Android devices IF they were downloaded via the Amazon App Store) and (2) require the player to actually commit to setting up (or activating) an account with those respective companies. To me, both of these points add a decent amount of friction to the user experience and, thus, were not my primary online targets.

With that said, moving forward, I still have plans to investigate integrating both the Google Play Games and Amazon Game Circles services into GumBall Fall (for use in their respective marketplaces). But, until that day, the generic Scoreoid.com approach provides me with a global leaderboard solution while requiring the user to provide nothing more than a simple nickname and it'll work across any platform GumBall Fall is running on (PC, Mac, Linux, Web, Android, Kindle). Even if I end up integrating the services, I still plan on keeping the Scoreoid.com solution around.