Gaming Your Way

May contain nuts.

Air today, gone...

Air. The future of RIA. Unless you try and actually use it.

I've been wanting to write a swf encryptor for ages and last night I finally cracked ( As I'm working on something that I really don't want decompiling for various reasons ).
It was a toss up between Zinc and Air, but I opted for AIR 'cause in theory it is the future and therefore should have better support than Zinc.

So after all the hype surrounding Air I should just be able to google around, find out how to drag and drop, save a file and some other basics. I develop in Flex rather than cs3 'cause it's a million times better, but any search for Flex and Air just brings up examples using MXML. That's not great.

Eventually I found a hacky way to create an Air project in actionscript in Flex ( It's so convoluted it's untrue. You create a Flex project as opposed to an AS one as usual, tick the Air box, but on the part where you set the document class you alter the mxml extension to .as and it works ).
Getting there. Published the main class and up popped... nothing. More searching and I found out how to set it up ( A big thanks to Toby for blogging about it, without his words I'd have given up all together ).

Cool, got a window in place now. Close it, try publishing it again, and... nothing. Lot's more searching ( And swearing ) and I found out what the problem was, and the cure. If you don't exit your app correctly ( ie call an exit() after adding a listener to the close button ) then it doesn't actually exit correctly ( I found this out myself after a lot of messing about ).
When you publish an air app it runs something called adl.exe ( Adobe Debugging something. I've had enough air googling for a life time so can't face looking it up ) which runs the swf wrapped in the air api.
If you don't call exit() then when you close the app adl.exe keeps running. Ok, that's not the end of the world. What actually is though, is that you can only run one instance of adl.exe. If it's running after you've closed your app incorrectly, then you can't run any more air apps.
The beautiful thing is, it doesn't tell you. Flex doesn't tell you either. It's like they've ganged up to keep us in the dark.

Until I figured out the whole exit() thing, I was working with task manager open closing it down every time. The only solutions I found online were, yep, work with task manager open and...

Ok it kinda makes sense, and if you've got to call exit() then you've got to call it, but c'mon, this is the future of RIA and I've got task manger open to kill it ?
It all feels very beta-ish, from the hacky way to even create an Air project in Flex to that.

Once I got past these hurdles, I must admit it wasn't that bad. The lack of docs ( I only found this after I'd gone through a lot of pain ) has made it a less pleasant exercise than it should have been ( Oh joy, another mxml example for something I want to do with code ).

One weird thing which I'm putting down to me is that when I drag and drop a swf into my sexy little app it runs the app twice. I don't mean it opens another window, it just runs through all the code twice ( In alcon I was getting,
"wtf ?"
"wtf ?"
which was a bit of a give away ). A little kludgy check cleared that up.

At present we've got a simple little app which you can drag a swf onto, it then encrypts that with blowfish via the very nice Crypto library and you can then save that back out.

