Thursday, March 27, 2014

Gumball Fall - Shake, Shake, Shake... Shake That Booty!

Version 0.10.5 Released:

GumBall Fall v0.10.5: Web Player | AndroidGoogle Play BETA | Google+ | Twitter

Major Changes in v0.10.4 (Mar 25, 2014):
  • Color scheme updates including one with patterns
  • Tutorials re-integrated into the system
  • Highscore screen now can show Daily/Weekly/All Time scores
  • [Chaos] Shake your device and watch the gumballs shift!
  • Music volume tweaks
  • Leaderboards and local data reset (Platform ID 1004)

Major Changes in v0.10.5 (Mar 26, 2014):
  • [FIX] Gumballs in Order modes should no longer frequently become lost when chains containing gumballs from the extreme left and right columns are created. NOTE: They might still infrequently become lost
  • Reduced force imparted on gumballs when you shake your device
  • Experimenting with adding a bit more ‘bling’ when you complete a chain of 6+ or blow up a bomb. This will likely continue to change with future releases
  • While still likely not 100% accurate, Weekly and Daily scores should now report more consistently between global and local leaderboards

It’s been a few weeks now since I’ve had an opportunity to sit down to add an entry to this development blog. I would love to report all sorts of fancy new features since the last update. But, sadly, development of Gumball Fall has slowed down these last few weeks.

Why The Slowdown:

Part of the slowdown can be blamed on illness. I was useless for roughly a week. But, mostly, life has just popped up various activities that have been consuming my time in lieu of pursuing further game development activities.  But, enough excuses... onto the noteworthy updates!

Color Schemes - Round 2:

Basing any aspect of your game solely on one sense (sight, hearing, etc.) should be avoided if at all possible. Such a decision has the potential to alienate part of your potential player base. As noted in an early post, I basically ignored that advice for Gumball Fall... Gumballs are round and brightly colored! Only color will be used to distinguish gumball differences! To attempt to address my decision, I introduced a few different color schemes specifically designed to be distinguishable by various types of color blindness.

Despite my efforts, colors alone will never cover all color blindness scenarios. To better address this scheme deficiency, I decided to introduce patterns into one of my schemes. The gumballs can still be perfectly round and more folks will be able to see them! That’s a win-win. After trying a few different tactics, I settled on a combination of sports-based gumballs along with a few other random items to round out the 6 gumball types. The way I see it, while not as popular as solid colors, I’ve seen my share of ‘sports’ gumballs in machines. Little kids like losing $0.25 to chomp down on a gum-based ‘baseball.’ Why not have them in my game?

Pattern-based gumball sprites and their highlights

Thanks to a buddy, the patterns have passed their initial ‘color blind evaluation.’ We’ll see if they hold up when released to a wider audience!

Shake, Shake, Shake… Shake That Booty:

Or, more accurately, shake that mobile device… but, that doesn’t flow off the tongue nearly as well ;-)

From the moment Gumball Fall was pushed to mobile devices, there’s been one constant that everyone, without fail, as tried to do: Shake that last pesky gumball into place to create that long chain. For just as long of time, I’ve had plans to integrate a shake feature into the game. To integrate a mobile device’s accelerometer in a meaningful way, I had a few design decisions to make.

Does tilting affect gravity? Ultimately, no. I don’t want tilting/shaking affecting gravity. Once you wish to control ‘gravity,’ you have to be concerned with the device’s orientation so you can correctly determine where ‘down’ is. Is the player holding it vertically vs. horizontally vs upside down vs on some random angle? What happens if the player wants to adjust his playing angle from when he first started? What happens if (s)he pauses the game and resumes later with the device in a different orientation? etc. etc. There are multiple ways to address these questions. But, I have no desire to open up that can-o-worms. Instead, I’m just going to ignore the whole gravity control issue.

In lieu of messing with gravity, shaking will just jostle the gumballs… kinda like smacking the side of a snack machine to loose that stubborn candy bar from the metallic grasp of the machine. Now comes the question, how ought I smack that snack machine?

The accelerometer aspect of the equation was fairly straightforward: Simply look for ‘quick’ differences in accelerometer values. The basic algorithm is nothing more than:

  • Get current accelerometer value
  • Compare to previous frame’s accelerometer value
  • If current is ‘sufficiently different’ from previous → player shook the device
The one consideration to keep in mind is that the accelerometer values (at least as reported in Unity 3D) constantly fluctuate similar to what you’d see in a true analog device. To account for this, I’m averaging my accelerometer values over a few frames

With the definition of ‘shake’ completed, what ought I do when a ‘shake’ actually happens? I tried a few different ideas:

  • Approach 1: Simply apply a directed force to every gumball in the game. While this, indeed, moves the gumballs, the result looks awfully uniform. I was seeing the whole group of gumballs simply move as one big blob. It didn’t really look realistic
  • Approach 2: Directly Apply a force to the walls and/or floor and allow those things to bump the gumballs as appropriate. By adding rigid bodies to the walls and floor and clamping them to not move, I was able to apply any amount of force to them, the force would transfer to the gumballs and, the walls/floor would remain unmoved. This gave the the gumballs a more natural looking behavior, but, still felt stiff
  • Approach 3: Create a spring-loaded basket to cradle the gumballs. If I’m making a physics based game, why not take full advantage of the physics engine? Why artificially clamp the boundaries? This idea lead to the creation of a simple U-shaped ‘basket’ suspended by 3 springs, one each at the top, left and right sides. When a ‘shake’ occurs, a force is applied to the basket. As a result, the basket bounces causing the gumballs to jostle. Thanks to the spring forces, the basket quickly resets itself and is ready for its next ‘shake’

Ultimately, I like Approach 3 the best. It looks the most natural and, as a result, (I feel) it gives the most ‘accurate’ results. Ultimately, the players will decide if I’m correct. As I gather feedback, the springs will be tweaked as needed. Additionally, similar to pinball, a Tilt system may be introduced. Shake that thing too much? Find yourself S.O.L. And, if it's a complete flop... back to the drawing board!

When it's all said and done, KC and his Sunshine Band had it right. You gotta shake that thing!

Alrighty, that’s a large enough wall-o-text for this update. Thanks for reading!

No comments:

Post a Comment