Archived

This topic is now archived and is closed to further replies.

Fading in, fading out?

This topic is 6351 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there, I''m working on a Tetris-game and I''m using DirectDraw. When you quit the game, I show a screen with the high scores first before exiting the program. Now, what I want to know is, how you can fade the game screen to black and then from black back to the high score screen. Hope you understand what I mean, Soehrimnir

Share this post


Link to post
Share on other sites
IF you are using paletised colour (256 colours, or 8bit colour ) then you just go through each value and subtract 1 until they all = 0.

If you are using direct colour? Go through EACH AND EVERY PIXEL and -1 until they all = 0. Kind of sucks, but there you go

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-Chris Bennett of Dwarfsoft
"The Philosophers' Stone of Programming Alchemy"
IOL (The list formerly known as NPCAI) - A GDNet production
Our Doc - The future of RPGs
Thanks to all the goblins over in our little Game Design Corner niche
          

Share this post


Link to post
Share on other sites
You mean blending a whole lot of "black fog" over the surface? Unfortunately I am unsure of how to do this, but it probably makes sense to someone

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-Chris Bennett of Dwarfsoft
"The Philosophers' Stone of Programming Alchemy"
IOL (The list formerly known as NPCAI) - A GDNet production
Our Doc - The future of RPGs
Thanks to all the goblins over in our little Game Design Corner niche
          

Share this post


Link to post
Share on other sites
In glide, you can set a near/far limit to a fog, set up a fog table and then make a fog color. Set the far limit to just the other side of your high score board, and then push the near limit away from the camera each frame towards the board, until you are completely faded to black.

Share this post


Link to post
Share on other sites
Ehm,

what I do is blitting a bitmap image to the surface. Then when you are gameover you press Esc. Then a different bitmap shows up (the high scores). I want to let it go from the first bitmap to the other smoothly. Not that the high scores pop up immediately.

Thanx though for the quick replies.

Share this post


Link to post
Share on other sites
Then you do what I said about updating each pixel/palette value.

Instead of waiting until it hits 0, you make sure it is +1 or -1 until it reaches the value of the bitmap that is fading in... that make sense? What colouring are you using? 8bit? 16bit? 24bit? 32bit?

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-Chris Bennett of Dwarfsoft
"The Philosophers' Stone of Programming Alchemy"
IOL (The list formerly known as NPCAI) - A GDNet production
Our Doc - The future of RPGs
Thanks to all the goblins over in our little Game Design Corner niche
          

Share this post


Link to post
Share on other sites
I''m using 16bit at a resolution of 800*640.
But I don''t understand what you mean by updating the pixel/palette value etc. I just use CreateSurfaceFormFile(filename) and then use the BltFast method.

Never had to worry about pixels. Why should I do work with pixels?

Share this post


Link to post
Share on other sites
If you are using 16-bit mode you don''t have the luxury of just decreasing the values of the pallette. There are a couple of ways to do the pallette fade. One version is to do the decrementation technique. The other is to decrease the pallette values by percentages. Such that ''normal'' colors are 100% and you start decreasing the percentage of brightness until you''re down to zero. 0 percent of any color is 0 for each of the RGB values which is black.

With 16-bit mode you have to get yourself a copy of your video buffer, and calculate faded values for each pixel in the buffer and draw the new faded version to the screen. You MUST understand the workings of 16-bit color and it''s 5-6-5 color structure, because each of the color''s Red Green and Blue components have to be decreased separately for each pixel. I suggest you use a timer make sure your fade is the same rate on every machine, using the timer to decide what percentage of fading you want at a particular time so that slower machines don''t take forever to fade. Also using tables that have precalculated values reduced by given percentages would work nicely.

percentTable[100][64];

percentTable[50][62] yeilds 31... the tables can be generated quite easily.

I''d like to see your Tetris game. If it''s not totally necessary to use 16-bit colors, you may want to drop down to 8-bit. My tetris game is done with 8-bit graphics courtesy of my little brother the pixel painter, and it looks great! I don''t do any fading, but I can add it in a matter of minutes.

If you were doin'' Direct3D or OpenGL or something 3D accelerated, you could take advantage of alpha blending, and just put a black QUAD that covers the whole screen and starts off with an alpha value of 0.0, then slowly goes to 1.0f. This would produce the effect of fading without any crazy memory buffer play, etc.

Daniel "NitroSR" Piron

Share this post


Link to post
Share on other sites
Gamma Ramp doesn''t work with older video card.
I second NitroSR''s suggestion, use Alpha Blending - It looks good and runs very fast.
There''s an article about it at Mr GameMaker.



The road to success is always under construction

Share this post


Link to post
Share on other sites
The alpha blending method in Mr Gamamakers tutorial, it is emulated by DX if no 3DFX card is present isn''t it?

Regards,
David Stubbs

Share this post


Link to post
Share on other sites
You must know I''m only just a few months into all this. Are there any articles that explain me the differences between all these palettes (555, 565). As I read your replies, I should be learning that first before I continue.

Share this post


Link to post
Share on other sites
n0p3x: In the tutorial, they first try to create a TnL device (Transformation and Lightning - I think) which is supported by the latest GeForce chipset.
Then, if it doesn't succeed they try to create an HAL device (It's hardware accelerated) which is suppported by all of the video cards (Including 3Dfx's cards).
Then if that doesn't succeed they try an MMX software device - It's the same as a normal software device only a little faster using MMX commands.
And If that doesn't succeed an RGB device is created - software emulation. Really slow, but works.
In other words: Yup

soehrimnir: Look in the DX SDK, their might be some useful info for you there.

The road to success is always under construction

Edited by - Tornado on August 29, 2000 6:05:31 AM

Share this post


Link to post
Share on other sites