Categories
android computer games entity systems games design

LudumDare 21: Escape from the (Android) Pit

I couldn’t enter this LudumDare competition on a technicality, but here’s my entry which plays by the spirit of the rules. I took a total of 24 hours (out of 48), of which only 12 were actual design + development (see below). Hopefully next time I’ll be able to do it properly, and actually compete. I’ve kept to every rule, except that I did my 48 hours time-shifted :) from everyone else (two successive Sundays, instead of a contiguous Saturday + Sunday).

Screenshot + Android APK

Download link (APK – you need to know how to install APK’s manually (google it if you’re not sure, it only takes 5 seconds)):

Escape From the Pit

Aims

  1. Make a LudumDare entry as an Android application – none of this easy “make it in Flash” or “make it in java” stuff – let’s go for a full mobile game, designed, developed, and launched in exactly 2 days flat!
  2. Use an Entity System (c.f. my long-running series of articles, and also the public Wiki I created), and show that ES’s facilitate you writing new games VERY VERY QUICKLY
  3. Make a game that was mildly challenging and (almost) enjoyable

Failed to officially enter the competition, but otherwise succeeded…

Background

LudumDare challenges you to write an entire game in under 2 days (technically: 48 hours – it’s up to you how much of that you sleep). You can’t even design it in advance – there’s a theme that’s only decided shortly before the 48 hours starts.

LudumDare was the weekend before last – but I had to work that weekend on urgent day-job stuff. Like: I had to work all day Saturday, and there was no way out of it. So I couldn’t do the same 48-hour stint as everyone else.

Also, I know from previous experience that the “48 hours in one stretch” is very different from – say – “12 hours for 4 days”. When you do a 24 or 48 hour game, you tend to only manage a certain percent of “productive” hours. The challenge of designing + building something from scratch forces you to keep taking “time off” to go think about what do next.

