• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

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

Matthew Allen

FAST alpha-blitter: possible?

7 posts in this topic

Yes.

Use your 3D card's alpha blitting hardware. I'm doing this and have no problems doing 75 FPS on a PII 400 w/RIVA TNT and about 1/2 the screen full of alpha blits.

I believe there's an article by Tobias that explains the process; search for "Enhanced2D."

Mason McCuskey
Spin Studios
www.spin-studios.com

0

Share this post


Link to post
Share on other sites
Expecting fast full screen non accelerated alpha is a bit unrealistic, but I think you can do better than 5fps. However, if you just want to make the map a dark tint of blue as you say, I'd suggest you make a routine to shift down the red and green values of the pixels in question. If you have 128k memory to blow, you can even make a lookup of pixels (ie. unsigned short blue_tint[65536]) then precalculate the new pixel value for each of the 65536 possible pixels. This would likely be a little faster still. It's not going to run at 75fps, but implemented properly it will be a big improvement over 5fps. If you only want to run this on your computer you could, as Mason suggested, use your 3D card's acceleration, but I highly recommend you include a software mode if you're planning on other people using your program.

The other suggestion I have (if you're not already using it) is to draw your map to a memory buffer instead of directly to the back buffer. This removes the need for your alpha function to look up video memory, which will save time. Once you've applied your alpha (or lookup table, this should speed up either) to the memory buffer, use BltFast to draw it to the back buffer for best results (this way system -> video hardware acceleration will be used also, if available). If you're drawing your map with a lot of overlap, this might even speed up your initial framerate. Then again, it may also drop it if you aren't drawing a lot of overlap, but in the case of the alpha blending it's worth a try to see if it helps things. It does depend on other factors of your program and hardware, so play around with it and see what you come up with.

Good luck, and post back to the thread if you need any further help.

Starfall

[This message has been edited by Starfall (edited November 02, 1999).]

0

Share this post


Link to post
Share on other sites
mason: thanks for the enhanced2d link, i'm going to try to use that.

starfall: how would I make a function that shifts down the red and green pixels fast? I editied my alpha blitting function to make is so it does what you said, but it still goes pretty slow. What it does is go through a two loops (one for x, one for y) and changes each pixel on the back buffer (which is in video memory) to only the blue value of that pixel. It does this by ANDing the pixel with a blue mask. This isn't exactly what I want, but I'm not going to fix it if it won't go any faster. What should I do to make it faster?

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

[This message has been edited by Matthew Allen (edited November 02, 1999).]

0

Share this post


Link to post
Share on other sites
You've just identified your problem.

If the surface you are locking and reading from is in VRAM, your frame rate is going to drop significantly. Unless all your sprites fit into VRAM, and since you are doing alpha blends, you need to do your image blting first to a system surface, do your blending there, then blast the whole image (or the dirty rect of it) up to the video surface, then call flip. Reads from VRAM are REALLY REALLY slow..

0

Share this post


Link to post
Share on other sites
---------
If you only want to run this on your computer you could, as Mason suggested, use your 3D card's acceleration, but I highly recommend you include a software mode if you're planning on other people using your program.
---------

Actually Starfall, market research shows that the majority of gamers (in the US, anyway) have a card with some form of 3D acceleration. DirectX takes care of the differences between 3D cards, so if you write the code correctly, it will work on many more systems than just your own.

Mason McCuskey
Spin Studios
www.spin-studios.com

0

Share this post


Link to post
Share on other sites
I would have to agree with that last statement. To change the value of a pixel in vram you have to go through the the video bus, change the value and then pass the new pixel again through the video bus (really slow). The fastest would be to keep your rendering surfaces buffer in system memory, do all your plotting and then transfer the surface to the back buffer.

or I could be just rambling.

0

Share this post


Link to post
Share on other sites
I read the MMX Enhanced Alpha Blitting tutorial and got the function that he created working, but it goes hideously slow. My game dropped from 75 fps to around 5 fps (no exageration) when I had it do a full screen (800x600) alpha blit. This is at 16 bpp, by the way. Even with smaller blits it's horrible: a 250x80 pixel sprite cut the frame rate in half (75 to 37.5).
Is there any way to make this go any faster? I did this testing on a 450 PIII with a 16 mb TNT video card, so I doubt the method I used will go much faster on any other computer.
What I am trying to accomplish in the end is a console-like screen though which the 2D map behind it can be somewhat seen. If there is a way to just, say, make the 2D map a dark tint of blue, that would be great, but I really don't even know how to do that.
Thanks for any help.

------------------
- mallen22@concentric.net
- http://members.tripod.com/mxf_entertainment/

0

Share this post


Link to post
Share on other sites
As I said in response to the original post, and as everyone has repeated, using a memory surface will help. To further increase speed you should be moving 4 bytes at a time (2 pixels instead of 1) - though this speed may be lost by the use of the lookup table, since you then need to shift the high word down to look it up, and shift the result back up to put it back in the pixel. As for shifting down the blue and green, as I stated before I suggest you use a lookup table for this. The equation to do the shifting then does not need to be so speed critical, as it is performed at load-time. Apart from assembler optimisation, which can be tricky if you're not familiar with assembler, there aren't any other simple things I can think of to speed things up.

In reply to Mason, if "many more systems than just your own" is good enough for you, so be it. Personally I'd want my software to run on as many systems as possible, and without providing a software alternative you're cutting off a large portion of prospective users. The answer is of course simple, if you want the best of both worlds - offer both.

Regards

Starfall

0

Share this post


Link to post
Share on other sites