|
Snowdon

Wotcher! It's Snowdon! (Laptop thumbpad stylee ._.) |
Snowdon!
Sometime in 2003, I played a neat little game called
Downfall
by Peter Bone based on an old Atari game. The screen
was split into two vertical arenas, and the objective was to draw lines to channel the snow falling from the
top of the into a small area on the bottom, causing the opponents screen to rise. When the opponents screen
rises over a certain amount, they lose. It's nifty, and kudos is due to the inventor of this.
So you just, like, took the game out then?
Under tepples' advice, I took to learning that nifty language known as
C using a little known library known as ALLeGRo.
Not knowing much C at the time, I thrashed about in some
terrible code, attempting to recreate some of my old Blitz projects and some other apps that Edd sent me...
Eventually while trying to recreate the background effect from the Tetris Attack menu, I decided I was
ready to make my first proper interactive C project. Looking on the internet for inspiration, I asked folks
what I should do next... There, I got the inspiration for what was to become
Dr. Kain.
Wrong game, man. This is the Snowdon page.
Oh yeah, right. I made Snowdon one day to see if I could copy the snow mechanics from Downfall properly. I just
got bored of trying to make Dr. Kain one night, so I just stayed up on the laptop and made Snowdon. That's about it.
Snowdon controls:
Left mouse button paints yellow platforms.
Right mouse button unpaints yellow platforms.
Hold Space to make it snow.
Tap End to delete all the snow.
Tap Enter to delete all the platforms.
Escape quits.
Snowdone
It's not my fault! Yellow on black vector is easy to make and... it works!
At least this time I'm not entirely responsible: Downfall was white on black! Anywho, here's a link to
Downfall, now have fun!
For the little that it's worth, the snow kinda reminds me of the Sand Pourer skill from Lemmings 2.
SnoWTF?
Oh yeah, for all-a'ya completists out there... Snowdon doesn't use
linked lists, because I was only learning C at the time,
I didn't know jack about pointers. ._. Instead, all the snow information is inside a gigantic array of
structs... which ultimately means there's only a finite amount of snow. Sucks, huh? Somebody on IRC
suggested I increase the amount of snow... so I did. Here it is! This new
version has quite a bit more snow! Go for it! That wasn't enough snow was it? Okay, here's a version with
a freaking heckuva lot of snow.
"More like 'Slowdon', lol" and "OMG, I found a bug"
Snowdon is slow. It's exceptionally slow. And it would've been slower if I didn't cut some corners. Riddle
me this: For a snow particle to successfully descend one pixel, that pixel needs to be clear. If it is, then
it can fall. If it isn't then you need to check the pixels to the left and right, and the ones below them.
Only when the three pixels below the incident snow are clear it can fall. The problem lies within the
clear checking: For a pixel to be clear, it needs to have no custard in it (Nautical term, love) and it needs
to not be occupied by any other piece of snow. (Unless of course that particular piece of snow will have fallen
that particular frame, which in turn depends on the snow beneath it.) I totally cheated past all of this
by caching the state of the screen in a big über array at the start of every frame, and referring to that for
every clear check. A side effect of this is that two seperate snows tumbling down a pair of ramps into a
single pixel wide channel will 'merge' and the snow will appear to disappear. You heard me! Check it for
yourself: copy the top illustration here by drawing a horizontal line and filling the top half of the screen
with snow, and then delete a small hole in it and watch the snow disappear. If you attempt to check every pixel using the commonsense method, you will be comparing
Every Pixel by Every Other Pixel upto a maximum of five times per frame. That's quite a lot.
The perfect solution would update all the snow from the bottom up and clear checking only against snow below
the current snow with some amazing optimized system.
There's plenty
of other ways of doing this, but I couldn't really be bothered with optimizing the clear checker because it was
late and this was just a break from Dr. K.
|