So, I kept a diary of hours worked, and hours taken “off” as well. I’m confident I’d have fitted all of this – development time AND down-time – into the 48 hours. But I had to spread it over 2 successive weekends :(.

Day 1

(3 hours) – install Eclipse and the Android plugin, and the Android SDK. Document what I’ve done (1 hour) and check I can re-do it at will. Google, please wise-up and fix your install process – it’s not changed in almost 2 years, and it SUCKS

(1 hour) – install some extra Android OS versions, get the emulator working correctly, get projects imported, get everything in source-control, get empty app running on hardware device. Ready to start project!

— NB: everything up to this line I should have done before the contest started. If I were the kind of person that had free time on weekdays. Which sadly I’m not —

(1 hour) – getting Android base classes up and running. Takes a while: Android is insanely badly designed for the “Core application” part. Needs hundreds of lines of code to make a Hello World app that *actually* works as an app (Google’s code example that does it in 4 lines is fake: no real app could do that).

(3 hours) – on the beach, not working

(4 hours) – upgrading the open source Entity System Libraries on http://entitysystems.wikidot.com to support a bunch of features I’ve been using for a while in my own projects. This required writing a lot of stuff from scratch (using my own old source as inspiration), and integrating some improvements from patches/forks that other people had submitted.

— NB: everything up to this line I could have done before the contest started. Interesting though that I thought this was going to be “about to start writing the actual game” and I’ve only finally got to the point where I can write my first line of game-code —

Day 2

(0.5 hours): trying to make textures in Photoshop. Photoshop really sucks. Half the online resources for making the kinds of textures I want require PSP’s unique filters/effects – useless :(.

(0.5 hours): get a single sprite to appear on screen. A couple of idiot errors in one of my libraries – plus Google’s Eclipse plugin being really really bad at understanding “the scroll bar” (bug in ADT: it implements the world’s only non-static scrollbar)

(1 hour): random maze generation (using: http://en.wikipedia.org/wiki/Maze_generation_algorithm#Randomized_Prim.27s_algorithm ) that makes nice mazes, printing out onto the screen, still with my default “starfield” background. Rotating the screen is causing the entire game-state to be regenerated – includkng the maze – which was an accident, but actually helped A LOT with testing the maze algorithm (just tilt to re-run the algorithm instantly)

(0.5 hours): learn how to do Android input-handling correctly; en-route, discover I’m missing the SDK docs, and set about downloading + installing them … + updating my blog instructions on how to install Android to include “SDK docs” as a section.

(2.5 hours): discovering MAJOR bugs in Google’s basic “touch handling” API for Android – including bugs on Google’s own website source code, and an API designer on crack who broke the core Java contract didn’t document it. Not Happy.

Day 3

(1 hour) – implementing a collision detection system that does proper swept-collisions, but works OK with the poor fine-grained control of touch input

(1 hour) – added filters to collision detection so I could have background images that the player will NOT collide with
(previously was colliding with every on-screen rendered sprite). Also added a very simple lighting system where squares that the player has walked close to or upon gradually light up, showing how much has been explored

(1 hour) – refined the user-controls so you can hold your finger still and character keeps moving in that direction. Added handling in collision-detection system to allow character to slide along walls and into side-passages without the player having to stop and be ultra-precise (pixel perfect!) in timing the change of direction.

(0.5 hours) – added an exit, fixed bugs in the maze-generation (if started on a right or bottom edge, it crashed)

(1 hour) – fix Android’s brain-dead handlig of Bitmaps, giving a big speed boost, and re-learning how to use DDBS memory-allocation-tracking. I’m now auto-caching each bitmap inside my Sprite object. Sigh. There’s no easy workaround: Google says “don’t use getter methods” but Google also says “don’t call our getDrawable method more than once”.

(1 hour) – added ghosts, made them move around the map nicely, and collide with player was *automatic* on first compile (freebie from using an Entity System!). Also made arrows float nicely in same place on screen even while scrolling.

(1 hour) merge code from laptop back to desktop. Finally add the “win” conditions that makes the app playable!

Source Code

To make this game, I improved the basic Java Entity System up on the ES Wiki, and added some usability improvements and features. I created a whole new page for it here:

http://entity-systems.wikidot.com/rdbms-beta

NB: It’s called “Beta” simply meaning “second generation (beta == second letter of greek alphabet)”. Not because it’s a beta-quality release :).

Source code to the game itself is also up on github right now – https://github.com/adamgit/Game–Escape-from-the-Pit – although that’s a closed repository at the moment. I want to double-check there’s nothing included that shouldn’t be before I set it to “public”.

Categories
computer games games industry games publishing marketing and PR

MS XBox Europe: man puts elbow in own ear

…or at least tries to, when Chris Lewis comes out with quotes like this:

“you can be very confident we seek to maximise our own advantage to ensure the playing field is even, and certainly plays to our advantage”

Wait, what? An “even playing field” is one which “plays to [Microsoft’s] advantage” ? Hmm. Talk about a crushing sense of self-entitlement…

“we just want what our consumers want from us.

If [developers don’t give us free stuff which we don’t pay for], Microsoft reserves the right to not allow the content to be released on Xbox 360”

Wait, what? Are you saying that what “our consumers want” is to be prevented from playing the games they want to play (“Microsoft … not allow the content to be released”)?

I’ve seen a lot of bullsh*t over the years from weak-willed Marketing department employees who feel that “not saying a bad word about their boss’s / employer’s incompetence and greed” is the right way to do a job, but … this is especially bad.

I think Chris needs a bit more practice at the technique of:

“say what the person you’re trying to brown-nose wants you to say, no matter how much it makes you look like a pathetic, stupid, snivelling idiot”

Categories
entity systems

Entity System: RDBMS-Beta (a new example with source)

I’ve just added a new, improved Entity System design to the wiki. I’ve also created a github project for it where I’m about to check-in working source.

The only source I’ve provided is Java – but it’s an evolution upon the old “RDBMS with Code in Systems” type, that already has full source for Java and Objective-C – so you could easily upgrade the obj-c version to this new type (hint, hint).

What’s new?

Three major changes:

  1. Included a bunch of sensible java-specific improvements, based on the forks other people had done of the previous Java implementation
  2. Added a bunch of FANTASTICALLY USEFUL methods to the EntityManager – things you definitely need when writing a game
  3. Added a new concept: the Meta Entity

The first one is obvious, the second is obvious when you look at what’s added (e.g. a “removeComponent” method; why wasn’t it there originally? Solely because it wasn’t necessary to show “the simplest possible implementation”).

The interesting one is number three: the Meta Entity

What’s a MetaEntity?

A while back, in the first Java/Android ES I wrote about, I mentioned that I was using a fake Entity class.

I made a big fuss about how this was NOT being used to store any game data – but was instead an OOP trick to make it easier to write code.

Thinking about this later, I realised that there was really no need for that class to be named “Entity” – and calling it that ran the risk of tempting people into using OOP for their core data / components (Remember: Never do that!). Instead, looking back at a couple of example ES’s I’d written, I saw that every method – and all data – in this class was a “meta method”.

For the methods, you need to read the source AND the javadocs to see this.

For the data, it’s a lot more obvious: the only data that a MetaEntity has is:

  • The Entity itself (remember: that’s just an integer – or a UUID object in Java, which is a cleaner Java-specific way of handling it)
  • The EntityManager object which created this Entity, and which contains the Components for that Entity, and … basically provides all access to the data etc

i.e. if you pass around MetaEntity objects, you can feel safe that you know where they came from, where their components are, etc.

Because when you pass around raw Entity’s, they’re just an integer – which makes it easy to create an Entity in one EntityManager, then accidentally start using it in another EntityManager. Technically that’s illegal – but from a compiler perspective, it’s 100% legal … so you’ll get bizarre runtime bugs. Ouch.

Equally, the MetaEntity can contain a lot of single-argument and zero-argument versions of methods that exist in the EntityManager as 2-argument, or 1-argument methods. This greatly reduces typing, increases readability, and reduces opportunities for bugs. It may sound like a very small change (2 arguments dropping to 1), but I promise you: in practice, it makes a big difference.

Why not use MetaEntity’s all the time?

They’re very inefficient in how they use memory, and they throw away many (but not all) of the performance advantages of an ES.

For instance, because you’re moving from “integer + array of structs” to “linked-list of objects”, you’re making your game go from “cache friendly” to “cache poor”, and making your MINIMUM mem usage go from “tiny” to “small”.

In practice … if those differences matter to you, you’re probably writing a hardcore custom ES anyway.

More importantly: even in a “hardcore” ES, you don’t actually *need* that performance all the time. If you’re just pulling out a handful of Entities and their Components – e.g. a player Entity (of which there’s only 1 – or a few for multiplayer) – then the above performance differences are NON EXISTENT (vanishingly small).

…but the code is more readable, easier to maintain, and more robust.

So. I recommend using the MetaEntity for *all* your ES coding … until you reach a point where performance is low. Then look at re-coding *only* the affected loops / methods (remember: you can do this on a System-by-System basis; your code is nicely separated already!). That way, you get the best of both worlds.

However … the reason none of this was included in the first Java ES I posted onto the wiki – the ultra-simple “RDBMS-inspired with Code in Systems” – is that really this is all just gloss on top of an ES. You don’t need it. I believe it makes your ES easier to work with – but it distracts from the core theory.

I’d recommend you start with the simpler ES, and understand it, before moving onto something like this for your practical work.

For more info, check out the wikidot link at the top of this post – and try the github project linked from it (currently empty, until I do a check-in)

Did this post help you?

Support me on Patreon, writing about Entity Systems and sharing tech demos and code examples

Categories
fixing your desktop

Fix Eclipse’s fonts on OS X

Eclipse current version (3.7?) randomly chooses some of the fonts from the System Font settings – this strikes me as rather stupid: you are only “allowed” to customize 90% of the fonts.

Since OS X (10.6.7) still can’t render fonts correctly, when Eclipse grabs the system fonts, they’re often “wrong”.

In Eclipse, you can choose most of your fonts by hand, and choose the font size etc. Combining this with the fixes (1, 1) that force Apple to stop “blurring” every font, you can almost get a useable Eclipse on OS X.

Almost.

Because of the stupid design mistake I mentioned above, the Package Explorer font in Eclipse is “non-configurable”. You want to change it? Give up. Eclipse won’t allow you.

Options

If you’ve used my other fixes for OS X, you’ll have fonts rendering nicely – as long as they don’t get too small.

Eclipse is hard-coded to make the Package Explorer use a stupidly small font. You cannot fix this. It’s a bug in Eclipse that’s been around for a long long time.

On most platforms, this is fine – your system fonts can be resized.

Except on OS X, where the OS has such terrible font-support.

Because of these two bugs (OS X has bad fonts … Eclipse is hard-coded to use small fonts), if you “fix” your OS X fonts to work for most apps, they’ll be broken in Eclipse.

Disabling system-fonts in OS X

The nearest I’ve found is that you can force Eclipse to ignore the *some* of the system fonts, by editing this file:

[eclipse install folder]/configuration/config.ini

and adding the lines:

# Use system small fonts (Mac OS X only)
org.eclipse.swt.internal.carbon.smallFonts=false

Fixing the Log Output window

This one is relatively easy when you spot it: the ADT plugin ignores all the existing fonts in Eclipse, and sets it’s own unique font, for literally one panel only (the coloured log / console pane).

The official name for that pane is LogCat (incidentally, by default, Eclipse hides this pane – even though you absolutely need it while working with Android – you need to go to the Window/Show Perspectives menu and manually add it).

In the main settings for Eclipse … Android, there’s a section LogCat, where you can set the font. This doesn’t actually work – it’s got a bug, and will crash itself – but if you ignore the crash, and restart Eclipse, your changes will be honoured.

What would really be nice

…is if Eclipse added literally one option to their fonts dialog: an option to manually choose the “missing” hardcoded font. Then all would work great.

…or (much more unlikely), if Apple would fix their entire font-rendering system. Over the years, they’ve fiddled with it a few times. They *know* that it’s “technically correct for print-designers, but completely incorrect for many normal users” they *know* that users find it impossible to work with – but their solution so far is to keep removing features and options, and forcing all users to get a mediocre (or plain bad) experience. Hubris, I think.

Categories
android fixing your desktop programming

August 2011: Google’s install process for Android is still terrible

Following my own install-guide from Jan 2011 (because Google didn’t provide one at the time)…

  1. Google still doesn’t provide an install guide
  2. Eclipse is a *little* clearer on what to download – but only slightly
  3. Eclipse.app on Mac OS X is *still* broken
  4. ADT is still “hidden” by Google for no good reason (my install guide still works)
  5. Google still blocks you from downloading any “Android OS platform” (this is a core part of the SDK that is *not* included in the SDK – you need it to make Android apps)

(also, in passing, I updated the instructions to be a lot clearer / a bit more idiot-proof. I just used them to do a fresh install, and it went smoothly – with fewer problems than trying to use Google’s auto-installer)

EDIT: On the plus side:

  1. My install guide spared me waiting for an extra 0.5Gb of Android OS platforms to download (I was able to copy/paste them on the hard-drive, no extra install work needed. Just don’t use the installer!)
  2. ADT v 12 is noticeably more stable and better-integrated with the Android emulator – auto-starting smoothly where previous versions needed you to lead them through baby steps on first-run

Which means the key problem from a year ago still holds today:

Google is still effectively blocking you from using Source Control on Android projects

And they wonder why people still prefer the pain of working with Apple…

Categories
entrepreneurship startup advice

Great news: Cambridge (UK) startup sells for £7 billion

(that’s almost $12 billion)

This is a BIG DEAL, for the UK, and for Cambridge. Rory Cellan-Jones is moaning about how terrible it is (“looks like a sad day for British technology – and for Cambridge in particular”) – and I wanted to put across a very different perspective.

NB: this is just my personal view of how this affects small startups and entrepreneurs. I’m sure there’s much more detailed and smart analysis flying around the financial world, given how big the sums of money are here.

From ZDnet’s report:

“UK employees will get a total of £30m in share options. Founder and chief executive Mike Lynch will continue to lead Autonomy and, as the owner of 8.2 percent of the company’s shares, stands to make more than half a billion pounds off the deal.”

(incidentally – both Rory/BBC and ZDnet report that £0.5b is going to Mike, but I’ve heard that it’s shared between him and Richard Gaunt? Not sure which version is true)

Two things I want to point out here:

Cambridge finally sees multi-billion-dollar exit

10 years ago I was in Cambridge and helped start the £30k business competition. At the time, the dot-com boom was still in full swing, and there was a great deal of excitement. We spent a lot of time with investment funds, startups, and angels.

But there was also a sense of “we’ve been here before, will it go wrong again?”, coming from the older generation – the previous generations of entrepreneurs and investors. To be clear: none of them had become California-sized successes, although there were plenty of professional investors making an OK income from their startup investments.

The suggestion was that in the 1980’s/1990’s, Cambridge had got over-excited, convinced “whatever San Francisco / Palo Alto / Stanford can do … we can do too! (and probably do better)”. But the reality had been that Cambridge had a much smaller area, in a less homogeneous market (europe vs USA), with less investment and less tech resource.

A frequent question was: what would it take to achieve “critical mass” in Cambridge? One of the top answers was: “some billion-dollar startups”. Cambridge had plenty of startups that made tens of millions – but none going for 1,000 x millon dollars.

The forerunners were (off the top of my head): ARM, Autonomy, and Zeus. Zeus was the brand new startup out of nowhere – very much hoping for Cambridge to give them a Silicon-Valley style catapulting into the stratosphere. ARM and Autonomy were older, established tech companies that had shown they could reliably make huge sales internationally. Zeus spluttered out when the dot-com crash hit, but the other two have gone from strength to strength (ARM is currently worth £6 billion).

So, finally, we have proof: you can take a startup in Cambridge, and the founder(s) can grow it to a multi-billion success, and then *sell* – while still CEO – for billions of dollars. I’m slightly happier that it’s Autonomy doing this rather than ARM – ARM has been through many management teams over the years, but Mike Lynch has remained at the helm of Autonomy throughout. “Founding CEO still in charge until the big sale” is what new startups want to see when looking for local success stories and role-models.

Mike Lynch has £500 million burning a hole in his pocket

Why does the whole “billion dollar valuation” thing even matter? There were a bunch of reasons given – all based off analysis of “why didn’t Cambridge become a serious rival to Silicon Valley in the 1990’s?”:

  • Venture Capital firms won’t take a region “seriously” until it’s shown it can create companies of the *ideal* size that VC’s want. A VC may be happy with a $50 million exit – but what they really want is another Skype: multi-billion exits.
  • When startups sell for the tens of millions, the founders often don’t make a huge amount on the sale. They end up “rich”, but not rich enough to become “super angels” (bear in mind that an angel needs to write-off their investments – you need a lot of spare cash you’re willing to *burn*).
  • One step down: the early employees get enough money to perhaps pay off their mortgages – but not enough to become “angels”.
  • Arguably, there’s something self-limiting in the region – some blockage – if companies are stuttering before hitting the multi-billion mark. It’s not a problem in itself, but it’s a “warning sign” – and other industries and entrepreneurs will think twice about locating their new startups there.

With this Autonomy sale, we have £30 million spread across employees – should be enough to create a handful of new Angels. I’m assuming at least some of them will stay around in the Cambridge area.

Meanwhile … although I believe Mike’s been an Angel for a while already … he’ll now have more money than many VC funds. Interesting dynamic for any startups looking for the best of both worlds (VC and Angel)…

Categories
project management startup advice

What it looks like when a manager REALLY supports their team…

I’ve encountered many managers who are in love with the IDEA of supporting their team, but not the REALITY.

Typical examples:

  1. “My team are great. I push them hard and they deliver great stuff on time” (in reality: the team resents the bullying, self-aggrandizing jerk)
  2. “I’d do anything for my team. When they’re working til midnight for me, I stay late too – I even buy them pizzas!” (subtext: they’re worth $6.99 for 4 hours of overtime, and no sleep. Also: they should be grateful I even stayed around, playing minesweeper while they worked)
  3. “I like to think of myself as a sh*t-umbrella: I take the sh*t for my team from my boss” (easy to say when “sh*t” is nothing more than a few vague fears about quality; but what about when the REAL sh*t arrives; is that swishing sound you hear the sound of your manager covering their own ass? Or just of them throwing you into the path of danger, a human-shield to protect them?)

So, here’s a refreshing (if somewhat old) counter-example:

How Pixar Bosses Saved Their Employees from Layoffs

Categories
computer games games industry startup advice

Euclideon: $2m scam for fake games tech?

TL;DR – notch reckons “it’s a scam” (I wouldn’t go that far – “scam” is a strong word, I reckon they’re just too naive/ignorant/foolish/arrogant to realise what a huge mistake they’re making)

My gut feeling is: this would be a terrible investment. By comparison, the middleware companies that sell for tens of millions of dollars usually don’t seek this level of investment until AFTER they have many licenses / sales already. Euclideon seems to be asking for money BEFORE demonstrating that any games company can do anything useful with it.

In the games industry, we have a name for this particular kind of exuberant, short-sighted claim:

“Infinite Monkey Engine”

(apologies to Demis Hassabis, a nice guy who created the term “Infinite Polygon Engine” intending it to be genuine. It backfired horribly when it turned out to have little or no value in game terms; IIRC it only shipped in “Republic: The Revolution”?)

IMHO … The Euclideon folks have shown no signs (in public) of being aware of what a complete waste of time and money their technology “probably” is. They apparently haven’t (bothered to?) spoken to any games-industry companies – this should be an absolute requirement LONG before they raise funding above the $50,000 level.

Maybe they have; maybe their own PR is a big confidence-trick – they know how misleading/wrong their claims are, and they’re just trying to keep potential competitors fooled. If so, I’d say that’s a rather … short-sighted … strategy.

More likely: they’re full of their own inventiveness, and have nowhere near enough startup / business experience to have run the analysis on *why* this tech isn’t used *any more*.

(public signs so far suggest they’ve picked up an old tech, convinced themselves it’s new and novel, and don’t realise that it’s a dead-end that the industry has already rejected)