Showing posts with label background. Show all posts
Showing posts with label background. Show all posts

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

Wednesday, August 5, 2009

Garish jodericity


Arrow keys for movement, spacebar to jump. Use arrow keys while swinging to increase his spin. Hold down spacebar to make the jump last longer. Hit spacebar again when holding on to a wall to wall jump. Click on the game to start interacting with it


Yup, I've done it. It's jodersome.

You all thought I was slacking off, didn't you? You thought I was just playing loads of GTA4 and looking at internet porn. Though I did do some of those things, I actually spent a lot of my time slaving away, finding out just how awfully orange and purple clash.

So now we have a background! The level is just the same. I fixed a few ongoing bugs: the swinging is broken in my previous post for some reason, and as always, collision detection issues, of which I am sure there are many more. It's just the beginning - I want to add plenty more details, such as cracks in the walls, hanging washing, benches etc. I'm hoping these details should help indicate which way the gravity is going each time. And look cool.

Here's how the foremost part of the background looks:



Watch out, time to geekify! Though I'm talking about geeky things, I'm also trying to use something approaching layman's language. If you feel brave enough, you can try to follow. It really isn't all that difficult and I've provided lots of useful links (wikipedia).

< geekicity >

As everybody and their mum knows, flash graphics (as in, the ones you create within flash) are vector based. Flash is also happy to deal with bitmaps. Now I know you all know the relative advantages and disadvantages of vector graphics and bitmaps, but here's a reminder...

Vector graphics:

advantages: they take up very little memory, seeing as they only consist of a series of instructions on how to draw something (curves and points etc.). You could make a vector graphic that's more memory intensive than a bitmap, but that would be dumb. Also, vector graphics have no resolution, you can scale them up all you want and they're still crisp.

disadvantages: Seeing as vector graphics are being redrawn every frame (hence their crispness), this does demand a hell of a lot from the processor. Slower computers would not be able to cope with large, complex vector graphics moving and rotating all over the place.

Bitmap:

er... pretty much the opposite of vector graphics - they take up a lot of memory, but they're quick to draw.

So for the backgrounds, I didn't want them to be bitmaps because something that big would make the file unacceptably large (and slow to download). But with vector graphics older computers would have a hard time.

By the way, my computer is my benchmark. It's a two-year-old macbook (one of the first white ones). Not too shabby, but not all that amazing either, and what with macs never having dealt that well with flash, I feel it's a sensible benchmark. If your machine is slower, well, poo!

So what have I done? Well the Actionscript aficionados among you will know that the bitmapdata class has a function called draw which will take a display object as its argument and create bitmap data from that.

So for everyone I just lost in that previous paragraph, there's a way that I can take my memory-efficient vector graphics and convert them into processor-efficient bitmaps. Wonderful, no? This means I can continue adding details to the backgrounds with relatively little impact on application size and performance. This is awesome, in case you hadn't realised.

</ geekicity >

So now you can see what Dreg's world might look like. The reason I spent so long on all this was to see how long it would take to create these backgrounds, as well as have an idea what they would look like. I haven't strayed too far from the look of the comic and film. It's allowed me to establish a work-flow and make sure it was possible to do more or less what I had in mind.

So though the acrobatics still aren't finished, nor are the background details, I feel it's time to attack the next big challenge - combat. This means animation, other characters, and AI. Urgh... I expect I'll be happily spending a lot of time just drawing more objects for the background before I'm ready to face such a daunting challenge...