All Work All Playhttp://www.allworkallplay.org/blog
I play games. I make games. Sometimes I break games.Wed, 14 May 2014 21:50:58 +0000en-UShourly1http://wordpress.org/?v=3.9.23TXSahttps://feedburner.google.com5 Premium Currency Pricing Trends and Tricks used by Mobile Free-To-Play Gameshttp://feedproxy.google.com/~r/TXSa/~3/9g6L80ktJx0/
http://www.allworkallplay.org/blog/5-premium-currency-pricing-trends-and-tricks-used-by-mobile-free-to-play-games/#commentsTue, 29 Apr 2014 11:57:04 +0000http://www.allworkallplay.org/blog/?p=332Most free-to-play games on mobile sell some sort of premium currency: gems in Clash of Clans, donuts in Simpsons Tapped Out, gold in Game of War and so on. I spent some time analysing how 32 games on the App Store sell their premium currency, and some interesting trends and tricks emerged.

My method for selecting games was pretty unscientific… just a mix of games I had played, wanted to play, or were in the AppStore top grossing. Perhaps I’ll expand on the list some day. You can see screenshots of all the games’ premium currency offerings in this gallery.

Trends & Tricks

1) There is not much variety in pricing

A lot of games offer the same 5 price points: £2.99, £6.99, £13.99, £34.99, £69.99. Those are the 5 big bubbles you see in the diagram above.

(That’s $4.99, $9.99, $19.99, $49.99, $99.99 for American readers).

The most popular thing to do is to offer those 5 price points exactly with no changes, as is done in Supercell’s Boom Beach for example.

This exact price progression accounts for 1/5th of all games surveyed.

If you also count price progressions that are within 1 price of the most popular (meaning they can be reached by either adding, modifying or subtracting just 1 price from the progression), you’ve got over 3/5ths covered.

Extend it again to count price progressions within 2 prices and almost all games are accounted for.
Very few games deviate from this formula… Moshi Monsters Village and Empire are tied for the most unique price points award, with each offering 4 unique prices that no other game does. It’s nice to see someone trying something a little different, it will be interesting to see if their pricing catches on.

2) Players agree on a minimum price, publishers don’t

The only price that games seem to disagree on is the minimum to charge.

I wanted to know: is it worth offering a minimum price cheaper than £2.99? The App Store most popular purchase ranking reveals some interesting information.

1) In 100% of cases where £2.99 is the cheapest price, it is also the most popular purchase.

2) 17 games had both a starting price cheaper than £2.99, as well as a price point at £2.99.

3) For the majority (70%) of those 17 games, £2.99 was still the most popular price point.

The same information visualized:

It appears that even if you offer players a minimum price point cheaper than £2.99, chances are they will probably still prefer to buy the £2.99 option. But some questions remain…

a) When £2.99 is the cheapest option, how many sales are lost from players only willing to pay less than £2.99?

b) And how much revenue is gained from players that would have preferred a cheaper option but paid £2.99 anyways because there was no cheaper option?

c) And most importantly, which is greater? A or B?

Unfortunately I don’t have enough data to answer it. But it did make me think back to a talk I watched long ago in which a publisher claimed “you’d be surprised how many people who are willing to pay a dollar for something, will also be willing to pay 5 dollars“. He goes on to express regret for setting the price too low.

If it was up to me, I would probably start pricing at £2.99 and then lower the price later through special starter pack offers if need be. It’s always easier to lower a price than it is to raise it!

3) Buying more is not always a better deal for the player

I assumed that by buying a larger currency pack, I would always get more currency per dollar spent. This is not always the case. The most significant example of this I came across was in Angry Birds Go:

Pay 2.5 times as much, but only get 2.1 times as many gems. If you want 2,500 gems, you can save money by buying 2 x 1,200 gems + 1 x 100 gems for a total cost of £29.97 – a whole £5 cheaper than the 2,500 gems priced at £34.99. Those are savings you could use to buy another 300 gems

It’s hardly an isolated incident. 70% of the games surveyed do this kind of thing.

Sometimes, you see the same thing happening in the US store.

