Thursday, June 14, 2007
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))

Thursday, June 14, 2007 11:56:30 AM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Monday, June 11, 2007
Still trying to get my head around as3, it's a saucy little minx alright.

Anyway, he's yet another old school demo effect, and another one I never managed to get working on the Amiga at the time ( Flash just seems to be an outlet for my past failures as a coder ).

Plasma.swf (5.47 KB)

Guess a bit of texture mapping should be next to keep with this theme.

( For a lot more demo style eye-candy check the experiments cat., and to see them all shoved together and wrapped up with plenty of love, check out 651 )

Squize.
Monday, June 11, 2007 2:47:12 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Friday, June 01, 2007
I've noticed my little frame counter pop up in quite a few peoples games since I included it in a bit of open source, which I do find pretty cool ( I wonder if anyone's used my scroller class ? Doubt it ).

Anyway, I thought it may help someone out there if I posted my as3 version. It's written using Flex as opposed to Flash, so it uses [Embed] to bring the assets into the swf, but I wouldn't have thought getting it working in CS3 would be that much of a mare.

Hopefully it should all be pretty straight forward, it just requires two arguements to get it going. Anyway, enjoy seeing how quick your shiny new as3 code really is.

fpsCounterAS3.zip (8.35 KB)

Squize.
Friday, June 01, 2007 12:11:11 AM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [3]  |  Trackback
 Monday, May 28, 2007
I've had a bit of down time since Friday, so I thought I should finally look into AS3.

I've heard lot's of comments from fellow game devs. That it's a steep learning curve. Being kinda cock sure I thought "It can't be that bad".

Oh silly silly me.

I remember hating AS2 when I crossed over to that late last year, and loving it now, so I know that AS3 is just going to be the same. That nasty month or two of "If I could do this in AS2 it'd have been done 3 hours ago", and that feeling of going from being pretty good at something to absolute lamer. Never nice.

Anyway the fruits of my labour are below. It's just a re-working of my infinite bobs effect I did a little time ago ( In as1. In an hour ). At least I've managed to convert my fps counter ( Although ensuring it stays on top of all the other mcs / sprites / displayObjects / whatever the hell they're called now, is still a bit beyond me ).
No preloader, as that seems to be a can of worms, but it's less than 13k so it's not an issue with this. Also it's not really a clever clever AS3 speed test, the whole point of the original code was to show you can still do funky things in as1 ( It was a slight backlash against what seemed like everyone at that time acting like as3 was the second coming ).

InfiniteBobs.swf (12.18 KB)

Squize.
Sunday, May 27, 2007 11:13:47 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Monday, May 21, 2007
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

Monday, May 21, 2007 4:29:16 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, May 17, 2007
"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.

Squize.


Thursday, May 17, 2007 8:38:11 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, May 15, 2007

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

Tuesday, May 15, 2007 10:14:00 AM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, May 11, 2007
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.

Squize.

Friday, May 11, 2007 12:34:41 PM (W. Europe Daylight Time, UTC+02:00)  #    Disclaimer  |  Comments [0]  |  Trackback