Monday, May 10, 2010

How much breast can I actually reveal before I chicken out?


Arrow keys: move. Space: jump. A: punch. D: Kick. Q: health boost. S: whip. R: reset level. E: interact.


Yay! How exciting! A new post!

Well I've been slaving away on various things. The point of what you see above you is to stress test the game - as I mentioned a long time ago, I wanted to make a game I can play on my little macbook, which is not an ideal computer to play flash games on by any means, and the process was a lot more difficult that I had anticipated. More on that in the geeky section below.

So you'll notice the background is back, along with a few more background objects for me to pepper the scene with. This is still the same zone as the post years and years ago where I had Dreg running around his neighbourhood, but tune in next update to see a different area for Dreg to explore.

And there's a new enemy - he's a weedy little thing that doesn't post much of a threat - he'll be an early stage enemy. I like how he runs.

At this point, I basically need to get down and just make lots of stuff. Enemies, backgrounds, and people to populate the world. See, my problem with the film I made is that the streets are deserted, but they should be full of people. But I simply didn't have the energy to model, skin and animate bystanders to fill the scenes with.

But seeing as in this game I just need to make simple sprites I've gone ahead and made a few background people. I've used the same technique as I use on the enemy characters to make each person look different, but essentially I've only made two characters - slutty girl, and manly man man. Slutty girl dresses somewhat provocatively, and is sometimes skinny, sometimes more generously proportioned. She smokes too much. Manly man man is either a gym bunny, or has something of a beer belly going on, and he suffers from a Freudian obsession with his genitals.

Anyway, I'm really happy with how it changes the mood of the place with people around. I want to make more characters - old people, aliens etc. to really give it a sense of being populated. If you want to see the many manifestations of the background characters, press R - it'll reload the level and you'll see them in different guises.

The big issue for me was performance, so if things get sluggish on your machine please let me know!

Anyway, let's get into the nitty gritty of my struggle with my macbook's computing power, shall we? Non-geeks may look away now.

< geekaliciousness >

So I started off just drawing more and more background objects to fill my scene with, and it was starting to look really cool. Unfortunately, the framerate was getting so low that the game turned more into an interactive slide show than anything else. So I had to get working on a solution.

One thing I tried was to draw the various layers to bitmaps, and though this worked to some extent, it caused a kind of awkward blurring (which you can see in the backgrounds, which are drawn to bitmap), it took up loooooaaaaads of RAM, and it made loading a new level take too much time. So I decided I simply had to simplify the foreground and keep it as vector graphics.

The whole bitmap issue made me get stressed (again) about memory leaks. I recently discovered the Activity monitor in my mac (yes, I'm a noob) which allowed me to see how much memory flash was using. It was leaking soooooo much it made me want to cry. So that was about a week's work hunting down event listeners and display lists to destroy. I eventually just wrote a function that looped through every sprite in the game and removed it (after having removed its children). This worked well, but for some weird issues that can happen where a sprite's numChildren value is updated before the children have actually been added to the displayList. It's as horrible and confusing as it sounds.

Anyway, so it was no longer leaking memory (as far as I can tell - feel free to inform me otherwise). But the framerate, though better, was still choppy. It turns out that using masks is a bad idea - they really seem to eat up resources. I realised that the biggest cause for the slow-down was the mini-map, which uses masks to only show some areas at a time. Once again, the solution was drawing to bitmap, hence its slightly blurry edges at times. The main map still uses masks, and the framerate drops on my computer when I use the map, but hey, who cares? It's just a map...

All this was worrying because I wanted those background characters that now so charmingly fill the streets of Disarea. Happily, I seem to have just about pulled it off - the framerate is acceptable on my machine, and silky smooth if I lower the flash draw quality to medium (on this machine, I have to play most flash games on lowest quality, and it still struggles, so medium quality smoothness is a feat in and of itself!).

So now I just need to draw draw draw, until I feel I have all the ingredients I need. Then I'll have to make the levels.

A new issue for concern now is that the game is already 500 K big, and I haven't even added sound or music yet. What do you think the limit should be? Games which show how big they are in the loading screen seem to be between 4 and 10 MB, which certainly seems achievable, but obviously the lower I keep it the better! The thing is that at this rate I imagine that just all the background characters, enemies and background images I'll already get to something like 3MB, then there's sound and music! Might have to ditch music all together and just go for some ambient background sound loops...