Other times I think it has to do with price localization. When something is priced at $4.99 in the US it is typically sold for £2.99 in the UK. But for some reason $9.99 (double 4.99) becomes £6.99 (more than double £2.99) whereas it really should be £5.99. Take Hay Day for example.

Not sure how or why this practice originated, but I didn’t see any games adjust the premium currency given as a result so sometimes we end up getting less currency per £1 than you would get per $1.

4) ‘Most popular’ doesn’t have to mean most popular

As a player, don’t trust everything publishers tell you. In only 1 out of 8 games that prominently displayed a “Most Popular” badge next to a currency pack, was that also the actual most popular purchase in the App Store ranking.

Angry Birds Go, the only one to correctly label the “Most Popular” offer:

Does this mean everybody else is lying? I guess if at some point in the past or in a different territory the offer tagged as “Most Popular” was actually most popular, then you could say it’s just out of date.

In any case, it wouldn’t be in any publisher’s best interest because in all 7 cases where the “Most Popular” was mislabeled, a cheaper offer was the most popular and who would want to encourage players to buy a cheaper pack? Apparently only Rovio is honest enough.

5) There’s more than 1 way to calculate a bonus

A few games like to tell players exactly how much of a better deal the larger currency packs are. There are different ways of calculating this which can make the discount sound more or less impressive.

This first example is from Kabam’s Hobbit game.

The lowest amount of gems per £1 is found in the £6.99 pack: 100 / 6.99 = 14.3 currency per £1.

At this exchange rate, for £13.99 you should get 13.99 x 14.3 = 200 currency.

But they give you 240 for £13.99 instead of 200.

240 / 200 = 1.2, thus you are getting 120%, ie 20% more than you should get.

The numbers have been arranged so as to maximize how impressive the bonus sounds while remaining 100% truthful. Not everybody calculates it the same way.

Here’s a different example from flare’s Royal Revolt 2.

Like Hobbit, they use the lowest exchange rate which again is from the £6.99 pack.

At that rate, you should get 5,256 currency for £34.99 but instead they give you 7,500.

This is where the method diverges from Hobbit.

The extra amount of currency being given is 7,500 – 5,256 = 2,244.

2,244 / 7,500 = 0.299, so we can say that of the 7,500 currency you are being given 29% for free.

First off, they could easily have rounded 29.9% up to 30%. More significantly, using Hobbit’s method you could say that 7,500 / 5,256 = 1.43, therefore it is equally honest to say that you are getting 43% extra.

Another interesting example is Monster World.

If you try to calculate the bonus using any sane method, it just doesn’t make sense. It had me stumped for a little while. Then I checked the US AppStore pricing and it all fell into place.

If you use the US prices, the bonuses make perfect sense using the same method as Hobbit. So it appears that when the prices were localized, the bonuses were not. In reality, the bonuses in the UK AppStore are far less generous than their US counterparts (eg 7% UK instead of 25% US for 100 potions and 70% UK instead of 100% US for 4,000 potions).

Final Words

I hope this information helps anyone working on (or simply curious about) f2p game premium currency pricing. There’s certainly a lot more going on with the prices than is obvious at first glance. The more I looked, the more I found.

Still not satisfied? Try my spreadsheet. It’s full of extra figures and graphs I didn’t consider important enough to single out. And if you find something in the data I missed, let us know!

Feedback, questions, concerns? Leave me a comment!

Disclaimer: I compiled the information in this article by playing lots of games and doing some research. To the best of my knowledge, is it accurate and I have triple checked all figures and calculations. Nevertheless, it is always possible that I have made a mistake somewhere or that a game has changed since publication. Use at your own risk, I don’t provide any guarantees. Please do get in touch if you find anything amiss.

]]>http://www.allworkallplay.org/blog/5-premium-currency-pricing-trends-and-tricks-used-by-mobile-free-to-play-games/feed/144http://www.allworkallplay.org/blog/5-premium-currency-pricing-trends-and-tricks-used-by-mobile-free-to-play-games/?utm_source=rss&utm_medium=rss&utm_campaign=5-premium-currency-pricing-trends-and-tricks-used-by-mobile-free-to-play-gamesClash of Clans – Time Monetization Formulas Demistifyedhttp://feedproxy.google.com/~r/TXSa/~3/28Vd8nFDI18/
http://www.allworkallplay.org/blog/clash-of-clans-time-monetization-formulas-demistifyed/#commentsWed, 02 Apr 2014 08:00:13 +0000http://www.allworkallplay.org/blog/?p=11In Clash of Clans (a super popular social building / defending game by Supercell) players can speed up actions such as building, upgrading or training troops with gems that can be bought for real money. They’re basically monetizing the player’s impatience. Every social building game I know of does it.

