Gaming Your Way

May contain nuts.

Heroes and villains ...

... Just see what youve done

The last game of the GOL collection and my 3rd (while Squize is still missing one :) ).

Anyway, this time your task is the joy of gardenening. With movement based on Asteroids you just have to chop down as much grass as possible in the (short) given time. Earn some extra by making sure those nasty little buggers stay off the lawn.

As Squize already mentioned this game has the weakest name ("The Day of the Triffids") but may be the one with the most action.

gol_dot_00.jpg

 

gol_dot_01.jpg


Nothing much more to say, we just have to wait for them to go online now ...

nGFX

ps: and now ... if can tell me the artists of the three songs I've quoted ... you can win ... well I'll find something.

I want to fly like an eagle ...

... Let my spirit carry me.

So this is the third game (yes, I know, there are currently only two (including this one), but it seems that Squize didn't post yesterday ... shish!)

You surely remember the time when you just walked up the diving platform, stood on the highest one and did a somersault, backwards ...
... and you surely noticed that each year you thought about "what can go wrong" a bit more.

Well, after a certain point you forget about the risks and you go hang gliding, High Jinx in our case or short HJ.

gol_hj_00.jpg

gol_hj_01.jpg

Distance is the key to get your blood flowing again, and of course you have to do some resource management to get as far as possible.

After all I enoyed doing HJ, hope you enjoy plaing it.

2 games left ...

nGFX

I see a red door ...

 ... and it want it painted black.

Nah. painting is pure joy. Keeping an eye on your grandchild, too. Don't try it at the same time, though.

Finally after all those weeks here are some screenies from "Holding the Baby" or short ... HTB, one of the five games from the "Game of Life" collection we did (and one of the games I had the joy of doing).

gol_htb_00.jpg

 

gol_htb_01.jpg


Did I mention that you have to get it done in time?

Well you'll see yourself ... 4 more to go.

nGFX

Time based movement and tracks/tiles ...

Long time no post, so I thought it might be the time to do so again ...

While still working on the last GOL game ("The Day of the Triffids"), my mind starts wondering off to the next big project, the "logimotion" game.

I do dimmly recall that when doing the Wintertales/Deserrunner game I said something about explanation, but I guess it somehow slipped through just waiting there to be recalled now ...

So here we go:

Time based movement and tracks/tiles ...

While doing the engine I came to the point where I had to move the sprite over the player created tracks, two ways came to mind:

a) write some fancy stuff for each tile, using the sprite and offset it's coords according to the need of the tile.
b) write some fancy stuff that works whth each tile, using some other approach.

I decided to try the latter one.

What bothered me with the first method was that I had to map out coordinates or tween the sprite along the tracks which somehow wasn't what I wanted.

The second method wasn't that clear. I needed to find a way to move the sprite from the starting point of the tile/track to it's end ... after a few pointless tries I thought that I could just do it time based instead of position based.
This proved to be a very easy and re-useable way.

dt_track_00.jpg
screenie of the car in motion, showing the track, too.

As the car isn't shown top/dow, there needed to be some sort of animation and we wanted to be able to move with different speeds, too.

My first task was to invent some sort of naming convention which helps me to sort the different tiles and tell the code *what* this tile does without adding to much fuzz to the map.

So I decided to use a for digit code like 0011 for a corner from west to south, giving each direction either 1 for "exit" and 0 for "no" exit.
Then I decided to use "easings" to move from the starting point of the track to end point of the track. Moving a stright line (0101, or from west to east) would just ease the x value linear in say 16 frames (and because I had 16 animation frames ... you guess right).

This is what I stored for the tile:

this._tile_array[22] = {sx: 1, sy: 1, t: TileEngineClass.TILE_TRACK, f: "t_0101", d: "0101"};

sx/sy: size
t: tile type
f: frame in the tile mc
d: direction information

And this is what the player sprite "knows":

