Click here to Skip to main content
Click here to Skip to main content

Meteor Madness

, 22 Oct 2012
Rate this:
Please Sign up or sign in to vote.
Submission of Meteor Madness to The App Innovation Contest.

Introduction

Meteor Madness is a Windows 8 Style game that has been designed for the unique crossover nature of the third generation ultrabooks. It has dual mode inputs and allows the player to engage directly with the touch screen or by using a more traditional keyboard approach. The game actively encourages players to use both input mechanisms by rewarding each type of input. This approach makes the program usable on tablets and desktops, but on an touch screen ultrabook it provides an experience that will gently guide users from the keyboard to the touch screen. A three minute video showing the basic gameplay is available at Meteor Madness Gameplay on YouTube.

Sample Image - maximum width is 600 pixels

Background

Meteor Madness is a Asteroids tribute game that I first wrote over 12 years ago using Visual Basic.  It was born out of a bet that Visual Basic could be used for a 30 fps arcade style game.  I sort-of won the bet, but had to directly call some Win32 APIs and DirectX to get it going.  Since then, I've ported Meteor Madness to half a dozen platforms as a tool for learning each.  It has gone through the cycles of porting to .NET, then Silverlight, then Windows Phone 7 and now finally Windows 8.  However, it has never before been released. 

This iteration of Meteor Madness is a massive re-write of earlier versions.  It has been heavily inspired by the Windows 8 platform as I've learned it through Charles Petzold's book Programming Windows 6th Edition.  Additionally, the inspiration to expand Meteor Madness to a modern arcade shooter with unlockable content and assorted power ups came from the excellent game programming book The Art of Game Design: A book of lenses by Jesse Schell.

Game Mechanics

The game is divided into two separate types of game play, Classic and Arcade.  

Sample Image - maximum width is 600 pixels

The classic mode mimics the original gameplay of Asteroids fairly closely.  The ship only can ever fire a single shot at a time and the only power up is hyperspace.  Unlike the original, however, the ship can fire as fast as the player can tap or click and the hyperspace mechanism ensures the player is returned to an area of space free from meteors (at least for a second or two...).  Also, the aliens that appear are only of a single type and only worth 250 points to prevent the "hunting" strategy that was commonly used in the original.

Sample Image - maximum width is 600 pixels

The arcade mode builds on top of this base, but addes in a variety of power-ups that make the game faster, higher scoring and more bullet laden.  At present, there are power ups for Hyperspace, Next Level, Missiles and Triple Shot, with another eight in development.  These power ups are each unlocked at different events within the game.  For example, Triple Shot is unlocked when the player has an aggregate score of 50,000.  This is the most likely first power up the player will encounter.

Hyperspace

During development, the coolest feature that unfolded was the hyperspace mechanism.  Remembering my own frustrations as a kid playing Asteroids, I wanted to show the player where the ship would come out of hyperspace.  Nothing was worse than losing a quarter because I didn't see where my ship came back until it got cleaned up by an asteroid.    

The effect that was desired was to make the space around the ship appear to warp with the ship.  This required two separate animations, that couldn't be scripted using the storyboards in XAML.  To show the ship returning from hyperspace, the stars around the positions should slowly animate in towards the event horizon and then quickly 'pop' back with a slight elastic overswing.  The ship then comes out of hyperspace 0.85 seconds through the animation when the stars are back to their original position and before the elastic effect.  The graph below-left shows the function of distortion towards the event horizon for each star.  Stars futher away are distored less than those closer to finish the effect.  This is similar to the effect of Neo flexing his matrix muscles as the end of The Matrix.

Sample Image - maximum width is 600 pixels

For entering hyperspace, the animation is a nice to have and not instrumental to gameplay.  However, I couldn't have one without the other.  For this effect, the second graph was used as the displacement function with the ship disapparing almost right away and then space elastically bouncing back on a longer schedule.

A clip of the hyperspace animation is available at Meteor Madness Hyperspace on YouTube.

Dual Input Gameplay

The game has two primary play modes, Helmsman mode and Captain mode. The player does not need to select these modes, it is determined dynamically as the game is played. Each mode has its relative strengths and players with the appropriate hardware are expected to play with both modes.  As the player advances through the game, additional tips are displayed when the game determines they are useful.  These tips are aligned with their progress as both a Helmsman and a Captain.

In Helmsman mode, the player engages with the ship on the screen through direct input methods that rotate the ship, thrust and fire through the keyboard. This is aligned with the original gameplay mechanic that existed in the 1980's arcades. It is responsive and immediate in its feedback and provides a superior flying experience. However, the accuracy of the aim of the ship suffers as aligning to a specific angle requires split-second timing.

Sample Image - maximum width is 600 pixels

Captain mode, on the other hand, uses the touch screen for input. By tapping on the screen, the player acts as the captian and the ship will turn towards the requested heading and fire. Multiple taps queue up a series of commands that the ship will obey. This does not require that the player tap on a target, in fact it is necessary to lead targets accurately. However, the precision of this mode is far superior to the keyboard control. Flight is achieved by dragging the ship to a new location, which is indicated by an aiming reticule. The ship will automatically fly to this location unless interrupted with another command.