I set out to learn more about the hidden formulas at work. This is how CoC puts a price on time.

Let’s start off by comparing some graphs.

This line graph shows how many gems it costs to skip time. More time = more gems. As expected.

But there’s a catch. It looks like the price increases exponentially. This is misleading! It only looks that way because the difference between 60 seconds (1 minute) and 604,800 seconds (1 week) is so vast. The time is increasing exponentially and it’s distorting the data.

Switching from line graph to a scatter graph gives a more truthful picture. The horizontal time axis is scaled evenly. But it’s hard to tell what’s going now in the bottom-left corner now. The values are so bunched up you can’t tell them apart anymore.

Let’s try interpreting the data differently. Think of it in terms of cost in gems to skip 1 second. Skipping more time costs more money, but you get a better deal. Think of it as a set of increasing discounts.

My testing has shown that the pricing algorithm graph consists of a series of linear line segments. They are not simplified versions of curved graphs. I will explain why later.

Now let’s look at some formulas.

To start, all we need to do is create a neat little table like this with your desired prices, and then I will show you how to use linear interpolation to calculate any other price.

It’s a nice system. Breaking the pricing down into chunks of time that make sense to humans (hour/day/week) makes it easy to visualize. Everybody knows what it feels like to have to wait a day. It’s also very easy to tune. If you change your mind later and decide that 1 day should cost more, all you need to do is update 1 value.

The nice thing about using a linear segment graph is that it allows you to set and tweak specific price points.

With this information, we’re ready to start substituting values. Using Clash of Clans’ data, let’s say for example you want 1hr (3,600 seconds) to cost 20 gems, and 1 day (86,400 seconds) to cost 260 gems. We can thus specify a function for such a line segment.

We can use this function to find the cost of any time between 1hr and 1 day. For example to find the cost of speeding up 4 hours, substitute and you get .

All the formulas for the individual line segments can be combined into one very large piecewise function.

This is the CoC gems -> time conversion rate formula.

To enter it into excel, copy-paste this long formula into cell B1. If you then enter an amount of time in seconds in cell A1, the cost in gems will appear in B1.

Try a live demo. Double click the time to edit it and watch the cost in gems update.

Let’s talk about how all this affects real money.

So far I’ve just been talking in terms of CoC’s ingame currency “gems”. But gems are bought in the store for money, so we can put a price on them. This is how Supercell prices gems.

The cost per gem actually decreases the more you buy, but more about discounts later. For now I’m going to simplify things a little and use the average cost: £0.0055 per gem.

This is super useful because now we can use the formulas from before to set real-world prices for things. Someone at Supercell decided that in CoC a 1 day skip should cost on average £1.43 and 1 week £5.49. If we wanted to make a change, we could for example change the price of 1 day to £2.00 and have everything else update automatically. It’s a really convenient and logical way to tune the game’s monetization.

(Brief and mostly unrelated side note: have you ever wondered why companies like Supercell or Microsoft love using abstract virtual currencies with perplexing exchange rates? During my research I came across a great article on the psychology behind such virtual currencies. It’s too good not to share. Read part 1 here, and part 2 here.)

Discounts

Buying Gems

The gem pack sizes are fixed. You can’t buy 501 gems. You have to either get the 500 or the 1,200 pack. Regardless, I though it interesting to view it as a graph.

It’s hard to see, but the line actually gets slightly less steep the more you buy. Supercell is giving you a discount if you buy a larger quantity.

You save a 16.4% for buying a pack of 14,000 when compared to the price of the 500 pack.

Skipping Time

When you compare the discounts for buying gems to the discounts for skipping time, it becomes obvious that the discount for skipping a longer time-piece is far more generous than the discount for buying a larger gem pack.

You save a massive 90.1% buying a 1 week time skip when compared to the price of skipping 1 minute.

It’s worth noting that the discount difference between 1 minute and 1 hour is 66.7%, but the discount difference between 1 hour and 1 week is only 23.4%. Instead of thinking of 1+ days as highly discounted, we could think of it the opposite way: 1-59 minute skips are overly expensive. Why are they so overpriced? I don’t have a definitive answer… my hunch is that only the most impatient of players are willing to buy such short skips. They may also be the most willing to spend, so perhaps its a little bit of price discrimination at work? I’m not sure. I wish I had a better answer. Leave me a comment if you think you know better!

Stacking Discounts

If you buy gems, and then use them to skip time, the discounts stack.

The worst deal you can get is to buy 500 gems for £2.99 and then use it to skip a 1 minute timer. You have just paid £0.000100 per second you skipped.

The best deal you can get is to buy 14,000 gems for £69.99 and then use it to skip a 1 week timer. You have just paid £0.000008 per second you skipped.

That’s a price difference of 91.7%.

Discount Power

The cost per second sounds like a tiny insignificant amount, but when you are skipping 604,800 seconds it adds up. If you were charged the same rate for skipping 1 week as for 1 minute, it would cost you £60 instead of £5!!

The generous discount for skipping longer stretches of time is essential. Without it prices would quickly become prohibitive and nobody would buy them.

That’s what I think Supercell must have realized. They needed a way to heavily discount long skips that is easy to tune. Linear segmented graphs are a great solution.

Lastly, let’s consider alternative solutions.

There are other ways Supercell could have done it. Considering alternative solutions teaches us more about the pros and cons of their method.

A Linear Graph

My first thought was to use a simple linear graph. Then there would just be a gems -> time conversion rate, like there is for $ -> £.

It’s possible, but the cost of skipping 1 day would fall by 61.5% from 260 gems to 100 gems. Or, if you wanted to keep the 1 day price at 260 gems, the line would have to rise more steeply and 1 week would become more expensive.

Basically, it would only allow us to tune 2 price points. If you want to tune more than that – as Supercell obviously felt it was necessary – you need multiple linear segments. Theoretically they could tune even more price points. If they wanted to charge more or less for a 2 day skip, they could easily introduce 1 more segment.

A Curved Graph

Why not a smooth curve? Perhaps some exponential, quadratic or bezier function?

It looks nice and smooth, but it becomes really difficult to tune… the formulas involved are just a major pain to work with. Having messed around with it for a little while, I don’t recommend it

Conclusion

The Clash of Clans way of monetizing time skips is really elegant. I can’t think of a better system.

To summarize:

Skipping more time costs more money, but you get a better deal.

The pricing algorithm graph consists of a series of linear line segments.

The nice thing about using a linear segment graph is that it allows you to set and tweak specific price points in a easy to understand way.

The discount for skipping a longer time-piece is far more generous than the discount for buying a larger gem pack.

The generous discount for skipping longer stretches of time is essential. Without it prices would quickly become prohibitive and nobody would buy them.

Feedback, questions, concerns? Leave me a comment!

Disclaimer: I compiled the information in this article by playing lots of CoC and doing some research. To the best of my knowledge, is it accurate and I have triple checked all figures and calculations. Nevertheless, it is always possible that I have made a mistake somewhere or that the game has changed since publication. Use at your own risk, I don’t provide any guarantees. Please get in touch if you find anything amiss.

]]>http://www.allworkallplay.org/blog/clash-of-clans-time-monetization-formulas-demistifyed/feed/63http://www.allworkallplay.org/blog/clash-of-clans-time-monetization-formulas-demistifyed/?utm_source=rss&utm_medium=rss&utm_campaign=clash-of-clans-time-monetization-formulas-demistifyedTracking Player Metrics and Views in Flash Games with Google Analyticshttp://feedproxy.google.com/~r/TXSa/~3/zdv74qOUkCk/
http://www.allworkallplay.org/blog/tracking-player-metrics-and-views-in-flash-games-with-google-analytics/#commentsTue, 18 Mar 2014 01:03:19 +0000http://www.allworkallplay.org/blog/?p=131What is Google Analytics for Flash?

It gives you amazing in-depth information on your game’s players, like this (click to enlarge):

My Google Analytics Dashboard

This is the actual data from one of my older games on 17/03/2014. I won’t tell you which game though

Read on, and I will show you exactly how to set up the same metrics for your game.

Why Bother Tracking Metrics?

Tracking metrics in your games is important because it allows you to answer questions like:

“How many people played my game?”

More plays means more ads are being viewed by players. If you can say my games get X players, you can use that when negotiating license sales or sequels.

“What sites is my game played on?”

You can use this information to expand to sites that have not yet hosted your game, or target sites on which your previous games did well when selling your next game.

“What causes players to stop playing?”

Maybe you will find out something that went unnoticed during testing and you can fix to keep players playing.

There are a lot more questions analytics can help you answer, but those are the main ones I look for.

With so many competing analytics services, it can be hard to pick one.

Which Analytics Service is Best?

In my personal opinion, Google Analytics. I much prefer it over everything else I tried. Why? It’s reliable, easy to set up, tracks common metrics such as views & hosts, supports custom metrics, and the data can be shared with others. That’s basically everything I need from an analytics service. The only downside I have encountered is that it takes 24 hours for the data to update, although there is a real-time view which shows you what is going on right now.

Others

Before settling on Google’s service, I tried a lot of others but found them all lacking in some important way or other:

I tried Playtomic, but you have to host the server yourself which takes a lot of resources.

I tried Scoreoid, but it requires extra work to set up since they don’t provide an actionscript API.

I tried GamerSafe, but it only tracks some basic metrics and has no support for custom ones.

I tried my own custom PHP+MySQL solution, but it takes a long time to re-invent the wheel and I was worried my host would shut me down if my games become too popular.

Did I miss any good ones? Please leave me a comment so I can go check it out!

Is there any reason not to use Google’s service? Yes, there are a couple things Google Analytics doesn’t do because they’re not analytics: leaderboards, saving player savegames, level sharing, or anything that requires data to be sent from the server->client. If you need any of those features then I would still use Google for everything it can do, and chose one of the alternatives for the bits and pieces it can’t.

Have I convinced you? Then you’re probably wondering…

How do I add Google Analytics to my Game?

This step-by-step tutorial is for FlashDevelop. If you use Adobe Flash, or FlashBuilder you can still use GAForFlash and the steps are similar but I’m not going to cover it because it’s not what I use.

Set Up your Google Analytics Account

Start off by going to Google Analytics and registering for an account as a website. Just enter whatever as a url, for example mygame.com.

Add Google Analytics to your Project

2. Copy the lib\analytics.swc file from the zip archive you just downloaded into your project’s lib folder, then right-click it and select ‘Add to Library’.

Start Tracking!

1. Connect to Google Analytics from your code as early as possible. You need to do this before doing any other tracking. (Tip: For my games, I connect during the preloader. I can then calculate how many visitors left during the preloader by comparing it to the number of people that reached the main menu.)

DisplayObject is your highest level Flash Display Object. Typically you can just use ‘this’ from the place you are creating it.

Tracking ID looks something like “UA-XXXXXXXX-X” and can be found for your site in Google Analytics under Admin -> Tracking Info.

2. Use pageviews to track the player’s journey throughout your game.

tracker.trackPageview("/page");

For page, make up something descriptive. Eg “/main_menu” or “/level_2_failed”.

I track:

When the player reaches the main menu. By subtracting this from the number of players that connected, I know how many decided to leave during the preloader.

Every time the player navigates to an important screen (eg upgrades, or credits). This shows you if players are finding their way to those important screens. If a screen is getting less attention that you would like it to, you may have to do something to make it more obvious.

Every time the player starts a level. This will show you where players stop playing. It’s natural for you to lose players between levels, but if you notice a sudden sharp dropoff, consider reworking the next level, maybe there’s something you could improve.