Next up ( And what I've been swearing at for the past hour or so ) is the decryption routines. Well, the code is being embedded and decrypted, it's just figuring out how to then make that byteArray run as a swf rather than just sitting there annoying me.


74 hours, 33 minutes and 40 seconds

I'm currently touching wood ( tehehe ) that GMM is gold.

Guess how long it's taken ?

This is going to be a two pronged post, I'm going to both wow you with visuals and bore you with stats. Stats first I guess, here's the breakdown of how long the game took blow by blow

Attract Mode: 1hr 9mins
Bots: 13hr 33mins ( I had such a mare with these )
Class Structure: 10mins
Corn Power-Up: 5hr 20mins ( This was re-used for the other power-ups, hence it taking so long )
Display Map: 32mins
Dummy Trap: 2hr 34mins
Game Complete: 58mins
Game Over: 24mins
Golden Ball Power-Up: 49mins
Health Power-Up: 1hr 37mins
Hidden Baddie: 2hr 47mins
HUD: 1hr 38mins
Instructions: 2hr 33mins
Level Complete: 40mins
Level Design: 7hr 38mins
Level Plotter: 7hr 39mins ( What are the odds ? )
Level Structure: 1hr 22min
MiniMap Layout: 1hr 31mins
Mud Power-Up: 1hr 8mins
Pause Mode: 30mins
Player: 7hr 37mins
Points anim: 24mins
Preloader: 34mins
Score: 7mins
Sounds: 3hr 22mins
Tiles: 2h 54mins
Transition: 25mins
TrapDoors: 3hr
WaterTraps: 1hr 23mins

Now this may seem incredibly anal, perhaps to some degree it is, but when working for yourself it's important to keep track of where your time is going. It helps budget for the next game, as you'll see a pattern ( So for example a preloader won't take long, but you know the player and baddie routines will ). A lot of common sense I know, but seeing how long things actually take can be a useful eye opener.

Want to see the map for level 1 ? Go on then seeing how I promised


So from here the clients need to give it the once over, make sure I've fixed what I was meant to, tweaked where things should have been tweaked and sign this bad boy off.

K, time to work on the arkanoid game again...


The Real World of Games

Moms have tried their level best to prevent their kids from holing up in their rooms with their eyes glued to a computer screen and their hands busy at the controls of that new gaming console. But video game enthusiasts have found a way to beat this hurdle and prove to the older generation that these seemingly useless ways of passing time do have their practical uses in the real world that we inhabit.

•    Video game technology has been used with varying degrees of success to teach children with autism at the University of Victoria in British Columbia. The games are effective teaching environments because of their richness and continuous nature. Video games have also been used by researchers at the University of Edinburg and the Glasgow Caledonian University to study cognitive skills in autistic children by using software that recognizes gestures and movements and translates them to the screen. This would help bring out skills that they possess but are unable to showcase because of their inability to speak.
•    Video games are being used as tools to teach business prep programs by global accounting firm Deloitte & Touche USA to help develop their future talent pool. High school children are invited to participate in a gaming competition that will test their skills in conducting and planning events and raising virtual money. The games help them learn business, ethics, money management and decision making.

•    Virtual gaming worlds like Second Life are being used as 3D simulators to view plans and diagrams of real world drawings in three dimensions as opposed to the flat two dimensions we see on paper. The realistic drawings are used to conduct training programs and make changes to the system as well.

•    Corporate houses are saving tons of money by using Second Life as a gallery to showcase their advertisements, posters and other design materials in 3D settings to employees and clients all over the world without having to travel miles to achieve the same. There’s also the fact that this move reduces the amount of fossil fuels used up in traveling and hence is beneficial to the environment.

•    More and more surgeons are taking to video games now that there’s a study done that proves that game-playing improves the dexterity of their fingers and helps them during surgeries.

•    Moviemakers are using 3D gaming environments to simulate three dimensional models of characters in different poses and styles in record time. In a life prior to Second Life, physical models would have to be built and tested to achieve the same effect.

The future of gaming holds a lot of promise – we may be able to visit a supermarket from home, pick up things from shelves and feel them before we use an online checkout cart, all in the near future too.

This post was contributed by Kelly Kilpatrick,who writes on the subject of the top online colleges. She invites your feedback at kellykilpatrick24 at gmail dot com.

...Thursday i don't care about you...

I worked 'til gone 3am last night, and I'm beyond tired, so rather than a blog entry covering how I knocked a lot of things off the to do list for GMM and designed level 2, here's a link to a viral clip that Chris at errorWare sent me today that made me laugh.

This, in it's own bizarre way is totally safe for work.

A less tired and lazy post tomorrow, if for no other reason than I've got to use the last lyric as a title.


...Tuesday's grey and Wednesday too...

Well my days being split in two carries on.

During the day I'm working on the Arkanoid game for gimme5, evenings it's back to GMM. I can only say thank God both of these are coming to a close at roughly the same time 'cause it's so nasty working on two projects at once ( I equate it to writing two different novels at once ), not just in terms of swapping and changing ( as2 to as3 to as2 ) but the sheer number of hours a day I'm working on them.

Most of yesterday was spent on the g5 game. Myself and Ronnie the tech. lead at g5 spent hours nailing down the server side intergration for the level saving / swapping. That's nearly done, and I'm really hoping with one final push tomorrow it'll be done for good.

Between that I was adding all the speech to the game, and it works really well in place. Today was more of the same and clearing off some of the really obscure bugs. The To Do list for that is finally going down.

Last night on GMM was spent adding sounds too. Thankfully the client sent me a zip with pretty much all of them in there, and they're all pretty spot on, which is great.
It was also nice using my as2 SoundHandler class again, the one in as3 is very make shift at best, the as2 has been built up over the years and is so easy to use and does everything I want ( For example, sound.setPanDistance() calculates the mc's position in relation to the center of the screen and sets the pan accordingly ).

Pretty much a whole day doing sounds for both games then. This morning ( Before starting back on Arkanoid ) I managed to finish off the instructions for GMM. Not hard work, but lots of fiddly aligning and just boring really.

I think tonight I'm going to try and knock up a couple more levels for GMM. Only level 1 is done so far, so getting a couple more done will be good, and it's a break from actual coding. I'll be able to test it a lot whilst making sure the level plays well so the to do list will grow ( It's always the way, when a project is coming to the end you find you'll delete one thing off your list but find at least another 2 to add to it ).

I'm just going to be a bit self indulgent, not for the first time I know. I hope I'm not the only person who's wanky enough to google themselves. Well I googled "Gaming your way" and was wrapped to see we've "made" it on google.


Check us out all indexed. Ok it's only the blog, the site itself seems to be as popular as the plague, but it's just a place for us to whore ourselves in a grown up way ( "In terms of traffic it has more than met their expectations" all nice and nu-media friendly )

After that, I thought sod it, let's see what "Squize" brings up. I came second, the top entry being

"I masturbate weirdly. I squize my hips with my hand in the middle. Even with my panties on... Weird?
Anyone else does that? I'm 13..."

I ( For once ) just couldn't make it up. That's my sails deflated, 2nd to a 13 year not knowing how to frig.

I guess there will be more of the same crap, just worded differently, tomorrow.


I don't care if Mondays blue...

Back to Flash after Fridays rant.

Today was a bit of this and a bit of that.

I'm having to finish of an arkanoid clone for gimme5, a hang over from when I worked there. Improved the collisions ( Again ) and finally finished the baddies off.
Still a lot of things to do, it's becoming a long drawn out project that I can't wait to see the back of to be honest.

Back to the lot more fun GMM. I started the player shooting routines Friday and they're nearly finished after starting it up again today. Doing a game in ISO just adds that layer of complication to it, but I've got projectiles flying around quite nicely now, and in the past 30mins got it so the baddie bots know they've been hit and power-down for a couple of seconds allowing you to run past.

Right now my to do list stands at:

* Instructions
* Golden Ball - shoot / test for hitting bot
* Mud - shoot / test for hitting bot
* Bots
* Sounds
* Score
* Design levels
* Test right hand exit
* Remove traps from fore/background mcs

The Bots are nearly done, I'm just removing the final kinks with animation frames going a bit mental and stopping them just sitting on your head when they've hit you until they drain all your energy.
The two remaining power-ups ( Golden Ball / Mud ) shouldn't be too much work now the first power-up is in there and working ( It's really just the end result when a bot is hit by one which differs ).
Everything else is just bits and bobs, with the sound looking like it'll take the most time out of all that.

So it's slipped, but it's still on-track (  ie there's nothing left that fills me with fear ). In terms of actual time spent on it, 50 hours 48mins, which shows that I must spend an awful lot of the day just day dreaming instead of coding. It's something I really need to tighten up, if I was doing proper 7 hour days then we'd be looking at just starting day 6 now ( In my defence a decent chunk of the day seems to be taken up with admin stuff ).

Anyway until tomorrow that's it from me.


PS. Just as a sidenote, we've got a great guest article coming up this week, which we're really proud to be presenting here.

Banks. So you want me to just hold my ankles yeah ?

Credit crunch. Man I am ever sick of that term.

Hold my a hand a minute or two whilst we go on a brief trip back in time.

Way back wealth was gauged in precious metals, mainly gold. Coins were made out of it to make life easier. Then to make life even easier they was replaced by paper bills. A bill is simply a promissory note to be exchanged for specified goods or services. On the £10 note I've just fished out of my wallet at the top it says "Bank of England. I promise to pay the bearer on the demand the sum of ten pounds". Cash is purely symbolic, it's still easier than a big sack of gold, but at the end of the day it's still just a way to show how much gold you've got. That tenner is worth £10 worth of gold, which is known as the "Gold Standard".

Sticking with the whole gold thing, the original bankers were actually goldsmiths. They worked out that it was really unlikely that everyone who had their gold stored with them would ask for the whole lot back in one big hit, so they loaned money to people based on a percentage of the gold they had bagged up in the back office. It was a bit of a balancing act, a war could come along and everyone would want to withdraw their gold in one go ( Which would lead to a "Bank run" ) but as they were charging interest on these loans it was worth the risk.

To quote author G. Edward Griffin, "[bills] are made in such vast quantity that it must equal in amount to all the treasures of the world".

Being able to print your own money is in an easy fix. Governments soon realised that you know what, fuck it, we haven't got that much gold stored away but we can print some more notes as we're running a bit low ( The process of lending out more money than you have actual gold for is called "Fractional-reserve banking" ). The offset of this being, the more money there is, the less it's actually worth  ( So my £10 isn't actually worth £10 of gold, as the Bank of England has printed more notes than they've actually got gold to cover. They no longer adhere to the gold standard ). The process of too much money in the economy causing it's actual value to decrease is inflation ( When it's all going wrong it's just a downward spiral, as can be seen with what's going on with Zimbabwe's inflation rate ).

Let's go back to the good old Bank of England. It sets the base interest rate. This is basically the interest rate it charges banks for borrowing money from it. Currently it's 5%, so all the banks who want to borrow a couple of quid pay 5% on that. Now on the vast sums that are shifted around, 5% is still a ton of money coming back.

Ok, I want to borrow a couple of quid. I can't go to the Bank of England directly for a loan, so I'll go to my local high street bank. Now this is where it gets really beautiful, having a quick look at a loan comparison site, the best I can get is 7.8%
There's a bit of profit there.

Back again to Fractional-reserve banking. It is what it says. A bank only has to keep a fraction of the money it has in reserve. Say you've sold a kidney and have £10,000 to put in a bank. The bank only has to ensure that it holds on to a percentage ( Or Fraction ) of that £10k.
In the UK that percentage is voluntary  (According to the wikipedia link above, in 1998 it was 3.1% ).

You've gone to the bank and paid in your £10k. Looking at savings rates, if you want to be able to take your money out fairly soon then you're looking at getting around 6.5%. Now lets say the reserve rate is 10% ( As it is in the US ). The bank will have to sit on £1000 of your money, the rest it can loan out. At 7.8%.

Not only do banks get a cheaper lending rate from the Bank of England, they make money on your money. Sweet.

So who's actually making all this money ? Who owns the banks ? Well, they all do. It's like cash incest. Despite it not even looking like a direct link, they all own shares in each other.

Right hopefully I've set the scene for why banks are not the most likable institutions. I can finally get to the part that really grinds my gears.
If a bank goes belly up, the government will dive in and "rescue" it. It happened with Northern Rock and the US has just sanctioned a bail out scheme.
As a tax payer ( The driving force behind this huge rant was a really snotty phone call from the Tax man at 5 past 9 this morning. Just 'cause my form and cheque haven't got there yet doesn't mean I want to be spoken to like I'm a fucking rapist first thing in the morning, thanks ) I now own a share of Northern Rock. Or rather, my tax is paying to keep that bank afloat. As more and more banks get into trouble more and more of our tax will be spent shoring them up.
In the current climate mergers are going to be more common place ( Such as the Lloyds / HBOS merger ). The credit crunch is a bad scary thing, we're all paying more for things in shops, getting a loan or a mortgage is a lot trickier, but in two years time it'll all be forgotton. But these huge banking mergers which have actually been sanctioned by the government will still be in place, giving us as consumers less choice than before.

To recap. Banks can borrow cheaper than we can, and then lend to us for a profit. Banks pay interest on what we save with them but then lend it back to us at a profit. If we fail to repay that loan we can either be imprisoned or have our property taken. If a bank gets burnt by lending money to too many people who then default, our income tax will help keep it going, because the other side, the bank crashing, is even worse for the economy than nationalising it.
It's pretty much stacked in their favour on every level. You bounce a cheque you'll pay a £30+ fine, they screw up by taking too many risks ( ie To generate even more profit for their shareholders, the majority of which are their fellow banks ), we pay again to prop them up.

A very simple and naive summary I know, and possibly riddled with flaws. If you want to read real facts rather than my stabs in the dark I can recommend the book "The Shock Doctrine" by Naomi Klen ( Check out Amazon ) which equates the money markets to actual physical torture, and is an eye opening read.

Hang on, this has nothing to do with Flash or games. Arse.


The last day...

So today is the last day I should be working on GMM. I've got a bit of a confession to make ( Well two actually ).

The first one is that today isn't actually the real deadline. I don't know when that is, I think 4 weeks or so away. That's when the client starts emailing a lot more and things start getting slightly strained. That's when clients are still firing off "It's perfect. Can we just alter...". That's when you're sick to death of it. The deadline is when you realise you've really under quoted on this job as you're still killing yourself trying to get it done on time. It's when you regret having those couple of lazy days and when you realise that the next job isn't already in the bag yet, so you've got both a game you're pretty jaded with to finish off, you've also got to whore yourself around to make sure the following months bills are paid.

Then why have I been counting today as the deadline ? Because you need to work to the budget and not the timeline ( Where possible ). You have your day rate and you divide the budget by that, that's how many days work it is.
When I started off trying to get into the industry and was just writing games to learn my art, I always did that even then ( Although my day rate was a lot less in those days. A couple of years experience and some shiny awards bumped that up ). It stops feature creep and ensures the game is done, not 95% done but good enough to release.

Now with GMM there was very little budget. No where near enough to do what was needed. Sometimes projects are like that, and sometimes you have to take a short term hit for a longer term gain. After seeing the assets and chatting to the client I knew I wanted to do this, so the hit in my pocket wasn't an issue ( Or rather not enough of an issue ).
So I did the above budget/dayRate=days formula, and then multiplied it by 2. I thought it would be possible to still make the game everything it should be in that timescale ( 10 working days ). In effect after day 5 I was making a "loss", and every day spent on it after today ( It's day 10 already ) I would be making a loss on my cheaper rate.

It's hardly the end of the world. I still think Flash developer wages are stupidly inflated compared to real life. A loss when earning good amounts is still better than a lot of people having to dig holes in the street or change patients bedding. It's all relative.
I speak to quite a few London based freelancers who charge a lot more per day than I do. That's great if you're working on some big ass media campaign where there is a silly budget involved. Rip the arse out of it, but personally I'd rather do the odd job that doesn't make as much rather than this rigid "£xxx" per day.
GMM is going to be a good little game, and if I'd stuck rigidly to my day rate then either I wouldn't have got the job or I would have had 5 days to do it, which would have resulted in a crap game ( 3 days to make it, a day to test and debug and a day for client amends. Hardly the most time in the world to make something shine ).

I think that's one of the key reasons why there are so many piss poor adver-games out there ( Don't believe me ? Check out thefwa. Filter it to show games, and have a play. They will look great, but tell me how many you'd play more than once. Or even how many you enjoyed playing. Or even how many you admire as examples of good gameplay ).
It's mainly due to the lack of good coders, never mind good game coders. This shortage means that either designers "Who can code a little" are making very pretty but very empty games, or agencies are getting freelance coders on board who know they can charge £xxx a day and sometimes it means there's not enough budget to make a good game, just enough to cover their costs and have something come out the other end ( There are of course other factors, clients with no concept of games, designers with no concept of games etc. ).

I don't think there's anyone to blame, and I don't mean it as a blankit critisim of freelancers ( Far far from it ) I'm just trying to put into lots of words that sometimes the art should come first.

Right I mentioned at the start that I had two confessions. The second is that the game isn't done yet. In fact the to do list has hardly been dented.

The "hidden baddies" proved to be a real bitch to get working, and as soon as I post this up ( And after a smoke, obviously ) I'm back onto the baddie bots ( Pac Man ghosts ) which I spent just under 4 hours on yesterday and need at least a couple more hours today to finish off.


A [ Voxel ] trip to Mars

I had an idea last week on how to code a voxel landscape, so a couple of nights after work later, here's my little...

Trip to Mars

( No preloader, but it's only just under 400k )

Just to caveat it, it's not the quickest routine ever and may chug if you've got a slower machine, this is more looks rather than speed.

I'm really pleased with how it turned out. It uses a real image of Mars for it's height map, so it's a lot more rocky than the usual perlin noise generated maps.

That's about it really. I was going to save it up for a demo I have in mind, but I've got no time for it for the foreseeable future, and if I do re-use it as part of a bigger production I've got some ideas to improve it anyway.


And on the 8th day...

It's all got a bit blurry what's been done when. That's what happens when your diary slips, it just merges into whole big lump of vague memory.

I finished off the last entry about adding a play again button to the game complete screen. That's done, so the whole ability to play the game from start to finish and start again is in. Feeling like a proper game now.

I spent a long time adding the trap doors to the game. The traps themselves were straight forward enough, I just had a real problem getting rid of them once they were triggered. It all worked fine, you'd fall down a hole, recover, leave the screen but when you came back the trap would be there again. Glaring at you. It was just a silly mistake on my behalf, but took ages to find.

After that the water traps were pretty straight forward, they just used a lot of the same code. The only slight snag with these was the falling down splat on your face animation. It's a big bigger than normal ones and in one direction there would be a depth sorting issue with the players arm sticking out too far. A quick kludge check, and it's all good.

I also added in the preloader and a pause mode, and it's always nice to test the "Quit to menu" option and it works first time. No nasty code running in the background that I'd forgotten to kill.

After showing it to the client there was a bit of an issue about the control scheme, so a quickly knocked up controls page ( Only if you've skipped the instructions, and lets face it you will. I know I would ) was dropped in there at the start of the game.

Just out of interest ( And the fact that it looks like I've done very little for 3 days so I need to pad this post out a little with some boring filler ), below is the output from our sweet notifier app which tracks all that we do

Attract Mode: 13mins
Class Structure: 10mins
Dummy Trap: 1:22
Game Complete: 58mins
HUD: 1:10
Instructions: 51mins
Level Complete: 40mins
Level Design: 1:09
Level Plotter: 7:06
Level Structure: 45mins
Pause Mode: 30mins
Player: 5:32
Preloader: 34mins
Tiles: 1:55
Transition: 25mins
TrapDoors: 3:00
WaterTraps: 1:21

All that added up should come to 49 ( 7*7 ) hours, and if it doesn't it shows that I've been a bit lazy :)
( I know it won't even be close as the last couple of days I've been sorting out the tax man and dealing with the joys of tooth ache, so the work has had to take a bit of a back seat to those ).

This coming Wednesday is my deadline. I think it's going to be a bit tight, there's some big routines to do before then, and my to do list reads as follows:

* Instructions
* Power-ups
* Bots
* Dummys
* Hidden bad guys throwing dummys
* Sounds
* Player health
* Game Over ( After losing all health )
* Owls

( I know with no real concept of what the game is that's as vague as hell, sorry, my hands are tied as always. Power-ups are collectables which you can shoot at the Bots, who are going to be pacman ghosts. Dummy's are obstacles that are triggered by hidden traps which block your path, and that the Bots can push around. Everything else I think is clear enough, oh apart from the owls :) ).
So 3 days to do all that, fix any bugs ( I've noticed a couple with the fore-ground plotter ) and shoe horn in any ammends from the client.

This is why I can't give up smoking yet.