Gaming Your Way

May contain nuts.

Two of the best little words in the world

"Free bar", "Lesbian twins" and "Signed off".

All perfect phrases, but only one of them is making me smile right now.

Yesterday Souper Bowl was signed off. Sweet.

Really pleased with it actually, it's only a small little game ( But then they all are in this project ), but it plays pretty well and looks great thanks to marmotte jumping in at the 11th hour to reskin it.

At present we're looking ok-ish to hit the deadline. I'm in that fluctuating mood, where every hour it swaps between "Yes, we're actually going to make it", and "Cocking hell, we've got no chance, my to do list looks like War and peace".
The controller is looking good to go, I've got one major thing left to do for the beta delivery tomorrow, then I've got the w/end and Monday to add things like send to a friend and set up the translation handling code correctly.

Also tonight I'm going to dive in and help with the skinning up of "Holding the baby", Olli's painting game, whilst he attempts to get "High Jinx" into a fit state to wow the crowds.

Lot's and lots to do, but feeling almost do-able.


When things get ugly ...

It was a puzzle why things were always dragged kicking and screaming. No one ever seemed to want to, for example, lead them gently by the hand.

-- (Terry Pratchett, The Truth [deutsch] [English, US])

Same with some games.
I'm usually pretty solid when it comes to the code layout for a game, depending on the requirements I normally use the "best" way. Normaly. This time the thing got a bit ugly, the basic idea was quite simple, the requirements quite low all in all a short game.

The engine was done in two days, about 400 lines of code and because it all was so easy, I just dropped into an extended MovieClip class. No need for a big layout with a set of classes that divide UI, logic and so on. Normaly.

So now there is a quite cluttered class, lots of ugly code and no real time to make it readable again. Shish!

Anyway, mending the last pieces of it together now (and trying to clean up the 950 lines of code).


Don't Panic ? How wrong you were Mr.Adams

A brief update from me is long overdue.

So where are we with a week to the deadline ? Feeling like we need two weeks before the deadline.

Souper Bowl is coming along well. It's basically Tapper, but in a soup kitchen. I managed to knock the majority of the game engine out in a day which I was really pleased about, and since then it's been a case of skinning it up, fixing bugs and tweaking the gameplay.
There's one minor gameplay addition to add, and aside from the sounds / remaining visuals / love it's done. Hopefully tonight will see the end of it aside from an hour here and there, and it'll be great to get the first one down and out of the way.

Olli's game is coming along well. The core engine has been complete for a while now ( Even to the stage where he can post code :) ), but we've had issues with the gameplay. It's a pretty original concept, and for a while we thought it was nailed but just lacking visually and sonically and once those were in place it'd all come good. After a lot of chats with the client and standing back from it a bit, we've realised it wasn't there at all.
So Olli's throw a load of new ideas at it which are working really well. It's much closer to the vision I had in my head of how it would play now ( If only that vision had been clearer at the start ).

