Android Lifecycle for a Native Activity

Posted on April 17, 2014 by Andy

I’ve been working on the Android version of Backspace recently. On the whole it’s largely similar to iOS development, swap Xcode for Eclipse, replace Objective-C with a bit of Java and Bob’s your uncle right?  Well, for the most part yes :-p

Google provide a Native Development Kit for writing Android apps entirely in C++ which is perfect for our largely C++ engine. Factor in a shared OpenGL ES component and the basic port was reasonably quick.

Then I start hitting the Back and Home buttons and things got weird. Out of order lifecycle events and strange crashes kind of weird. Time to read the docs. Belatedly (as usual).

It turns out that an app on Android is often a collection of separate activities, presented together in a stack. You navigate between activities using device buttons such as Back and Home. Android implements this by launching activities into a ‘task’, a bit like tabs in a web browser. And like opening the same web page in different tabs, Android can launch multiple instances of the same activity…

Hmm, I’m not sure that’s a good idea for a resource heavy game like Backspace.

It got more interesting when I discovered what a Native Activity truly is. Unlike other platforms where code is compiled into an executable, the NDK builds code into a shared library instead. Native Activities are actually a host Java process that load this library and then spawn a new thread to call native code on it’s lifecycle events. As shared libraries are not necessarily loaded and unloaded along with the host Java activity, and Android can launch multiple instances of an activity, it appears that our entire engine needs to be thread safe!? Yikes.

Well, I can make it safe to re-enter easily enough. It already performs a full teardown on exit so I just needed to reinitialise any global/static variables then. This solved crashes on successive launches but what about multiple instances running at the same time?

Thankfully I can change the default Android launch behaviour with a manifest flag called launch mode. Switching to ‘single task’ looked appropriate for Backspace and solved the remaining lifecycle conflicts that I saw in testing.

One last thing. I struggle without a visual debugger – and Eclipse is a big meanie that nearly made me cry.

Posted in Backspace, Tech | No Comments


We’re making Backcraft instead

Posted on April 1, 2014 by Steambot

After a quick chat long deliberation we decided that there really is no point in making Backspace if we want to be rich and famous commercially viable. Therefore we are delighted to present you with…

Backcraft, a procedurally generated rogue-like MMORPG with crafting set in a futuristic post-apocalyptic world!

Features include:

  • perma death
  • lots of shooting
  • lots of guns
  • lots of robots
  • lots of aliens
  • upgradable robots
  • craftable robots
  • craftable guns
  • zombies
  • cybernetic zombies
  • become a cybernetic zombie yourself!
  • and much much more!

Pre-order Backcraft today!

A very good morning to you from Hawaii. ;)

-Nina

Posted in Uncategorized | No Comments


Honeycomb

Posted on February 3, 2014 by Andy

Last week I showed the editor to a couple of friends/colleagues for the first time. There’s a considerable amount of design experience between them so it felt like a big deal. To me at least. To them I suspect it was more like shambolic amusement. Huge thanks to them both for just taking a look at it.

In other news, the Copy/Paste tools were completed. The first ‘stamp’ I created was a simple palette for quickly selecting surface types. Turns out it makes quite an attractive brush, check this out:

Posted in Backspace, Media | 2 Comments


Encounter Design

Posted on December 12, 2013 by Andy

There’s been a recent focus on nailing the minute-to-minute Backspace experience so we can push forward with level design. I felt that I didn’t yet understand how to get the best out of our (many) mechanics and features, and that made it very difficult to build or even plan out any reliably fun game play.

So I’ve decided to try the 15 minute design challenge!

“Pick a small number of game elements, set a short time limit and try to make a fun encounter.”

It turns out this constrained approach works really well in the editor and I’d like for us to do as much of this as possible in the coming weeks. Nina and I had a couple of goes already and the results were really encouraging. Proposing and attempting challenges in teams works even better as we get to switch designer/player hats so often.

Some things I’ve already learnt:

  • Each level should be a sequence of short, local, individually designed encounters
  • Each encounter must have a clear objective and tell a story
  • Enemies need to be fun on their own before we can be confident in their final behaviour

Making an objective clear means being able to see it – before having to engage in combat, or attempt a puzzle. I shall try pulling the default game camera back to help with this issue.

Deliberately placing enemies and surface to defend these objectives is what I mean by story.

With a decent library of these level chunks, we then piece them together to form entire worlds based on the higher level world/zone design. I plan to add some copy/paste editor support to make this easier.

Posted in Backspace, Media | 5 Comments


We’re back!

Posted on by Steambot

Over the last couple of months we’ve worked for the good chaps at Revolution on Broken Sword 5 – the Serpent’s Curse, which is available now on GOG and Steam! Nice job everyone!

After much rejoicing and several visits to the pub, we’re back to Backspace. Development has not stood still since the last update, which promised a new website in a couple of weeks soon. Website aside – death, saving, degradable enemies, a new enemy type, multiplier, level transitions – tons of stuff has been added and changed. So much, in fact, I couldn’t possibly do it justice in one post. So expect more updates from me and the other megabots soon. :)

I for one can’t wait to blog about the Biggest Change Ever™ (clue ominous music)!

Thanks for reading,

Nina

Posted in Backspace, Website | 4 Comments


< Older Posts Newer Posts >

 

MAILING LIST

Sign up to receive an email when the game is released.

Name
Email