## Under the Hood

Posted in: Electric Shocktopus, Wednesday Update | August 15, 2013 | 16 Comments

In the in-development game (ahem, ~~The Electric Shocktopus~~), the title character can charge himself and fly across electric fields.  But how do those electric fields get there in the first place?  Well, since it is a true simulation, we (I? The computer?) have to compute them.

The Simulation: Part 1

Electric Fields are an easy matter, right?  Say we’ve got a positive charge in the middle of a level.  To find out the electric field around it, we turn to Coulomb’s Law, something we all learned in high school.

The field points away from the electric charge, and the strength drops off as the distance squared.  Simple.

If we have multiple charges, thanks to the superposition principle, we just do this for each charge — then add it all up.  Straightforward, simple, perfect.

But that’s not the end of the story.

The Simulation: Part 2

Because in the game, I want there to be conductors.  And these blocks of metal affect the electric field.  The conductor, you see, is filled with positive and negative charges.  Put another positive charge next to it, and the negatives in the conductor crowd toward it.  Unfortunately, calculating these effects is no easy matter.  Only in very symmetric and special situations can you even write an equation for this.

Enter the poorly named ‘Relaxation Methods.’  Since we’re on a computer, this is a way to numerically figuring out what the fields should be.  And we’ve gotta crunch a lot of numbers to do it.  Basically, you turn the screen into a grid (which is easy, since the game is already built on a grid). Then you take a guess at some initial values of the field, the ‘rough draft’ so-to-speak, which can be completely wrong for all we care.  The strength in this method comes from revisions.  You take the grid of bad values, and go through, do the number crunching, and make them slightly better.  And then you repeat – a lot.  Fifty times, a few hundred times, something in that ballpark.  And eventually you get ‘close enough’ and stop.

Turns out, this isn’t too bad.  On the 2D grid of the screen, the game can generally figure out the electric fields in about a fifth of a second.  And since this is a 2D game, that’s all we need.  The third dimension is irrelevant, right?

The Simulation: Part 3

Wrong.  It turns out, that third dimension affects us whether we like it or not.  Even if we think we’re dealing with a 2D grid, the third dimension is assumed.  And that third dimension is very boring — nothing changes as you move along it.  It’s just a whole line of carbon-copies of the screen.  It’s as if every point charge we place extended in that direction and made a line of charges.  And a line of charges gives a very different field from a point charge:

The force drops off more slowly, so stays stronger even further away (it falls off as the distance, not the distance squared).  As you can tell by the face that the Shocktopus is being repelled back into a wall.  So what we think of as ‘point’ charges in this method are not point charges at all.

The solution?  Do the Relaxation Method on a 3D grid.  It’s a whole lot more calculations (instead of 50×50 points, we have 50x50x50 points), and takes a few seconds to compute the fields.  But, for all that, we can finally have point charges and conductors coexisting in the game.

Moral of the story?  Nothing is as easy as you’d expect.  The 2D game is actually a 3D simulation.  Shocktopus *could* move in the third dimension to skip past barriers, he just chooses not to.  He likes the challenge.

-Andy

## Cue the Music!

Posted in: Electric Shocktopus, Wednesday Update | August 5, 2013 | No Comments

The Electric Shocktopus is marching ever-forward.  And just recently, I added a big piece to the game: the music!

In the past, I’ve sourced my music either from free places — or made my own.  Occasionally I bought some pre-made tracks.  But not this time!  For a game like ~~The Electric Shocktopus~~, I needed something bigger.  Something better.  Something, dare I say, awesome.

So I went to Brian Allan Holmes, a video game composer.  He’s done some great game music in the past.  In fact, he’s the guy that made my favorite flash game music ever — for Burrito Bison.  Years after playing the game, I can still hum the tune.  I’ve never experienced that with a browser game before or since.  Take a listen to some of the Brian’s music for Burrito Bison:

[bandcamp width=450 height=570 album=2410692867 size=large bgcol=333333 linkcol=e99708 notracklist=true]

I told him about Electric Shocktopus, and he set to work making some original tracks to fit the tone and style of the game.  If you’ve played the prototype so far, you may have heard some early versions of these tracks.  It’s epic, rock-y, beach-y, and great to listen to!  I’m delighted with the tracks — and it makes working on the game a whole bunch more fun with the Shocktopus music playing through my headphones.

Rock out, Shocktopus!

-Andy

## Velocity Raptor Level Editor

Posted in: Velocity Raptor, Wednesday Update | July 21, 2013 | 2 Comments

It’s been a few weeks of radio-silence over here, primarily due to me being out-of-town, and away from the Internet.  But I’m back home, and have a new update that was hopefully worth the wait…

Velocity Raptor has a fresh update, with a brand-spanking new level editor.

Build it and they will play

Start with a blank slate. Then add walls, water, trap doors, fire/snow/doppler blocks, etc.  Whatever your heart desires.  Then go ahead and play your level.  And when you’re all done, you can share it using the level’s code.  Send it to a friend, post it as a challenge on Facebook, email it to me to show me what a good level designer you are, or post it in the forum for the world to see.

Where c = 1… due to a shortage of pixels

If enough new levels get created, I can add in a system (just like with Agent Higgs) where we can all share levels with each other.  Have fun creatin’!

-Andy

## Agent Higgs Shared Levels

Posted in: Agent Higgs, Wednesday Update | June 30, 2013 | No Comments

First, a quick apology for the late ‘Wednesday Update’ this week.  I’m actually traveling around the country for a couple weeks, so I spent the past week or so feverishly tying up some loose ends of projects.  And all that time I spent *not* writing blog posts was spent making new content for you all.  So I’ve got a few new things up my sleeve in the upcoming weeks.  One of those being…

Agent Higgs Shared Levels

The flash version of Agent Higgs has had a level editor for a while now.  It’s pretty straightforward to use and make whatever levels you can think of.  In fact, you can find an ever-increasing list of cool levels in the forums.

But they are no longer just in the forums!  Player-generated levels are now attached right to the game.  It’s still a system in beta mode, with room for improvement, but if you scroll over to the far right in the menus, you’ll find a playable list of user-creations.  Play them.  Rate them.  Get a new ‘best’ score.  And, if you’re so inclined, make some yourself!

Perfect is 1 move? I can beat that…

The reason I added this in?  Well, I got curious to see if there was an easier way to share levels.  I had the level editor there, but to play someone else’s level, you needed to copy and paste a level code from them.  Not terribly smooth.  And with the Electric Shocktopus having a level editor, too, I figured the time was right to test out a ‘better’ method.

The shared levels just appear in Chapter 1 for now, but there’s nothing to stop me from adding them into Chapter 2, as well.  And, who knows, maybe the same system can be put in place if I ever do make that Velocity Raptor level editor…

-Andy

## Brief Technical Interlude

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

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

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.

HTML5

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?

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.

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.

Unity

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).

-Andy

## Weekly Rundown

Posted in: Electric Shocktopus, General News, Wednesday Update | June 13, 2013 | No Comments

Forum Developments

For those of you who haven’t been following along (and why not?), the forum is doing swell.  After it was unveiled last week, it has been a hotbed of science game chat.  So come by, introduce yourself, play some neat, new Agent Higgs levels, and read a discussion about the evolution simulator.

As always a big thanks to my playtesters.  Their help with the (many) versions of Shocktopus have been invaluable.  This week, I’ve been using the latest round of feedback to fix up the game.  So I’m taking out levels that are only ‘fine’, leaving in ‘awesome’ levels, and trying to improve ‘good’ levels.

The level design is a huge part of what’s left in the game — but certainly not the only part.  I’m in the process of getting music, adding (good) instructions, putting in flammable scenery, and introducing the plot.  Oh, and as for the plot, this image should pretty well set up our conflict:

Hey, man, Shocktopus spent hours building that thing!

What is that new thing we see in Shocktopus’s hands?  Ah, his trusty Electric Guitar, of course.  I mean, what other instrument could he play?  Though, when he plays, I’d back up if I were you.  Remember what I mentioned earlier about ‘flammable scenery’?

“You wouldn’t like me when I’m angry. Especially if you’re a coconut.”

That’s right, when the Shocktopus charges himself, there are some side effects.  Not that *he* cares.  As the old saying goes: ‘you can’t exact revenge upon the Magnetic Yeti without burning a few trees.’

-Andy

## A Forum for Us

Posted in: General News, Wednesday Update | June 5, 2013 | No Comments

Some neat news this week from TestTubeGames — we’ve got a brand new forum!

Last week I’d mentioned that this might well be in-the-works.  It turns out it is extremely easy to add forums to a website nowadays.  Frankly, how could I *not* add it?  And just like that, with just a few clicks, the forum is now a reality.

Whoa, it looks like a *real* forum!

The forum is setup to have individual sections for each of the games — for feedback, tips, questions on that particular game.  Come share that neat Gravity level you made, challenge others to solve your level in Agent Higgs, or find out more about the nuts and bolts of Velocity Raptor’s relativity simulation.

There’s also a section of the forum to discuss *other* science games (non TTG, that is).  I’m always interested in finding new, neat science games.  So post your favorites.

Finally, of course, there’s a General Chat forum for everything else.  Say ‘hello,’ chat about some random science topic, or give feedback that doesn’t fit elsewhere (“The TestTube should definitely point left instead of right…”)

It’s only been up for a couple days, but we’ve already got plenty of discussions going.  For instance, ARP noticed something very neat about the stability of orbits… and also made a very challenging and complex level in Agent Higgs.  There’s a growing list of science games that we enjoy, so take a look there, too!

The forums are definitely in a beta mode — at least in the not-sure-what-they’ll-look-like-in-a-month way.  So come on by, join in the discussions on science and games, and together we’ll see where this goes.

-Andy

## This week, it’s about *you*

Posted in: Electric Shocktopus, General News, Gravity Simulator, Wednesday Update | May 30, 2013 | 4 Comments

For this week-in-review, it turns out I’ve got more questions than answers.  Questions for you, in fact, the player/reader/steward of science.

Forums

I’m thinking of adding some forums to the site.  The hope is, a forum would provide a nice place for science/game discussion.  It’d be a spot to chat about:

• The science in these games. Got a question about the relativity in Velocity Raptor, or about the math in the Gravity Simulator?  Ask away!
• The games themselves.  Say you’ve made a picture in the Gravity Simulator, or created a level in Agent Higgs.  Perhaps you’re stuck on a level and want some help.  Maybe you have a feature you’re dying to see in a game.  Bring it to the forum!
• Science Games in general.  There are a bunch of other neat science-y games out there in the world/internet.  You’ve probably come across some that we need to check out.  Share and share alike, I say.

Those are *my* thoughts, but I’d be interested to hear from you.  What would you want out of a forum?  Would you have any use for it?  Leave your thoughts in the comments below.

Shockto-V3

The newest version of ~~The Electric Shocktopus~~! is ready.  Let’s call it the ‘pre-alpha version 3.’  I’ve already got some helpful playtesters are giving it a trial run, which I’m so thankful for.  If you’re interested in helping out, too, send me an email.  When it comes to playtesters, the more feedback I get about the game, the merrier.

Gravity Simulator

With Shocktopus back out of my hands for the next week or so, I’m working on the Gravity Simulator again.  There will be two big changes to the preexisting game.  For starters, it won’t just be a flash game anymore, it will be playable on a bunch of devices — online, android, iOS, the whole gambit.  Also, there are going to be a lot more features.  You’ll be able to, say, change the colors of objects.  Or add them easily along evenly-spaced grid lines.  Or modify the celestial bodies mid-flight.  All the things I’ve heard people say that ‘they’d love to see’ in the simulator.  Is there something you’d like to see in the new update?  What is the current simulator missing?  Again, leave it in the comments, or send along an email.

-Andy

## The Latest on ~~ES~~!

Posted in: Electric Shocktopus, Wednesday Update | May 23, 2013 | No Comments

On Monday, the ~~Electric Shocktopus~~! got its first (minor) debut.  Still very much in the pre-alpha, work-in-progress stages, I brought it along to a local ‘demo night’ to show it off.

I dare you to get all three stars…

What’s a ‘demo night?’  Every few months in Boston, a bunch of indie game developers get together and play the games that we’re all working on.  It’s a great chance to test our games in front of real players, and since many of those ‘players’ make games themselves, you can imagine the feedback is particularly insightful.

So what did I learn?  Well, I found that some parts of the game were working great. People in general enjoyed the game, chuckled at the bad puns, and liked the cute Shocktopus.  The game did turn out to be more difficult than I intended — so much so that I had to quickly go through and tweak some levels as the night went on.  But all in all, people seemed to like the fact that it was a tough game.  Like Super Meat Boy, generally when a player died they were ever-more determined to win.

Beyond all the comments I got at the Demo Night, it was also just a great deadline for me.  In the week leading up to it, I added in a slew of new features to the game, including…

Zoomed in Levels

For intimate gatherings

A Level Editor

To make and change levels quickly

Puns, Puns, Puns

That pun, I do not think it means what you think it means

I’m already working on the next version, trying to take all the feedback from Monday into account.  If you’re one of my helpful, helpful playtesters… I’ll be sending the new version along to you soon.  And if you aren’t a playtester, but would like to be, just send me an email, and I can add you to the list.

-Andy

Posted in: Gravity Simulator, Wednesday Update | May 8, 2013 | No Comments

The new gravity simulator has been making some great progress.  I’ve been spending a lot of time translating the game over to HTML5, and hoping it’ll be worth it.  I can’t wait to see the game on tablets and mobile devices.

But, as always, it’s not so much about what progress I’ve made (zoom capability, fast loading times… uh, not-crashing), it’s about what progress I’ve made that *looks good in pictures.*  So here are a couple new features that I’m excited about:

Color!

The old game always had white lines against a black background, but now you’ll be able to change that at will.

Go Pink, Go!

Dust Particles

In the old version, you could fling up to 7 asteroids.  Now?  No limit!  Even more than that, there’s a new tool where you can put ‘dust particles’ into your solar system.  Basically it’s a set of bodies with semi-random positions and velocities.  Helpful for charting out the gravitational pull in your system… and also just plain cool.

Galactic dust mites are having a field day

So all in all things are moving along for the Gravity simulator.  I’m still (as always) taking suggestions and comments about the old version and features you’d like to see in this new version.

-Andy