The w/end is going to be spent sourcing soundfx ( Which I do actually enjoy ) and working on the controller movie which holds everything together. At present it loads and triggers the games, handles the game over etc. but it needs a lot of work throwing at it. Just today we came up with the idea of tooltips within the games just to help people along, and the controller will have to handle these too ( As all the text is translatable, it's better to just have one movie deal with it all and saves each game having to load in their own specific xml file with the text in ).

Lot's and lot's to do. Hopefully Monday's post will be a nice gloaty one where everything is done. Not going to happen, but let me hold on to the dream for a little while.


Nerds overfocus ...

As promised way to long ago (here), I finally manged to get the brush example done.
Not the best way, not the best code, but an example nonetheless.

(just press the left mousebutton and move the mouse ...)

And the zipped fla (F8): (6,11 KB)

And for those hwo don't want to d/load the fla ... just the code. You just need this two images set for export in the first frame:
(Brush, with alpha)
(color / pattern)

import flash.display.BitmapData;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;

var bmpColor:BitmapData = BitmapData.loadBitmap("color_00.png");                // the color to paint with
var bmpWall:BitmapData = new BitmapData(480, 200, false, 0xc0c0c0);                // a bmp to paint in

var bMouseDown:Boolean = false;
var iPaint:Number = 0;    // "color on brush"

this.onEnterFrame = function ():Void {
    var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png");     // the "brush"
    var iPosX:Number = this._xmouse - (bmpAlpha.width * 0.5);
    var iPosY:Number = this._ymouse - (bmpAlpha.height * 0.5);

    if (bMouseDown) {
        // modify alpha ...
        bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, iPaint));
        bmpWall.copyPixels(bmpColor, bmpAlpha.rectangle, new Point(iPosX, iPosY), bmpAlpha, new Point(0,0), true);
        this.attachBitmap(bmpWall, 0); // show ... (not the best way, imho ...)
        // Disolve paint ...
        iPaint -= 5;
        if (iPaint <= -250) {
            iPaint = 0; // just resti t

this.onMouseDown = function ():Void {
    bMouseDown = true;

this.onMouseUp = function ():Void {
    bMouseDown = false;



BitmapData or the quick and dirty way to create a brush that runs out of paint ...

Ha! The title says it all, yet again a text only post ...

While working on the current game (the same project Squize is working on, see his last post), I needed way to be able to paint an area in a real life fashion (that is, the paint on the brush runs out just a few centimeters before the end of the wall).

I must admit, that I didn't have much play with f8's BitmapData before, I just don't needed it. Until now.

I just hate it to get into something "new" in the middle of a project, but unlike some of Flash's other new things BitmapData is fairly easy to get into. Except the part where you start to mess with matrixes. I had some great examples which showed a lot of the stuff I thought I need, but I just wasn't in the mood to dig into using matrixes for creating the desired effect.

But there is hope ...
Using 3 BitmapData objects, 2 PNGs and copyPixels with alpha ...

Part of the code:

var bmpAlpha:BitmapData = BitmapData.loadBitmap("brush_shape_and_alpha.png");
var bmpBrush:BitmapData = BitmapData.loadBitmap("paintpattern.png");
// mod alpha
// iPaintAlpha is a value from 0 (paint it) to -255 (paint nothing)
bmpAlpha.colorTransform(bmpAlpha.rectangle, new ColorTransform(1, 1, 1, 1, 0, 0, 0, this._iPaintAlpha));
this._bmpPaintArea.copyPixels(bmpBrush, bmpAlpha.rectangle,
Point(this._xmouse, this._ymouse), bmpAlpha, new Point(0,0), true);

Et viola ...

Instead of using some matrix stuff, I just "alpha" the alpha chanel mask with a ColorTransform and use this to copy the "paintpattern" into the painting area ...

I'll upload an example file once I've reached my current milestone ...


swfs. They just don't want to smell each others bums to say hello

The controller is well under development now, and over the weekend I hit the first real snag(s).

In the good old days when as1 was king, you'd create an movieclip and load your external swf into that, and then just call a function directly. Nice and easy.
In the slightly meaner days of as2 it's a bit trickier. Let's load the swf in, now where the hell is the main class that I need to get to ? Arse.

Now I'm sure there is an easy way to do it, a way I've totally missed, but this is the solution I've come up ( And it's as long winded as you like ).

I've made a CrossSWFInterface class, which the controller brings in and creates a new instance of. Now by being cunning I know that packages/ classes are placed in the _global name space when they're created. So, each loaded class just passes it's entry point singleton to the CrossSWFInterface class via _global, eg
And because the controller swf is the first one loaded, I know these methods are going to exist in _global by the time the loaded swf sends it's goodness to them.

Then by using static properites in the CSWFI class, the controller class can get all the info it needs from the loaded swf, and visa versa.

Now I'm sure there's got to be a easier, cleaner way, but it escapes me and we're badly up against the clock on this project, so it works and I'll happily admit I'm a dumb arse when someone explains how to do it correctly, but until then I'm happy with this approach.

I did mention snags at the start didn't I ? In my vain attempt to be a grown up Flash coder I use mtasc ( Which is so sexy ). The one issue with it I found this weekend was that you can only ever have one entry point to a swf ( ie, mtasc expects a class called "main" to be there, it's what it calls to run the code in the swf ). You can't change it to anything else, that's set in stone.
This is all cool normally, but I want to create seperate packages within my project file for the games themselves, but I can't have a different main class for each of them ( eg, main_game1 won't work. mtasc just wants main and nothing else will do ).



But this bad boy came to my rescue, hamtasc. Basically it's a "hacked" version of mtasc which allows you to define the entry point. Never has something so out and out geeky made me so happy.

I'm hoping tomorrow to have the controller in a useable state so I can start focusing on the game I've got to do ( "Souper Bowl". Tell me that's not genius ), so it'll load in and hand over control to the game etc.
I'm getting so close to doing something fun...


And so it begins

The project has finally been green lighted, we're off and running.

Completed the road map tonight, so all the dates for deliveries are set, which is nice 'cause we know how much time before we have to panic.

The project has grown ( They never seem to shrink do they ? ) but because of the delay in getting the concept signed off it's going to be split into 3 distinct phases for release ( It was two previously ).
It's good in many ways, it means the quality won't suffer because of trying to cram too much stuff in before the deadline ( Which is set in stone, it's got to coincide with something, and there's no moving it ), and I've done my share of episodic games, it's always proved to be a nice way to work when you're dealing with a lot of different games.

As to the code, the "controller" movie's development has already begun. Doesn't do a great deal atm, loads in a bit of xml, displays some buttons and not much else. The start of a project is always slow where you're arranging classes and spending as much time thinking as coding to ensure you don't code yourself into a corner.
One aspect of this project is that it's got to be translatable, so I've done a button class which resizes to match the text inside. No biggy, but just one of many things which need to be thought about when the text can change.

I really need to have an interesting blog entry soon, it's all very worky right now :)


Deconstruction of a scene or: nope, this is not Bryce ...

Inspired by a recent thread on fk's game forum here's a brief description how the day scene was actually built:

Usually it starts with a *very* simple sketch, whith very littly detail. Most 3d artists I know do extensive and detailed drawings, but for me it works best to directly do it in 3d.
more ugly than beautiful

Once I have this I start by modeling parts of it as single object that I later can link into the final scene, this time it's only the tower:
twh_070410_01.jpg twh_070410_10.jpg
Simple outline rendering and the textured version.

A detail of the main tower mapping:
3584x3584 px ... now tell me that size doesn't matter.

Now I start composing the scene, here just the linked tower with the landscape set up. In the foreground I've placed some noised up spheres to be used as rocks.
twh_070410_03a.jpg twh_070410_03b.jpg
Landscapes in plain grey and with some basic textures applied.

Now adding some depth:
twh_070410_13.jpg twh_070410_04.jpg
Added 2 trees for the foreground (846,419 polygons now) and finally with all the trees, grass, bushes
and textures applied (now 383,890,620 polygons).

Final step: adding real light and shadows and setting up the atmosphere ...
Preview rendering, you can see the result in the previous post ... (or click here)

After the scene was done, I decided to add two wizards to the final image so I quickly built a low poly one from this sketch (done by Chrsitof) and did two very simple texture maps:
twh_070410_07.jpg twh_070410_14.jpg
Sketch and the wizards placed in the scene.



You never can have enough rendertime ...

As promised in an earlier post here two (still working on a third one) stills from the intro of my "private" game:

Welcome to the Secret University, home to many soon to be wizards.

What now looks like a friendly night, ...

Both rendered at a resolution of 5120x2880 px (ugly to lose all this detail in those resized images, though), taking about 19h rendertime each. My plan is to use the way smaller version (my hope is to get it rendered at 480x270 (16:9) in a moderate filesize, using some 250 frames per shot (a day shot, a night shot and the secret third one)  in order to tell the story. Some earlier tests have shown that the animated clouds, the moving sun/moon and some wind moving all the grass and the leaves simply looks incredible. Yep and I know this is a bit much for a flash game - but hey - one should have dreams.

I hope I get the third shot done by Thursday this week and then start to lay out the animation.

Oh, you might noticed that this isn't quite the way it works usually (first doing a *lot* of artwork and later do the game), but this time I decided to do all the frontend stuff first and then add the game, call me stupid, will ya?
Ok, one of the reasons is that I needed to get my head away from flash while working on the code for the client's games and applications, and doing 3d is the way to keep me sane at the moment.

While typing this, I forgot to mention that the game as a name now, though this is for the next post.


ps: happy easter :)

More words

So all the design docs have been done, some more vague than others, but they're done and sent for sign off...

The client has come back with quite a hefty amount of feedback already which is going to alter how we go about developing the project, and has expended the scope of it quite a bit, which we're going to have to factor in ( Both budget and time scale wise ).

To touch on the project itself, it's a collection of mini-games which follow you as you go through life, from toddler to retirement age.

And that's about it for now. Hoping to get final sign off on the concepts soon so we can start the actual coding.

( Yeah its a boring blog entry, but projects aren't all flv clips and moving sprites, but hey whilst you're along for the ride you're going to have to take the rough with the smooth along with us ).