Sample Image - maximum width is 600 pixels

Finally, it is possible that a player may use both forms of input in a single game. When this occurs the player is deemed to by playing as Captain at the Helm.

If a player has played extensively in one mode, the game will continue to remind them that the other mode of play is available.

Each of the above modes have high score systems that are separate from each other. This is to encourage players to try each style of game play and not just the mode they are currently best at.

About the code

The entire project has been written in C# using Visual Studio and Expression Blend.  

Expression Blend made it absolutely trivial to add some animated sequences to the menus.  I have recently been working with Android, iOS and Windows Phone 7 at work and the difference of using Blend for animations is hard to understate.  It is excellent on all accounts.  For example, when selecting the New Game menu, the asteroid breaks into two sub-menus for Classic and Arcade modes.  The entire animation is declared as a visual state with just six lines of XAML (of course Blend did the hard work):

<VisualState x:Name="NewGameExpanded">
  <Storyboard>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="NewGameClassicMenu" d:IsOptimized="True" To="0"/>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="NewGameClassicMenu" d:IsOptimized="True" To="0"/>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NewGameClassicMenu" d:IsOptimized="True" To="1"/>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="NewGameArcadeMenu" d:IsOptimized="True" To="1"/>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="NewGameArcadeMenu" d:IsOptimized="True" To="0"/>
    <DoubleAnimation Duration="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="NewGameArcadeMenu" d:IsOptimized="True" To="0"/>
  </Storyboard>
</VisualState>

In total the code has 364 double animations!  Imagine trying to implement this without the support of Blend. 

Another interesting aspect to the code is the new mechanism in Windows 8 Style Apps for working with storage systems.  The applications in this model run with a substantially lower trust than traditional desktops.  The most notable aspect of this is the lack of access to the file system.  However, the new model makes saving and loading settings amazingly simple using the ApplicationData.Current.RoamingSettings functionality.

For example, the game has a set of features that are locked or unlocked based on different events that occur throughout the game.  Triple shot is unlocked when the player achieves a total combined score of 50,000 points.  At which point a call to Features.UnlockFeature(FeatureType.TripleShot) will ensure that the player has access to triple shot for as long as they own the game (where FeatureType is an enum).  The entire implementation of Features follows:

    public static class Features {

        public static bool IsFeatureLocked(FeatureType feature) {
            var keyName = feature.ToString();
            if(Dictionary.ContainsKey(keyName) == false || Dictionary[keyName] == null) {
                return true;
            }
            return Dictionary[keyName].ToString() != UnlockedKeyString;
        }

        public static void UnlockFeature(FeatureType feature) {
            var keyName = feature.ToString();
            Dictionary[keyName] = UnlockedKeyString;
        }
        
        private static IPropertySet Dictionary {
            get {
                return ApplicationData.Current.RoamingSettings.Values;
            }
        }

        private const string UnlockedKeyString = "Unlocked";

    }

The trick here is the Dictionary that is made available with roaming settings.  Reading and writing values to this setting will automatically store the data on the user's machine and, if they have a Microsoft Live account, will sync it to the cloud.  Further, if the user is logged into multiple machines, these settings are automatically duplicated across computers.  As such, features that I've unlocked on my desktop are made available on my laptop and vice-versa.

Future

Currently the application is entering the play testing phase and could be complete in a month or so.  Some of the key issues that remain to be seen is how the application runs on the different hardware that will be released along with Windows 8.  My development environment has a pair of 23" screens, one of which is a Dell touch screen.  Unfortunately, the touch screen is an old technology that isn't that responsive and is no where near as good as a capacitive touch screen.  Also, the new ARM processors may require some performance tweaking that is not in this version.

From a play perspetive, additional power ups remain to be added as well as a high score server and leaderboards in the game. 

History

2012-10-21 Original App Innovation Contest Submission

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Adrian Akison
Program Manager SMS Management & Technology
Australia Australia
I have been a professional software developer for twenty years, starting with C++ and migrated to C#. While I have transitioned into full time management, writing code is still my passion. As I don't write code for work very often, I have had the opportunity to apply my programming skills as a hobby where I have recently authored two Windows 8 store apps. First, an Asteroids tribute game, 'Roid Rage and most recently Shared Whiteboard (which does what it says).
 
I make a habit of contributing production code to every project I run. Most notably, I have recently run teams to build The Navigator for The Advertiser newspaper and Street Lights Out for SA Power Networks.
Follow on   Twitter

Comments and Discussions

 
QuestionWhich flavour? PinadminChris Maunder22-Oct-12 17:31 
AnswerRe: Which flavour? PinmemberAdrian Akison22-Oct-12 18:12 
GeneralRe: Which flavour? PinadminChris Maunder22-Oct-12 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 22 Oct 2012
Article Copyright 2012 by Adrian Akison
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid