Brief Technical Interlude

Posted in: General News, Gravity Simulator, Wednesday Update | June 20, 2013 | No Comments

Out and About

First up, TestTubeGames was featured in an article this month by STEMwire.  It is an article (er, slideshow, sorry) about various creative toys and games to teach STEM (Science, Technology, Engineering, and Mathematics).  Check it out here.  That ‘Compounded’ game looks neat — I suggest checking out its Kickstarter video for a good ol’ fashioned Bill Nye parody.



Making a Game for Everywhere

(Warning… technical details ahead!)

This week I’ve been thinking a lot about platforms. (iPhone/browser/PC/Mac/Android/the list goes on).

So far, I’ve made Flash games and iOS apps.  And each game is one or the other of those.  So if you want to use my Pocket Slide Rule, well you better have an iPhone.  And if you want to play Velocity Raptor, it’ll be in a browser.  Occasionally I’ve bridged the gap between those two — so you can play Agent Higgs on you iOS device, or you can play an abridged versions of it as a Flash game.  But that’s really like making two games.  I needed to recode it, rearrange it, change the art around so it fits the screen…  All in all it’s a lot of work.

The reason I’m thinking about these things is because of the update to the Gravity Simulator.  One of the big plans for the upgrade has been to move it *beyond* just being a Flash game.  It’d work great (and be fun) to touch and fling planets on mobile devices, I figure.  My goal: Browser/iOS/Android… possibly downloadable simulations for PC and Mac, too.  That’s a lot of platforms I’ve never made games for.

There are, it turns out, some newfangled ways to do this ‘easily’… and so far I’ve explored a couple.



If you make your game in HTML5, it’s playable right in the browser just like Flash.  But the neat thing is there are ways to turn HTML5 games into official Apps which you can sell in iOS/Android app stores.

Neat in theory, so I started making the new Gravity Simulator in HTML5.  In fact, I even used a framework — Game Closure — to streamline everything.  (Frameworks are like having an assistant to deal with the boring technical stuff — so you can just worry about making a game.) Boy, that was a headache.  I’ll admit, for starters, that my background *is not* in programming… I’m just picking things up as I go.  But I had constant issues getting an HTML5 game (with Game Closure) to work.  The game would work in browsers, but break on iPads.  Or there would be bugs — so many bugs, and often they wouldn’t even be bugs in *my* code, but rather with the framework.

The *biggest* issue I had was with orbits.  The drawn orbits in the Gravity Simulator turn out to be the toughest piece of the whole system.  Why?  Because you need to be able to draw a line that that grows longer and longer *forever*.  It starts off simple:

What's so pretty about r^2 gravity?

What’s so pretty about r^2 gravity?

And the lines keep growing.  You get 10,000… 50,000… 100,000…1,000,000… and more vertices on these lines that loop back and forth over each other.

Ahh... that's what's so pretty about r^2.

Ahh… that’s what’s so pretty about r^2.

Eventually the system can’t handle it.  In order to do that without crashing the system/killing the framerate, it takes some sneaky work-arounds.  Maybe you turn the lines into a picture.  That way the most you’ll ever need to draw is a picture the size of the game… you won’t have to worry about a million+ vertices.  Or better yet, just forget about the lines, and just make a list of pixels that are colored in.

Well, it turns out that, at least as far as I could find, HTML5 (and namely Game Closure) wasn’t well suited to the task.  ‘Line Drawing’ is barely present in that framework… and invariably something that worked in the browser wouldn’t work on my iPad.  Try as I might, it gave me a bunch of headaches and it never came together.  HTML5 is often criticized for being ‘not finished yet’, and now I can understand why.



This is another popular way to make games for a bunch of platforms, and it is much more polished than HTML5.  (It outta be, it’s a commercial product, after all!)   I’ve been trying it out for the past few days, and I like what I’ve seen.  There is a much more robust system for *drawing*, which is key.  Lines, pixels, it’s all good.  I can even draw a surprisingly high number of lines before I need to resort to tricks.  And so far, what I’ve found, happily, is that the tricks work both in the browser *and* on an iPad!  I write one set of code, and it does seem to work similarly in multiple places.

So at the moment, that’s where I am… working on prototyping the Gravity Simulator in Unity.  The path towards ‘easily making a game in a bunch of places’ has been a tough and winding one.  Here’s hoping that Unity will fit the bill.  Then I can get down to real things, like actually making the simulator (better).


This entry was posted in General News, Gravity Simulator, Wednesday Update. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Write your comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>