this._track_array["0101"] = new Array();
this._track_array["0101"][1] = {sx: _x0, sy: _y1, ex: _x2, ey: _y1, fx: EaseUtil.easeLinear, fy: EaseUtil.easeLinear, nd: 1};
this._track_array["0101"][3] = {sx: _x2, sy: _y1, ex: _x0, ey: _y1, fx: EaseUtil.easeLinear, fy: EaseUtil.easeLinear, nd: 3};

sx/sy/ex/ey: start coords/end coords for the easing
fx/fy: easing method for x/y
nd: the new direction after reaching the end point, used for corners mainly.

The sprite knows which direction (0-3, according to the 4 digits of the name) it's moving, the animation it should use ("0101" + frame for the current time) and it's time.

If the sprite reaches the endpoint of the ease, I can look up the next tile in the map array (because if the direction of the next tile is 1, I take the next tile east of the current tile).
If the next tile is empty, well the player creashes.

Easy, isn't it?

Here's the data for a corner:

this._track_array["1100"] = new Array();
this._track_array["1100"][2] = {sx: _x1, sy: _y0, ex: _x2, ey: _y1, fx: EaseUtil.easeInSin, fy: EaseUtil.easeOutSin, nd: 1};
this._track_array["1100"][3] = {sx: _x2, sy: _y1, ex: _x1, ey: _y0, fx: EaseUtil.easeOutSin, fy: EaseUtil.easeInSin, nd: 0};

In order make it faster I just reduce the time needed to get from start to end, though it's a good idea to use something that can be devided by 2, so the animation isn't messed up

You can see it in action: here (German version, though)

Back to the Triffids ...
nGFX

"Some people are heroes. And some people jot down notes."
        -- (Terry Pratchett, The Truth (us, de))

Nerds and Lego ...

Ever noticed that computer people do have a thing for Lego?

While waiting for feedback for "High Jinx" and "Hold the Baby" I decided to play with Legos ... or at least with virtual Lego bricks (saves the cleaning up afterwards *and* of course you have all the parts you need)

Virtual Lego?

Yep. Right now I know of two methods to do so:
The Lego way using Lego's own virtual Lego builder. Great thing if you want to build your virtual model with real Lego bricks afterwards, because you can buy the parts you've used online. Only drawback atm is that not all parts are available, so you have to use the "default" ones ...

The "LDraw" way.
LDraw™ is an open standard for LEGO CAD programs that allow the user to create virtual LEGO models and scenes.
Just head over to the download section and get started. I prefer MLCad, which is a great editor (it takes a few minutes to get used to it, but you get things done without looking at the manual)

So I grabbed some of my old model building instructions and just recreated one of my very first Lego model I bought from my own money (and man, did I mow a lot of grass for it):

Here it is: Galaxy Explorer (497-1)
Galaxy Explorer (497-1)1.jpg
just the space ship...

Galaxy Explorer (497-1)9.jpg
... and the whole thing.

May be some fun to render it with Max :)

Happy building, nGFX

ps:
Mehr zum Thema bei Amazon.de

More books on Lego on Amazon.com

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

nGFX

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): drawexample.zip (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;
}

 



nGFX

Big Brother Is Watching You!

This is completely game unrelated post, but I just thought this is worth sharing ...

I finally got the new NIN cd year zero. Glued to the back of the CD was the following, which I found quite amusing:


USBM WARNING:
Consuming or spreading this material may be
deemed subversive by the United States Bureau
Of Morality. If you or someone you know has
engaged in subversive acts or thoughts, call:

1-866-445-6580

BE A PATRIOT - BE AN INFORMER!


I don't think that there's much to add to this ... because it just might become reality sooner or later ...

nGFX

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,
    new
Point(this._xmouse, this._ymouse), bmpAlpha, new Point(0,0), true);
      
this._iPaintAlpha--;
      


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

nGFX

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.
twh_070410_08.jpg
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:
twh_070410_09.jpg
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 ...
twh_070410_05.jpg
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.

Done!

nGFX.