How to Have Good Ideas

I think about thinking a fair amount. I recon it’s valuable for a game author to have some understanding of thinking for a number of reasons. The most obvious reason is to be able to predict how players will play your games. The other big reason is to make yourself think better. I think I’m starting to see some fruit on this second point so I thought I’d write up my thoughts on it.

Thinking. Do you ever think about it? What are you thinking right now? Do you know how you read? I don’t know how I read. I also don’t know how I decide if something is funny or how I decide that I don’t like that dude in the corner drinking a Chimay. I don’t know why… he just rubs me the wrong way. This is because most of our thinking is subconscious. That’s really just a way of saying we don’t have introspective access to it. I like that phrase “don’t have introspective access to” better than “subconscious” because it’s less mysterious.

My brain reads quite well. I just can’t “watch” it read. I don’t know what strategies it’s using. You konw taht tinhg wehre you can mix up all the lteetrs in the mdidle of wrods but can siltl raed tehm? I don’t know why that’s true. I think these subconscious processes are a lot more common in day to day living than we generally believe. Advertising works, but everyone says advertising doesn’t work on them. This is because it doesn’t effect processes you have introspective access to. It still changes your behaviour because grocery-store decision making is a largely subconscious task. You think you control it a lot more than you do. Your conscious brain (mostly in the frontal cortex) might add some variables to the equation or be the final arbiter of that decision but the heavy lifting is happening behind the scenes. Did you know people with damage to the emotional center of their brain can’t make breakfast-cereal decisions? That’s because conscious thought isn’t the prime mover behind those choices.

Lets look at problem solving and creative thought. I make puzzles games and I love user testing. This means I have spent a lot of time looking over people’s shoulder as they solve problems. Often problems that require a lot of creative thought. I have spent hours upon hours engaged in this and one of the things I’ve learned is that people don’t have any idea how they are coming up with creative solutions. We don’t have introspective access to that part of the brain. I know a very bright man here in Costa Rica who makes a living having really good ideas. He’s a serial entrepreneur who has won and lost sacks of money many times in his life. His life revolves around having good ideas and he is convinced that they come from some shadowy spirit world. He is not very religious but when pressed will present good ideas as evidence for the supernatural. This also jazzes with everything you hear about authors metaphorically “channeling” their books and sculptors “just removing the excess stone around the figure hidden in the rock”. We don’t know how we do complicated things. Which makes sense.

I’m sure you’ve heard about the 5 +/- 2 rule of short term memory. The idea is that we can only store 3-7 things in our short term memory and after that we have to kick something old out to make room for the new. When you think about it this has pretty big consequences. It means any problem with more than 7 moving parts is impossible to think about consciously. Problems like this certainly include books and video games. Worse than that, creative leaps don’t seem to have anything at all to do with conscious thought. They just conjure themselves out of some crazy pattern-matching engine deeper in our brain. The lesson here is that we can’t hold a whole problem in our head and we can’t make creative leaps with the fore-brain so stop trying.

Instead, think of the fore-brain as a sort of inept cook. You can decide what goes into the pot and you can decide how much the heat is turned up but that’s about it. The hind-brain seems to be built mostly on pattern matching so fill it up with patterns. These are ideas, images, feelings, anything a human can comprehend. If you have a specific problem cast around for anything related to that idea and push it in. Then push in a bunch of stuff that’s only tangentially related. Once you get it in there turn up the heat. Really focus on that idea. Emotion is the language of the subconscious so you have to really give a shit about your problem. Agonise over the solution. Imagine failing to find one and how your game will then fail, no one will ever play it, and you’ll have to go back to making websites for law offices. Then let it simmer. My personally like to slightly distract myself. Take a walk, stare at the clouds, untangle some headphone cords. Give your brain some very light work. If you can walk around somewhere new then do that. The extra visual stimulus seems to help things percolate. Don’t mind too much if your conscious mind wanders. Aim for a pleasant thoughtlessness but if you end up trying to remember the order of all the original Mario levels that’s ok. Fighting it is going to be counter productive. Sleep seems to be a pretty productive time so have a good hard long think about your problem while you’re falling asleep as well.

I don’t really worry about down time. I’m pretty lazy so I never worry about letting “work” thoughts overtake personal time. I think this is a great advantage. Derek Yu compares our games to Head Crabs. Things that control us utterly. I think that’s why we’re successful. We live our problems in a way less invested professionals don’t. Our stew is always simmering and when it’s finally ready it will be filled with flavors the world has never tasted and they will love it. Even if we have no idea how we did it.

Splitting your Attention between Malta and Hydorah

I want to talk about Attention Splitting and Hydorah and Malta and Clutter. But I can’t pay attention to that many things at once! Inevitably I’ll fail to give one enough time and I’ll have to try again later hoping I’ve learned from my mistakes. Such is the essence of Attention Splitting and the essence of Hydorah. Hydorah is a shooter written by Locomalito with tightly-knit music by Gryzor87. I played Hydorah last winter when we were exploring the festivals and medieval cities of Malta.

In Malta I was working on a game called Clutter (which I shelved in Honduras months later). We lived in Rabat, just outside the medieval walled city of Mdina. I used to walk the silent streets of Mdina in the mornings to think out game design problems. Malta had a lot to offer; fireworks, good wine, ancient forts and festivals but it was hot and hard to get around without a car so we ended up at home gettin’ work done a lot of the time. Well, I was gettin’ work done until Hydorah came along. It’s a great retro-hard game and I played it through to 100% completion. A big part of why Hydorah works is Attention Splitting. Not so much in splitting my attention away from work but in splitting my attention between dodging bullets and shooting targets.

In Hydorah there are guys who fly at you from the right, shoot some bullets at you, and then fly off to the left. There is variation in bullets and flight patterns but mostly that’s how Hydorah and all shooters work. So why is such a simple formula so successful? Well, like other successful games, it lets you practice something your brain likes to practice. In this case it’s paying attention to more than one thing at the same time.

In Hydorah you have to watch for and aim at enemies but you also have to dodge bullets coming at you. You have to pay attention to these two major catagories as well as several individual items in those categories. I talk about how this challenges the visual centre of the brain in Of Rods, Cones, Meat and Monnaco. Only a small part of your eye is capable of seeing much detail (called the fovea). To keep track of so many important things you have to constantly scan back and forth between them while attempting to store their positions and velocities in your head. The better you are at storing predicting, and updating the state of the game the better you are at Hydorah. This also makes you better at a lot of other things like Starcraft, Rails Shooters, playing hockey, being a fighter pilot, lots of stuff. Attention Splitting is so critical to Starcraft play that Attention is called the “third resource” and gosu players attempt to steal attention from their opponents with raids and harassment.

Since Attention Splitting is so useful to so many activities it’s not surprising that your brain wants to practice it all the time. And since your brain wants to practice it all the time it’s not surprising that it’s so fun. Like traveling, video games are fun because you are learning. In Malta we learned what that a medieval festival with cloth banners and gilt relics parading the streets behind a brass-band can be just as amazing as a parade filled with floats and lights. In Hydorah you learn to take it all in and not lose track.

Rebuild 2: Starting the Sequel

Rebuild on Kongregate
#3 on Kongregate with 2,000,000 plays!

My game Rebuild was more successful than my highest hopes. It’s nearing 2 million plays just on Kongregate alone, and is still the #3 game in their rankings. So there’s no doubt I’ll do a sequel and it’s about time I got started!

I’ve gotten heaps of suggestions by email, pm, and in the forums at TwoTowers, Kongregate and Newgrounds. I’ve been collecting these and trying to get a feel for how people are playing the game.

I noticed something interesting: many people play to completion, trying to get all four endings in one game, preferrably on the same turn. This is not at all how I play; I just want to get to an equilibrium where I’m not in constant danger of being wiped out, usually around turn 75. Mopping up the remaining 2/3 of the map isn’t interesting to me, so I didn’t make a lot of content for the lategame. This is how I imagined a game going:

  • Turns 1 – 24: worry about food
  • Turns 25 – 44: worry about zombies
  • Turns 45 – 74: worry about happiness
  • Turn 75: either you’ve stabilized and won, or you’re dead and don’t know it yet

These numbers are hardcoded: zombie mobs first arrive on day 25, and on day 45 the zombie spawning caps out and new happiness-related events start happening. But people are playing until turn 250 and conquering all 100+ squares. So, my first priority for the sequel is to take this play style into account and make sure the game stays interesting for longer, especially on easy difficulties. There will be many more random events, and branching storyline events where you have to answer yes or no questions which influence future events. Maybe even factions you can effect, or special named npcs that join the fort if you meet certain conditions.

I was also super pleased to see people swapping stories of their survivors; the funniest names or most eyes lost (I saw 9) and the random stuff that happened to them. So my second goal is to make survivors more customizable and unique, with equipment and skills and levelling. Varying skin and hair color and yes, there will be things to lose other than eyes.

Zombie Attack Art
How not to do art: don't draw things for 20px high then stretch them to 150px

The biggest complaint was the art (though some people liked it’s simplicity), followed by the fact that the zombie attacks weren’t interactive. The art will get some attention (hopefully with help from someone else), specifically the animations which I admit are totally pathetic. No promises, but I also want to replace the attack animation with a minigame that changes your odds by +/- 10%. Skippable of course, and hopefully more interesting than your usual point and click shooter.

So those are the big 3 (more lategame content, more unique survivors, better zombie attacks), but of course there will be new buildings and effects, improved art all around and I’m going to address some stuff that drives everybody (including me) crazy about Rebuild, like:

  • All the clicking involved in sending 10 guys on a mission in the lategame
  • Having to move people on and off guard duty all the time
  • Squares filling up with zombies the turn after you clear them
  • 20 zombies spawning every turn in the last couple squares on the map
  • Losing a single 3% danger fight in Harder or Nightmare can ruin you

Of course there are a lot of suggestions that won’t make it in, like I’m not going to attempt multiplayer or add an XCom-style tactical battle system (I wish, that would be awesome!). I’m already starting a list of ideas for Rebuild 3 – hah, we’ll see!

Rebuild 2 Title
The new look may be for you to decide!

I’m looking for a vector artist to help me out this time, so if you’re interested in working on Rebuild 2, drop me a line with your portfolio.

There are a lot of other little things that may or may not make the cut, and the possibility of versions for iPhone and other platforms. But I’m just getting started, so there’s still time to send me your suggestions!

Word Up Dog: Creating Android apps with Adobe Air

A screenshot of Word Up Dog the game
Word Up Dog: represent, yo!

Having already optimized my game Word Up Dog so that it runs relatively well in a browser on an Android phone, I was ready to package it up as an installable app. Adobe Air makes this easy to do with few changes to your original code. Adobe has a Flash CS5 plugin to do it, but I prefer to do things the free-and-open way when I can, so here’s how I built the Android app using only FlashDevelop and other free Windows tools.

First, I don’t recommend the Android emulator. I struggled with getting emulator-compatible versions of the Air packager and Air runtimes installed. There didn’t seem to be much advantage so use a phone if you can get your hands on one.

I followed several tutorials and honed the process down to this:

  1. Download the Air 2.5 SDK, paste it into a copy of your Flex SDK directory, and set FlashDevelop to compile using the result
  2. Start a new FlashDevelop AIR AS3 project
  3. AddChild your existing game in Main.as
  4. Add NativeApplication handlers to prevent the phone from idling
  5. Add android-specific settings to application.xml (here, have mine)
  6. Generate a certificate using
    adt -certificate -cn WordUpDog 1024-RSA certificate.pfx yourpass
  7. Build your air project to create WordUpDog.swf
  8. Package the swf into an apk file with
    adt -package -target apk -storetype pkcs12 -keystore certificate.pfx -storepass yourpass WordUpDog.apk application.xml -C . WordUpDog.swf iconsFolder
  9. Upload WordUpDog.apk to your phone and baby, you’ve got a stew going
Word Up Dog on a Nexus One
Victory - the Air for Android app is installed!

I was prompted to install the Air interpreter the first time I ran the game on my Nexus One, then it behaved just like any other app. The performance was about the same as running the SWF through the phone’s browser, but of course there are advantages to being installed. I could force the game to stay in landscape perspective and add a customized handler to deal with incoming phone calls. Not to mention being able to upload and sell it on the Android app store!

Next I’ll tackle Air on the iPhone.

Word Up Dog: Flash optimization for mobile platforms

Word Up Dog Splash Screen
Word Up Dog: Yo Diggety.

I just put my new game Word Up Dog up for bidding on FlashGameLicense. It’s very different from my first game Rebuild (I needed a break from zombies!). In Word Up Dog, you play a dog digging underground for letters to anagram, aided by cute animals who speak in 90’s hiphop lingo. It has a simple interface and can be played in short sessions, so it’s a good fit for mobile platforms like the iPhone, iPad and Android phones.

When uploading a game to FlashGameLicense, one of the options is a “Mobile-ready” checkbox. Here’s what I did to make Word Up Dog mobile ready…

I have a Nexus One Android phone, which unlike the iPhone can run Flash in its browser. So as a first test I pointed it at the totally unoptimized game swf. I was pleased to see the game load quickly and error-free, and the graphics looked good on the bright little screen. The SimpleButtons were easy to hit and the mouse over state even showed briefly. Movement using both the trackball (which fires up/right/down/left KeyboardEvents) and touch worked correctly. But the framerate was crappy, and touching even a blank area on the screen brought the game to a crawl.

First, I looked at how I was rendering the map, a 800×550 sprite containing ~150 vector shape tiles. The tiles had cacheAsBitmap=true which had a noticeable effect on my pc, but it was hard to tell if it was doing anything on Android. Instead I manually drew each of the tiles to a Bitmap, which improved the framerate significantly. Drawing all the tiles onto one huge 800×550 bitmap was even better, but the way my tiles overlap made updating (by blitting) difficult.

I improved the movement speed by jumping the screen from square to square instead of smoothly scrolling it. I downgraded the target fps from 30 to 24, and simplified the gui animations so that instead of fading in, notice text pops into existance. I replaced contrast, emboss and drop shadow filters with graphical approximations. I cached the dog’s shape tween animations as Bitmaps using TouchMyPixel’s AnimationCache. Each of these things had a small but helpful effect on the framerate.

Now to tackle the touch issue. Holding down on any part of the screen lowered the framerate by 10fps, even after stripping out all MouseEvents. I couldn’t recreate it on pc (even via air at 250fps) or see evidence of it in a profiler. My guess is that Flash just isn’t very efficient at dealing with touch screens. What finally improved things was setting mouseEnabled=false and/or mouseChildren=false to everything in the game that isn’t meant to be clicked. This seems to be especially important for TextFields.

Flash Preload Profiler
Tracking memory with the Flash Preload Profiler

Finally, memory. The free FlashPreloadProfiler told me I was using 50mb, and showed the number of instances of each class and time in functions. Adobe’s Flash Builder Pro profiler gave me additional info including function stacks and the momeory used by each class.

I got my memory down to 20mb by instantiating some map-related things when they came into view rather than at game start. I verified that I didn’t have any memory leaks such as objects or handlers left around after exiting to menu and starting a new game.

To recap my optimizations:

  • Draw shapes to Bitmaps instead of relying on cacheAsBitmap
  • Simplify gui animations
  • Cache character animations as Bitmaps
  • Remove filters
  • Set mouseEnabled=false and/or mouseChildren=false on non-clickables
  • Other best practices I follow include cutting down on EnterFrame events, avoiding masks, and using strongly-typed variables.

I can now run Word Up Dog on my phone through Chrome at 20-24 fps! Not perfect and it will be slower on older phones, but I’m calling it a success. In my next post I’ll talk about packaging the game up using Air so I can sell it in the Android and iPhone app stores.