Look up "gamma"-something in the DDraw docs.
It lets you fade fast if the hardware supports it.
Using Transparency in DDraw with software
well the other idea is do what we did back in the day (and still do), use a lower resolution and color bit depth. for instance doing 640x480 at 16bit color depth is possible for fading (if optimized in mmx, there was an example of this on this site). using the gamma control is a bad hack, since you are effectivly messing with someones video settings without permission and if some one alt tabs out your game or it crashes the person will be quite pissed. (since gamma settings wont be set back on a crash which is why desktops are bright (or dark) when quake crashes and other games crash). though in those games the user is telling the game while its running to use increased or decreased gamma settings.
also 640x480 is quite a decent resolution for a 2d game. dont expect look up tables or storing all the frames help yoru cause. it will merely make things worse. i think though even at 32bit color depth you could get realtime fade at 640x480 on 400mhz, just make sure you use mmx (or at least fixed point math) and ABSOLUTLY NO FLOATING POINT MATH AT ALL! (it will kill yoru framerate to the point of absurdity). i was able to get decent speed when crossfading images using 32bit color at varing resolutions. though my code was in mmx and purly for crossfading of images.
i am guessing you can get about 10 frames per second at 800x600, maybe even a bit less. but only if you mmx optimize your code. i really suggest if you want to go the directdraw route, go for 640x480 as your resolution, you will fare much better with fullscreen effects.
also 640x480 is quite a decent resolution for a 2d game. dont expect look up tables or storing all the frames help yoru cause. it will merely make things worse. i think though even at 32bit color depth you could get realtime fade at 640x480 on 400mhz, just make sure you use mmx (or at least fixed point math) and ABSOLUTLY NO FLOATING POINT MATH AT ALL! (it will kill yoru framerate to the point of absurdity). i was able to get decent speed when crossfading images using 32bit color at varing resolutions. though my code was in mmx and purly for crossfading of images.
i am guessing you can get about 10 frames per second at 800x600, maybe even a bit less. but only if you mmx optimize your code. i really suggest if you want to go the directdraw route, go for 640x480 as your resolution, you will fare much better with fullscreen effects.
ello
on my duron 600 pc133 with an TNT/agp card I get:
in 640x480x32bpp res
120screens (185mb) sysmem->sysmem copy
90screens sysmem->vidmem copy
therefore doing a fullscreen fade is possible (if you do it while copying info to vidmem it should be pretty cheap if done right(asm..))
you should expect similar results in 800x600x16bpp mode (as they use quite the same amount of memory...)
It might work much worser on systems with 66mhz bus/sdram modules (pentiums, p2 <350mhz and celerons<800mhz) as their sysmem->sysmem transfer is much much worse. (on my bro cel400 I could get much better results transfering sysmem->vidmem then sysmem->sysmem!)
With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
on my duron 600 pc133 with an TNT/agp card I get:
in 640x480x32bpp res
120screens (185mb) sysmem->sysmem copy
90screens sysmem->vidmem copy
therefore doing a fullscreen fade is possible (if you do it while copying info to vidmem it should be pretty cheap if done right(asm..))
you should expect similar results in 800x600x16bpp mode (as they use quite the same amount of memory...)
It might work much worser on systems with 66mhz bus/sdram modules (pentiums, p2 <350mhz and celerons<800mhz) as their sysmem->sysmem transfer is much much worse. (on my bro cel400 I could get much better results transfering sysmem->vidmem then sysmem->sysmem!)
With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
MirekCz, are you just copy the data to its destination? if so your numbers will be very skewed and optimistic (since you are going one way only). you must realize that read and writing can screw the cache especially when dealing with multiple buffers. \
on the other hand now if its for purly fade, then your numbers are pretty good (fades are almost free when using mmx even in 32bit color). just remeber Askadar, this type of fullscreen effect is very dependent on bandwidth. my numbers were for an alpha blit function so mine are skewed lower then if you are doing just a pure fade.
good luck, and remeber. no floating point. no reading from vram. you will then get decent framerates. (you can go old school and just subtracting (faster and pretty cool looking) or the proper way of multipling (slower but accurate, may be more of wait you want)
on the other hand now if its for purly fade, then your numbers are pretty good (fades are almost free when using mmx even in 32bit color). just remeber Askadar, this type of fullscreen effect is very dependent on bandwidth. my numbers were for an alpha blit function so mine are skewed lower then if you are doing just a pure fade.
good luck, and remeber. no floating point. no reading from vram. you will then get decent framerates. (you can go old school and just subtracting (faster and pretty cool looking) or the proper way of multipling (slower but accurate, may be more of wait you want)
a person:yeah, I only copy the data, what''s wrong with that?
I do HAVE it in registers.
I get this results by either using 64bit mmx transfer or all 4 32bit registers at once (with rep movsd you get lower mem transfer, not very much lower thru)
With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
I do HAVE it in registers.
I get this results by either using 64bit mmx transfer or all 4 32bit registers at once (with rep movsd you get lower mem transfer, not very much lower thru)
With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/
With best regards, Mirek Czerwiñski
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement