Monday, August 30, 2010

Dreg's triumphant return (I hope)

Arrow keys: move. Space: jump. A: punch. D: Kick. E: interact.

Hello again! Miss me?

Yeah, I definitely had a bit of break... then I got working, like seriously. I didn't update for a while cause I was fed up with all these little updates about small additions to the game. I want to make the damn game already!

So what you have above you is the beginning of the Dregs of War! It's still a little clunky- the foreground is minimal, and I haven't added a lot of details. But you still get the general idea. Then again, I won't be adding many more details to it, because the previous post is too complex for my struggling little computer to keep up. Seeing as I declared that the game should be able to run on my machine, I'm going to have to make some sacrifices as far as graphics go. The main reason for slow down is the mini map, but it's so easy to get lost in this game that the map is pretty much essential.

Here are the new bits:

- the map is faster now, and you can add your own little flag on it to look for. When you're give objectives, they show up on the map too.
- When you die, the game puts you back at the beginning of the current neighbourhood.
- I have my excuse for cutscenes, where the camera will focus on different characters / areas and sometimes a simple animation will play.
- the game has states which are triggered by the player's actions. The main example you see here is the fact that people say different things to you after you've performed certain actions.

Lots of other things have been tweaked, but generally I can see this game coming together. I reckon that what you can play above is about a fifth, or maybe a quarter of the whole game. It takes a while, and let's face it, I am only making a flash game. My next project is definitely going to be smaller in scope!

In any case, now it's becoming less and less about programming, and more and more about designing. I need to make the next few levels, complete with cut-scenes, backgrounds, sounds and (urgh!) new enemies! Fun fun fun!

As for programming, I still need to sort out saving, and I want to make a sort of quick travel feature players unlock as they explore the world (to avoid boring treks through bits you've already seen)

Unfortunately I have some paid programming work to do, which will further slow this whole project down. Do you remember last year that I declared I would finish the game before last Christmas? Hahahahaha! I'll be lucky if I can make it for the following Christmas!

Anyway, as always, please point out improvements the game needs, and any bugs you discover. Wahey!

Here, have an image of a new part of the world, The Big Drink:

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

Monday, April 5, 2010

And a warm welcome to our newest member!

Press Q to use the health dispenser. Arrow keys for movement and crouching, 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. A is for punch and D for kick. Press S to hold a grenade, the release S to throw it (be careful - hold it too much and you'll blow up!

Meet Crog!

Aaaaw! So cute!

Crog is a fast, nasty little animal that pounces at you and chews your knees off. If you encounter a bunch of crogs, they're likely to flank you and cause all kinds of damage.

Crogs come in all combinations of eye-watering colours that clash so much it makes my teeth feel tingly.

The best way to kill a crog is to be quicker than it is - they don't have much health, and though they can block a few blows, they're most likely to take damage.

The hardest thing about crogs is that I've never done a four-legged run-cycle. This was the best I could come up with. I'm happy with it, though obviously it could be a hell of a lot better.

Yes, it's a bit dodgy, but when he's running around biting your bum off you won't notice

Crogs will probably appear mid-way through the game, because they can be tricky. But once you get the hang of them they're not too tough (just big puppies really).

To help you get better acquainted with crogs, I've given you extra health, and a fully-upgraded health dispenser (press Q to use it). You can buy extra doses for it at the shop.

Next for me is to make a weaker enemy that'll appear at the beginning of the game. I hope I'll get this one done quicker than crog. But I enjoyed making crog.

Crog crog.

Wednesday, March 24, 2010

More stuff to buy!

Press Q to use the health dispenser (once you've bought it!). Arrow keys for movement and crouching, 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. A is for punch and D for kick. Press S to hold a grenade, the release S to throw it (be careful - hold it too much and you'll blow up!


I know! After four months of nothing Dreg is a hive of activity once more!

Actually, this update is not such a huge advance - mainly it's tweaks to the shop and combat and a new object to purchase...

The thing is, I just want to say thanks to everybody who has given me advice and criticism - it's all been so helpful. For this particular post, you'll see I've dealt with the comments by Todorus from the previous post (thanks todorus!). As for the difficulty, you start now with more health and money that should hopefully help the beginners among my fans (the new object should help too - more on that later).

Also, on the NewGrounds forum (in which most the posts are mine!), some guy called AdmittingZero wrote the following:

I don't understand how to buy anything in the shop or make him shut up.

Also I can just keep beating on the guys (when they're all standing on top of eachother), my punches hit all of them and none of them have a chance to fight back. The fighting needs to be a little bit more complex.

Ouch - he doesn't like snotty sam, and the combat, which I spent so long working on, isn't any good!

But the thing is, I went and tried what he was talking about, and he was right - you could just spam the A button over and over, and you'd eventually kill the thugs. It would take a long time, but it worked, because they could never hit back!

See, I'd originally thought that by having them block if you do the same move too often, players would be encouraged to vary their fighting. But that wasn't enough!

So now what I've done is that whenever a Thug blocks, there's a chance he'll do a quick counter. That way, if you keep spamming the same move you'll just get punched in the face. Haha!

It's also led to the nice emergent behaviour of apparent arguments between Thugs. If you've got two thugs in front of you and you kick, you tend to hit both. Now imagine both of them block. Then imagine that the one behind the first one does the quick counter, but just ends up hitting the one in front of him. Then the front one blocks and counters too, and it looks like they're just pissing each other off. It's hilarious and I love it. Wheeeee!

Anyway, it all goes to show the value of getting criticism.

Other changes include constantly visible instructions for the shop, and keeping health visible as you make your purchases - this is particularly important now with the addition of the Health dispenser! Yay, a new object!

Press Q to use the Health Dispenser, and it will replenish some of your health. You can upgrade the health dispenser both in the number of doses it can carry, and the amount of health it replenishes with each dose. To get the upgrades you need to leave the shop then enter again.

I went through a similar process in the design of the health dispenser as I had with Snotty Sam and the Holotec armour - the final version is much simpler (and better) than what I started out with.

I'm still not happy with the holotec armour but I really can't be bothered anymore!

Obviously, in the actual game there will be no shop like Snotty Sam's - different upgrades to armour and equipment will be found in different shops that the player will have to find.

Anyway, I'm ever closer to actually starting the game. There are still several tasks I need to deal with:

- More enemies! Argh! That'll be a fair amount of work, but I have to do it. That'll probably be my next task, to be honest - no point designing levels if I can't populate them.

- Getting lots of artwork done: I want to have a whole bunch of buildings, objects, and people to litter the world with to make it feel lived in, but also to make the background design faster (in the background I did a long time ago, I just drew each house individually, but that took too much time - I could still do that for some buildings, but it's best just to have a bunch of building blocks I can stick into the level)

- Figuring out scene-specifics like cut-scenes and boss battles

- Sorting out the ability to save. I've already got quite a lot of ideas how to do this and I think I'll be able to get it sorted pretty quickly, with small save files.

And I guess I also need to think about all the sound effects.

It still feels like there's a lot of work to do, but at the same time the light at the end is definitely getting bigger.


Monday, March 22, 2010

Money talks

Arrow keys for movement and crouching, 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. A is for punch and D for kick. Press S to hold a grenade, the release S to throw it (be careful - hold it too much and you'll blow up!

It’s a big update today!

Thing is, I don’t think anybody reads this actual blog post anymore (apart form you, Xenelement, thanks!) so I’m going to take this opportunity just to waffle on for ages, stream-of-consciousness style.

Oh and don’t worry – I removed the sounds because it was taking up too much time to test the movie. Can anybody explain how to compress MP3s to be directly used in Flash? No matter what I do, it wants to convert them as it compiles, apart from one mp3 which I downloaded from a site and which allows flash to “use imported MP3 settings”. How can I other MP3s that also get to use their own imported settings?

This was another one of those updates that saw disparate parts of the project coming together. I imagine you’ve noticed that there’s now a shop, and money to be earned! How do you earn it? You beat it out of your enemies, that’s how.

Everything is extra cheap at the shop so that you can buy stuff!

Now some of you might not have realised that there is a bigger map than the mini-map. Press M to access it. Do you remember that post oh-so-long ago where I first introduced the map? Yeah, it was horrendously ugly.

A couple of posts ago I updated it to have a lot of it drawn automatically for me, so that I don’t have to worry about drawing a map as well as designing a level. But it was still ugly.

The mini map is what did it for me – I decided to make the mini-map’s big brother share the same aesthetic, and here it is in all its glory:

I know it says “press s to set flag”, but ignore that for now, please!

This was plagued by a common problem I have while working on this project – wasting time on stupid nonsense. Specifically I wasted time on:

- making the screen to the right show the correct values for x and y (they are in metres by the way)

- adding rotation (what on Earth could be the point?). That took me ages to get right.

I also worked a pretty long time on the shop. It makes sense, though – I imagine in the future (and there will be plenty more games in the future) it’ll be useful for me to have a shop, and what with the flexibility of object orientated programming, a lot of what I’m doing now can be re-used again in the future.

With the shop, the biggest obstacles were actually graphic-design related, as opposed to programming. The two main issues were the holotec armour suit and Snotty Sam.

I started with the holotec armour, a blatant rip-off of the sort of energy field armour in the tremendously fantastic Mass Effect 2 (I don’t think you could actually see the energy armour in the first installment, which was also wonderful).

So I happily drew highly intricate, shiny energy armour for Dreg, which looked great, but when I loaded up the game, it was all so small that is was just a nasty mess (to be honest, it’s still a bit of a nasty mess, but whatever, I have to make this damn game!).

By the way – the armour does actually work – if you’ve got all of the holotec armour you’ll receive only 55% of the damage dealt to you…

Anyway, I quickly discovered that to make something visually appealing, I had to make it big, fun and simple. Hence the huge shoulder-pads and silly helmet. Now the armour adds to dreg’s silhouette considerably, in a way it has to, so as to compensate for its transparency. Then came drawing the shop, and giving it a salesman.

The thing is, Snotty Sam has been a character in Disarea for aaaages (when I was 18 I wrote a crappy sci-fi book set in the world – I write more about this in my ancient university-era site, which also has the comic).

The thing is, I’d always known Snotty Sam was an amalgamation of alien bits and bobs, due to an unpleasant experience in the badlands (he hints at this if you let him chat with you in the shop).

This was fine in the book, because that was all I needed to do – write that he’d been patched up with alien pieces, and that was it. Having to draw the bugger, on the other hand, posed a whole other problem.

The thing is, I’d never taken the time to properly visualise what Snotty Sam looked like, and I tried to draw him anyway. The stupid thing is, I already knew that this was a stupid idea (again, I wrote about this five years ago!), but I had so many things I needed to do in the game that I wanted to rush it. Obviously, this only meant more time-wasting.

So finally I gathered up the self-discipline to figure out what I wanted him to look like. Then Suddenly it was there, and here he is!

Again, simple, big silhouette, minimal alien modifications but a drastic change from his original form – though in the book it was fine to have him be a complex, amorphic mass of alien organs, it just doesn’t work visually (at least, not within my limited abilities!)

I went through a similar process with the currency – should I use coins? Symbols? AAARGH! Then I thought I’d just rip off Zelda. That was a solution I was happy with. Tell me what you think!

Friday, March 12, 2010

Minimaps, hidden areas and stupid armour

Arrow keys for movement and crouching, 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. A is for punch and D for kick. Press S to hold a grenade, the release S to throw it (be careful - hold it too much and you'll blow up!

Wahey! Look! A mini-map! It is excellent.

Anyway, this is an update of pleasant surprises, in the form of small touches that make a big difference (to me, anyway!)

So I was working on getting an easy system to have parts of the background seem to be in front of Dreg - this is important for things like when he's hanging off of corners (so that the lower part of his body is hidden by the floor... urgh, can't explain!!!)

I wanted to do this to allow Dreg to pass through windows (he is in front of the wall most of the time, but as he walks through a window, the part of the wall between the window frame and the foreground needs to be in front of Dreg. Again, can't explain. My Brain!)

Anyway, I suddenly realised that the same mechanic I use to have the grenade explosion reveal a part of the level could also be used to reveal hidden areas Dreg accesses. As you go through the window (in the part of the level to the left) the room is revealed as you enter it. The nice thing about this is that it was done entirely through my "level editor" - no additional coding was needed. That was nice.

The other nice surprise was how cool I find the simple addition of a gradient to the mini-map to give it volume. Observe:



See? Now it looks like a compass or something! You might think it sucks, but I think it's wonderful, and so simple!

Then there's the armour. Again, you probably think it looks stupid, but I'm totally ok with that. In fact, I want to go further with the stupidness - I think I'll have three different suits of armour, and you obtain them part by part (helmet, torso, arms and legs), either by buying or finding them. Each part will increase your armour score, so it always makes sense to have the best version of each part equipped. My hope is that you'll end up with a horribly matched Dreg, which at the very least will make me laugh. Yipeeee!

Next up, shops, money, and the other suits of armour.

Tuesday, March 9, 2010

Happiness is a procedurally generated explosion

Arrow keys for movement and crouching, 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. A is for punch and D for kick. Press S to hold a grenade, the release S to throw it (be careful - hold it too much and you'll blow up!

Dreg goes Boom now!

Well, sort of - he throws grenades! To make it work, hold S start holding a grenade, then release S to throw it (I did it this way so that you can hold a grenade and wait until just before it explodes to throw it at an unsuspecting enemy who won't have time to run away). Or you could simply not release S then get blown up. As you wish.

This was a big ol' undertaking! It required a bit of work everywhere - I needed to make the grenades respond to the gravity shifts, and seeing as I'd been a bit stupid this meant fiddling around with things that I'd done badly, but hey, I'm used to that by now.

So yeah, it meant working on collision and physics for the grenade, on computer AI to make the thugs run away, on graphics for the explosions, on level set-up to have walls that can be blown away and on player input.

To give the player a decent amount of control over how Dreg throws grenades, I decided to have the arrow keys dictate a fair amount of how the grenade is thrown, as well as Dreg's movement at the time of the throw. Notice that if you throw the grenade while Dreg is crouched, he'll just drop it in front of him.

It also caused unexpected headaches, more on which later!

Anyway, I now have all the major items for Dreg to find within the game. By major item I mean those things that allow him to access new areas. At the beginning of the game, Dreg will have no objects and will only be able to wall jump once at a time. As he progresses he'll get these (probably in this order):

- triple wall jump
- whip (can latch on to poles and damage enemies - can be upgraded)
- double jump
- grenades (deadly against enemies, and smash through weak walls to reveal new areas)

If the list seems a little small, bare in mind this is only the beginning - I think I mentioned in an earlier post that I want to make a couple of "chapters" for Dreg. This is nice because it justifies all this work on the game engine (if more than one game will come of it), and it allows me to make the aims for the first game more realistic. In later games I can have additions like guns, grappling hooks, instant transportation devices etc.

Also, there'll be other items to get, such as better armor and offensive stuff (but focusing on unarmed combat). There'll also be stuff like the ability to have unlimited wall jump, but it won't be vital to complete the game.

It all feels so close now! we might see this game completed yet!

Anyway, if you're interested in the nitty-gritty of the grenade-a-thon of last week, read on!

< geekanisation >

So the reason I had to do a lot of fiddling is that I had foolishly focused on the Character class (Dreg and the thugs are extended from Character) when a lot of the functionality (such as collision detection and resolution) should have been in the parent class, MovingObject. Grenades, obviously, are moving objects, but not characters. So that was boring

But the really weird problem was the issue I had with having Dreg hold the grenade in his hand before throwing it. I thought this would be necessary to give the player control over when the grenade blows up after being thrown, but the issue was that I wanted the grenade visible before it got thrown.

I obviously didn't want to animate a run, jump, skid etc. cycle for Dreg with him holding a grenade, so I thought I could simply add an image of a grenade to Dreg's hand and be done with it.

The issue is that Dreg and his various components are scaled to different degrees, and the grenade would fiendishly change shape depending on what animation loop Dreg was in. I had a problem: I needed to have the grenade appear behind his hand, at the same position and rotation as the hand, but maintaining the grenade's original scale.

The solution involved a hell of a lot more involvement with transformation matrices than I would ever have liked to experience. That said, I feel super smart now.

Easiest of all, surprisingly enough, were the explosions. I had a clear idea of what I wanted, and it worked pretty quickly!

The most annoying part was making the map screen aware of walls being blasted away. It was all very hacky. At least it seems to work now!

< geekanisation />

Sunday, February 28, 2010

On health and maps

Arrow keys for movement and crouching, 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. A is for punch and D for kick.


Doubtless you all missed me - I was working on another project for a while, but now I'm backing with ever increasing vim!

Anyway, I've made a couple of changes that should hopefully make things easier when I finally get round to actually making the game (yeah, as if that's ever going to happen!). I decided I didn't want to have to draw a map for every level, so instead I've made a system which will automatically create a map from the level elements that I draw. So that's cool, innit?

Anyway, press M to see the map. The right hand space will be for giving extra information about places of interest.

Also, health! Yeah, I decided to be inspired (steal from) Oni for learning how much health an enemy has - each time you hit an enemy a sort of coloured circle appears. The colour of the circle indicates how much health the enemy has left. I tried giving the enemies health bars but it looked horrible. You might think this system looks horrible too, but wotcha gonna do about it? It's my game and I decide, ok?

Also, I've decided to build upon (rip off) Zelda for Dreg's health - little red circles in the top right (ok, in Zelda they're hearts, but still, very similar). Just like Zelda, you'll find objects that increase your maximum health hidden around the levels. In the sample above, you have one that increases your health by a whole circle, but in the actual game it'll probably only be a quarter of a circle at a time.

Finally, all of the enemies will drop some health every time you kill them. Try letting them get you close to death, then kill them to get your health back, there's a little colour thing going on when you're a third of your health down which draws from (copies) what we see in most FPSs nowadays.

Anyway, thanks for those of you who can still be bother to humour me - I know this is taking too bloody long!

Tuesday, January 12, 2010

Dreg wishes you a noisy 2010

Arrow keys for movement and crouching, 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. A is for punch and D for kick. ENTER to interact with buttons and things. S to use objects.

It's a new year! And my Christmas deadline is looking more and more ridiculous!

It's not through want of trying, at least this time, it's mostly through want of skill, but I'm working on that, and soon I shall be an uber-programmer!

This latest update is a case in point - I had an idea of how I wanted to deal with music, but thought it might not work, then I had an even better idea, but had no idea how to do it, then went through the horrendously difficult struggle to understand the tools to make the idea work, a process which took me a few weeks, then the idea worked, but was too slow, so I went back to the original idea, which I set up in about 20 minutes. Hooray!

Though it's never really time lost. Very often I've had a problem that I've tried to solve with the wrong tool (a tool I don't understand) then I fruitlessly toil away trying to fit a square peg in a round hole (or is it the other way round?) until I give up and do it the right way. I feel like I've wasted loads of time, but then a few weeks down the line I come across another problem which requires the tool that I'd so uselessly mucked around with earlier, and the problem is solved effortlessly. So now, thanks to my initial silliness, I can add a few more strings to my hat, and feathers to my bow, and birds to my stone, or whatever the damn expression is (on a side note: since moving to Spain my already tenuous grasp of English idioms is rapidly failing).

Anyway, as you can probably hear (and wish you couldn't), the game now has crappy music, and a couple of crappy sound effects. I need to figure out the best way to record sounds, and make decent music. I'll have another shot at it later. Also, I've only added noises for his footsteps (banging my shoes together - doesn't sound anything like footsteps... *sigh*) and jumps (me grunting embarrassingly into the microphone).

The point so far is to figure out how I'm going to integrate all these things, and I'm relatively happy about that. The next bit gets technical, so casual readers can stop here. Have any of you found all 10 pointless collectibles yet?

< geekology >

So my problem was to keep the size down. A two minute mp3 could add a huge amount to the size of my .swf, unless I made the quality really crappy. So I decided my approach would be to just add the individual instrument and drum loops to the game, then stitch them together within the game. This way I kept the music load to about 700 K, which is still twice as much as the rest of the game put together.

Then the problem became synchronisation. It still is a problem, and you'll sometimes here the music not quite loop properly. It sucks, but the solution I found for it made things worse. But I'm quite proud of it nonetheless.

What I wanted to do was extract the sound data for each loop, then create a new sound file with all the others combined into it. It turned out to be more complicated than I had anticipated, but after the afore-mentioned head-banging, I got it all to work! I felt very proud!

The problem was that stitching the loops together took a lot of processing power, and the game would pause for ages before starting as it worked. I tried all sorts of optimisation techniques but to no avail, so in the end I just went with a sound channel that played each loop when required (but this occasionally leads to the pauses between loops).

Maybe I'll have another go one day and see if I can make the sound combination method worthwhile...

Anyway, enough! I must have lunch!

</ geekology >