We've run into a bit of a problem here...
Unfortunately, the idea I had for the level intro sections is impossible without use of an extra module and a shizelload of manual pixel-by-pixel fiddling to make it fade in. See, in SDL (the C++ module PyGame uses), there are three types of alpha: colourkey, surface and per-pixel. Colourkey is the 1970's-reminiscent idea of having one colour in an image that is converted to transparency, so you'd put your non-rectangular image on a purple background for example and that background would be removed by the program. It's not particularly useful when you want smooth edges. Surface transparency makes an entire image (rectangular of course) have a certain alpha value - so, for example, every pixel in the image would be half-visible. This is what I use for fading in scenes. And finally, per-pixel is where every pixel has its own alpha value - this is necessary for the spiffy transparency effects on the level intros text box.
And here's the thing - you can't use surface alpha and per-pixel alpha on the same image. So to have it fade in, the text box needs to be completely opaque and rectangular. And to have the cool alpha effects and rounded corners, I leave myself unable to utilise the benefits of surface alpha for fading in. Without the fading, the text box's entrance looks particularly rubbish; and it's just disgusting as a rectangle. So, it's back to the drawing board.
I've decided after some deliberation, collaboration and thinkingination that actually the level intro sequence might look better without a text box. If I implement a text box, I know I'll end up making it draggable simply because draggability is so cool and it's always enjoyable to code, and then the continue button will be attached to the text box, and suddenly we have Microsoft Windows in game form. It'll almost certainly be better for Slipslide (and the player) if I actually design a unique interface for it, as I've done with the main menu.
But meanwhile, on the brighter side of things, Slipinator (the level editor) is now underway again. I'm working on a drag-'n'-drop method where you drag objects onto the level, and it's actually been very successful so far. Not only does it not crash now that I've done away with the 500 buttons approach, it also means that holes and other things can now be added as well as just blocks. And it's only taken me 200 lines so far!
Tuesday, 29 January 2008
Sunday, 27 January 2008
Level intro text box demo
I've now finished a working demo of the text box system that will be used in the level intros module. Using a bit of nifty programming, I've created a system that builds a text box from four images; the two top corners, a 1*24 pixel image to tile between them and a 1*2 pixel image to tile across the rest of the area. I also coded a spiffy effect that makes it fade in whilst expanding when the intro scene first starts - and although this is impossible to properly show through screenshots, I'll have a go...
When the scene starts:

When it's finished fading and expanding:

To see the box properly you really need to view it full-size by clicking it; the scaled-down versions above lose all the detail and look almost plain blue, whereas full-size there are lots of nifty details. There's also a transparency effect that'll be visible when I put the animated clouds in the background (coming soon!).
When the scene starts:

When it's finished fading and expanding:

To see the box properly you really need to view it full-size by clicking it; the scaled-down versions above lose all the detail and look almost plain blue, whereas full-size there are lots of nifty details. There's also a transparency effect that'll be visible when I put the animated clouds in the background (coming soon!).
Saturday, 26 January 2008
Many, many bugs fixed
The original fade-in method turned out to be very buggy; firstly, when fading levels in the character appeared on top of the fading level. Also, the fade was incredibly jerky at times, as the algorithm was particularly inaccurate. And on top of this, the scene was completely frozen whilst fading was taking place, which to be honest looked rubbish - for example, this meant that if you moved the mouse whilst the title screen was fading in, the text would remain still and then jump to the right place once the fade was finished.
So I completely re-coded the fade-in method so that instead of capturing the screen, altering the alpha value and then blitting it each time, it now uses the parent object's update method so that the scene you're fading into runs normally. Meanwhile, it blits in a plain black square with an alpha value on top of the scene, so that it's really just a black square that fades out with the scene behind it. This is now working perfectly, with no glitches at all so far!
As well as bugfixing, I've also been redesigning the filesystem some more. At the beginning of development, it was decided that music would be put in the level folders so it could be easily loaded with the level by supplying only the folder name. But this means that there needs to be a music file inside every single level folder, and with the average file being around 2 megabytes, 25 levels will take up a massive amount of space. So instead of that, I'm now storing all music in the engine's Data folder, and and the level controller has been modified so it takes the path to the music as an argument. I'm going to have a total of ten tunes, one for each main area in the game, so the final game's file size will be a lot smaller this way.
Now I'm moving on to designing and coding the level intro sequence module. Screenshots to come!
So I completely re-coded the fade-in method so that instead of capturing the screen, altering the alpha value and then blitting it each time, it now uses the parent object's update method so that the scene you're fading into runs normally. Meanwhile, it blits in a plain black square with an alpha value on top of the scene, so that it's really just a black square that fades out with the scene behind it. This is now working perfectly, with no glitches at all so far!
As well as bugfixing, I've also been redesigning the filesystem some more. At the beginning of development, it was decided that music would be put in the level folders so it could be easily loaded with the level by supplying only the folder name. But this means that there needs to be a music file inside every single level folder, and with the average file being around 2 megabytes, 25 levels will take up a massive amount of space. So instead of that, I'm now storing all music in the engine's Data folder, and and the level controller has been modified so it takes the path to the music as an argument. I'm going to have a total of ten tunes, one for each main area in the game, so the final game's file size will be a lot smaller this way.
Now I'm moving on to designing and coding the level intro sequence module. Screenshots to come!
Friday, 25 January 2008
The joys of fading
Today I've started writing a new class for Penuine that can be used for fading scenes in and out at an arbitrary speed (and the fadeout end colour is also variable). So far the fade in method is working, and I've implemented it in the main menu scene and the level controller. The difficulty with this new class will be not overusing it to the point of it becoming annoying; it's very hard to resist making almost every scene fade in and out simply because it looks cool!
Monday, 21 January 2008
The superawesome menu of awesomeness!
Finally, the main menu is complete. And I have to say, I'm incredibly proud of how it turned out! Take a look for yourself:

Unfortunately, a screenshot can't do it proper justice - that's not just a cloudy background image you see there, it's actually four layers of fully animated clouds moving in real-time with the text in between them. And the options at the bottom aren't static either; move your mouse to the right-hand side of the screen and they'll all slide over to the left to reveal the options on the right.
All this has resulted in a 250-line file, making the main menu module the largest module in the entire engine - larger even than the level controller! It's been incredibly complicated to program all the effects and get them running at a reasonable speed, but I can honestly say it was worth the effort.
Anyway, I'm off to spend the next few days patting myself on the back.

Unfortunately, a screenshot can't do it proper justice - that's not just a cloudy background image you see there, it's actually four layers of fully animated clouds moving in real-time with the text in between them. And the options at the bottom aren't static either; move your mouse to the right-hand side of the screen and they'll all slide over to the left to reveal the options on the right.
All this has resulted in a 250-line file, making the main menu module the largest module in the entire engine - larger even than the level controller! It's been incredibly complicated to program all the effects and get them running at a reasonable speed, but I can honestly say it was worth the effort.
Anyway, I'm off to spend the next few days patting myself on the back.
Subscribe to:
Posts (Atom)