Every time the player wins or loses a level. This is useful for balancing difficulty. Levels that are too hard are a common cause of players leaving. Compare it to the ‘player started a level’ metric. Does the rate of players quitting your game match the rate of players losing levels? If yes, consider making those hard levels a little easier.

Do you have any suggestions for interesting things to track? Leave a comment

3. Use events to track actions players take within your game.

tracker.trackEvent(category, action, label);

Category can be used to categorize events, eg “Link Clicked”.

Action is a more specific version. I chose to still include the category name in the action manually because I prefer the way it shows up in Google Analytics this way.

Labels are optional, but very useful if you want to distinguish between several version of the same event. Eg if they were done from different screens.

To give you a concrete example, this is how I track player’s clicking the sponsor’s logo on the main menu:

tracker.trackEvent("Click Link", "Click Link: Sponsor", "Main Menu");

I track:

All clicks on external links such as sponsor & developer logos. I also always specify on which screen it was clicked so I know which are most effective.

How many players muted the music & sfx. I assume if a lot of players mute it, they don’t like it or find it annoying.

Tutorials and cinematics skipped.

Anything else game specific that you can think of that you could use to improve your game, eg powerups used or upgrades bought.

Do you have any ideas for important events to track? Leave a comment

Test It

It takes 24 hours for new data to appear, so don’t fret if you just started sending data and it isn’t showing up on the analytics site yet!

Thankfully Google included a method to test that everything is working smoothly without having to wait for the data to update. Just set the visualDebug parameter in your GATracker creation to true.

As long as visualDebug is turned on, you will see Google Analytics overlay a debug log over your game that looks like this:

Google Analytics Visual Debug Log

Test your game and make sure that all your page views and events show up.

Configure Your Dashboard

Switch back to the Google Analytics site. You can look at the default Dashboard, or poke around the various options on the right, but I like to set up a custom dashboard that has all the information important to me in one place.

My Google Analytics Dashboard

If you want your Dashboard to look exactly like mine, you can simply click my template link and it will be created for you. However you will probably want to customize it to fit your tracking. For example my levels played bar graph will only work if you are tracking page views as ‘/level_x_win’.

If you don’t want to import the whole thing, select Dashboard -> New Dashboard -> Blank Canvas. You can then add any widgets you feel like. If you want to know how I configured my individual widgets, check out the image below.

My Google Analytics Dashboard Settings

Now, Wait 24 Hours

This step is important! It takes 24 hours for data to start appearing. So don’t complain if you just added Google Analytics and nothing is showing up yet in your dashboard!

Advanced Tips

There is a limit of 500 metrics recorded per connection. That’s quite a lot so it’s unlikely that you will hit it, and even if you the game will just keep running as normal (but metrics will stop being reported). Just in case, I count the number of things sent in my code and when it reaches 499 I send a special event to let me know the limit has been reached.

If your game is super popular, anything over 10,000,000 hits per month may not be processed. However I have exceeded this limit before and my hits continued to be counted accurately (which I determined by comparing the data to a 2nd tracking system I had in place). So I guess there’s no guarantee it will work, and none that it won’t either.

To make things a little more convenient, I have put together a little helper class over time. The main thing it does is automate the 500 requests per connection checking. Just enter your tracking id, then use GATracking.init(displayObject) to connect, and GATracking.trackAndCountEvent and GATracking.trackAndCountPage to track things.

]]>http://www.allworkallplay.org/blog/tracking-player-metrics-and-views-in-flash-games-with-google-analytics/feed/24http://www.allworkallplay.org/blog/tracking-player-metrics-and-views-in-flash-games-with-google-analytics/?utm_source=rss&utm_medium=rss&utm_campaign=tracking-player-metrics-and-views-in-flash-games-with-google-analyticsOrbital Debris – Making an HTML5 Game With Phaserhttp://feedproxy.google.com/~r/TXSa/~3/BBiZeU48w_8/
http://www.allworkallplay.org/blog/orbital-debris-making-an-html5-game-with-phaser/#commentsMon, 03 Mar 2014 18:54:05 +0000http://www.allworkallplay.org/blog/?p=6This is Orbital Debris, a small game I made in HTML5 with Phaser for a game jam organized by FGL. It won 3rd place! :) Considering I only had 48 hours and was working with technology I’d never used before, I’m really proud of the result.

Making Of

I assume you’ve already gone through the Phaser starting tutorials and know how to create a basic game. If this is not the case, please read this and this first. I’m only going to cover the things unique to Orbital Debris.

A link to the souce files (code + art) is included at the end of the article. But be warned, it is game jam code and my first time working with Phaser so it’s far from perfect code.

The Concept

The theme set by FGL was “silent, but deadly”. Which made me think of “in space nobody can hear you scream”. Which made me think back to Gravity, my favorite movie of 2013. And just like that I had my idea within 15 minutes of the jam starting: you play as a space station orbiting the earth and have to dodge space junk released by satellites crashing into each other.

Gravity, The Main Inspiration for Orbital Debris

Basic Game Logic

Orbiting A Planet

The first thing I did was get some objects orbiting around the earth. Every orbiter is just a Phaser sprite with some special properties that gets added to a group that contains all orbiters.

Orbiter.moveData.altitude and orbit describe the orbiter’s current position relative to the planet. The altitude is the distance from the center, and the orbit is how far along its orbit it is. So making the orbiters move is a simple matter of using the values to update them in Phaser’s built-in state update function.

Player Input

I wanted to force players to keep re-adjusting their altitude to stop them from idling at a fixed altitude, and I also wanted movement to feel quite flow-y. So I came up with a simple acceleration-style system. First I check the keyboard and adjust the altitudeChangeRate accordingly. You can think of altitudeChangeRate as velocity towards / away from the earth.

When a satellite or station is hit, I spawn new pieces of space junk. They are just orbiters (just like the space station or satellites). Their altitude, and orbit direction are based on the satellite or station that was destroyed. When the space station is hit, it’s a bit of a special case: I spawn a lot more junk than usual to make it feel more dramatic and end the game.

Remaining Bits & Pieces

That’s pretty much all there is to it! To complete the experience I added some powerups, scaled the difficulty up over time, and added a bunch of hud stuff and music. And then I was out of time and had to submit the game for the competition. If you have any questions about how anything was done that I didn’t explain here, please leave a comment and I’ll get back to you.

Thoughts on HTML5 / JavaScript / Phaser

This was my first time working with the Phaser HTML5 game engine. Usually I avoid unfamiliar technologies during game jams… every hour counts and I don’t have time to start learning new things. It was a risky, but I decided to try it anyways. I liked that 1) it can run in mobile phone web browsers which makes it easy to share 2) it’s similar to flixel which I know inside-out and 3) I already knew some Javascript / HTML5.

Overall I really like the engine, it has a lot of great features and is easy to work with. Phaser gets updated often, which is great because it’s constantly improving. But it also means that a lot has changed from previous versions. This was sometimes frustrating when I would read about how to do a certain thing in an older version of Phaser, which no longer works the same in the latest version. I plan to use it again soon, but for a hobby project without such a stressful deadline so I can spend more time getting to know it. I could see it one day becoming one of my go-to development tools.

Performance

I couldn’t get the game running smoothly in my phone’s browser in time for the deadline, so I had to cancel the mobile version. It’s a shame because being able to play the game in mobile phone browsers was the #1 reason I wanted to use Phaser in the first place It appears it’s something you really have to keep a close eye on.

I used the Chrome JavaScript profiler to take a peek at what’s taking up most of my processing time. From what I can tell the biggest performance drain is the collision system. Especially when the space station crashes and 30 new pieces of junk are spawned, my iPhone 4S performance slows to a crawl.

Using the Chrome JavaScript Profiler to Check for Performance Issues

Since I was unfamiliar with the engine, and had to no time to clean up my code or learn how to do things properly I know I do a lot of things badly. I’m careless with creating objects and freeing up memory. I could pre-compute some stuff. I could simplify other things. But I didn’t have time to do it. Next time, I’ll do better and keep testing on my phone along the way!

Source Files

This is not optimal code. It was my first time working with Phaser. I had a 48 hour deadline. There are lots of things that could should be improved upon. I am including the source files as a download anyways. They are not intended as some sort of model perfect Phaser project. Download at your own risk!