Jump to content
  • Advertisement

Archived

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

nathany

Enhanced 2d (Direct3D). To use or not to use?

This topic is 6929 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, I found that article on gamedev.net about using D3D for isometric engines quite interesting. I''m interested in making 2d games, but with some nifty fx and stuff. I could learn D3D or just write some ASM code... but I''m still kind of wondering which way to go. To my understanding, there are basically 2 ways to do alpha blending: - Use 3d hardware - Write your own (likely in ASM, I recall another article on gamedev.net about this) With the 3d card method, you also get scaling, rotating, zbuffer and other benefits. Also some limits, like texture sizes the factor of two, maybe required to be square, and maybe a maximum size. Am I right on this? And, I''m guessing that this will require a 3d card with these features... to what level will D3D emulate such features? At all? Are there other advantages? For the software method, reading from video memory is way slow. So you want to do system to system memory blts for alpha blending. Assuming that you alpha blend with whatever happens to be behind something, it sounds like the best thing to do is have a virtual buffer (back buffer in system memory and not in the flipping chain). Just do all blts to it using some custom written asm code. Then BltFast the whole thing to video memory on vsync. Sounds like hardly using DirectDraw at all, maybe not even storing sprites in surfaces since all blt code is custom anyway. Does this sound correct, or have I taken this method too far? On a side note, today I tried out a demo of this game called Vyruz today... it''s an isometric shooter that uses the Enhanced 2d approach... it also has a Software Renderer. I''m not sure if that''s D3D-provided emulation... but more likely it''s something like the 2nd method mentioned above. - n8
nathany.com

Share this post


Link to post
Share on other sites
Advertisement
If I recall, I found software D3D to be pretty slow. You can certainly beat its performance using routines crafted specifically for what you want - its not bad, but its FAR from being overly good!

The texture size limits are the biggest factor that seem to put people off from using D3D. Personally, I''ve found that its pretty easy to stitch 128x128 textures together as needed (going above 128x128 is risky - not that many cards support it).

I have to say that its relatively rare to find a gamer''s machine without 3D acceleration these days (at least in the US), so I have no qualms about using it. Then again, I wrote the D3D article you mentioned. ;-p

I like the screenshots of Vyruz, although I have to say I''d probably have used some more impressive dynamic lighting!

Share this post


Link to post
Share on other sites
quote:
Original post by Bracket
If I recall, I found software D3D to be pretty slow. You can certainly beat its performance using routines crafted specifically for what you want - its not bad, but its FAR from being overly good!



Okay, so it's slow... but does it work? Alpha blending, zbuffer, and all the basics? What sort of limitations could be expected? [i don't know d3d yet]

quote:

The texture size limits are the biggest factor that seem to put people off from using D3D. Personally, I've found that its pretty easy to stitch 128x128 textures together as needed (going above 128x128 is risky - not that many cards support it).



Hm. I thought 256x256 would be okay [that's my Voodoo3, along with the 16-bit color limit]. Stiching sounds like an interesting thing to figure out. And there is also scaling. Otherwise... I guess all the sprites need to be smallish... better for a strategy, or better for lower resolutions perhaps.

quote:

I have to say that its relatively rare to find a gamer's machine without 3D acceleration these days (at least in the US), so I have no qualms about using it.



True enough. And by the time I get an actual game made it will be even more so. In addition, I'm not intending to make any money... so a smaller possible audience isn't too much of a loss. Playing with this Enhanced 2d stuff also sounds like a lot more fun than hand-coding MMX optimized alpha blending routines, etc.

quote:

Then again, I wrote the D3D article you mentioned. ;-p



Since your the guy, I have a bit of a question. I replaced the texture in your last demo with some grass texture, and it looked pretty cool: nice hills and stuff out of one texture. But what I'm not sure about is anything beyond basic terrain... say a building or something. Doesn't creating a texture that will be rotated 45 degrees sound just as difficult as drawing little diamond cut-outs in some cases?

Anyway, I'm still not entirely sure what approach to take... it will likely depend on what sort of game I decide to make. And I'm patiently waiting to see what MS has done to DX8... which might change some things (beta1 is very soon).

Btw, what is "Black Future"?

Nathan.

P.S. I would be very interested in another Enhanced 2d article from you.





nathany.com

Edited by - nathany on 5/5/00 12:31:57 AM

Share this post


Link to post
Share on other sites
i am writeing an 2D RTS in ASM...

and i have your problem also:

i have to do alfa blending with my code (read that article)
i it fairly fast (of course more faster than C)
with no optimization at all

but (there is always a but):

i had to move all surfaces in system memory as readyng from backbuffer surface after a lock is incredible slow...(i wonder what the hell does my voodo3 card then...)
and moveing all surfaces in sysram made my game 1/2 speed at least...
to present time i have no solution to this...

i am only happy with my alpha blending routine
now i can have translucent menus of big size and units that
are 50% transparent ("cloaked") of any form with no 3D
operations...(here not many have 3D cards)

but i start understandin that 2D is harder then 3D nowdays
because anyway all that 2D big pre rendered bitmaps will simply not get even into 16 or 32 megabytes of video ram




Share this post


Link to post
Share on other sites
Go D3D. If you are running that example, most of the work is done. Now you just need to get your little guys on the screen, etc.

Using the Alpha blitting with D3D is awesome. I used my own routine in ASM with Direct Draw and it was fast at all when compared with D3D doing it.

Share this post


Link to post
Share on other sites
"Black Future" is a play-by-email roleplaying game I ran for a few years. Its still quite popular, although its on hold for a while - after doing 50 issues, I needed a break! Anyway, onto D3D stuff....

Sometimes, designing buildings for use in a diamond-shaped isometric situation can be a royal pain in the a** - just like texture design can be. I guess the artists never get it entirely easy! Seriously, though, it can be done. Whether or not its easier than designing a "truly 3D" level is debatable, although there is definitely less overhead in designing an iso engine than in designing a true 3D engine (with or without an iso/ortho projection).

One way I''ve found that works for tackling buildings and similar is to have a linked list for topleft and topright walls on each square. Each of these can contain height information, the name of the texture to use. That lets you layer walls on top of one another. If you then make the base tile a linked list (and render in ascending order), you can have multilayer buildings. Its a pain to make sure you can always see the player inside - but that can be overcome. You can go happily nuts with this concept - lots of layers. You can add offset information to let you "bend" walls and similar. If you treat roofs in the same way as landscape, slanting roofs are nice and easy. Maybe I should write a tutorial on that, sometime (ideally when I''m working a little less!).

Share this post


Link to post
Share on other sites
Bracket: (re: buildings) thought it might be something like that. the iso tile textures are just for the ground... and the buildings are sort of 3d, except it''s optimized for the iso view so it doesn''t need all the matrix math i recall a game called Conquest of a New World that had 3d terrain, but I think the buildings were actually more like sprites.

When I think about some of my larger ideas, I think they could benefit from real-time 3d "sprites". For now I think I want to make at least 1 "Inbox game" and take the higher-user-base approach of DDraw and some ASM.

bogdanontanu: i don''t think there is a solution, other than optimizing the heck out of your code i''m wondering if you are using your own Blt for non-alpha blended blits as well? Should be able to acheive faster speeds than BltFast with some hand-optimized code.

Also, I wonder if it would make sense to not even use DDraw surfaces for sprites... seeing that there is some overhead associated with them.

There''s an adventure game called The Prince and the Coward written complete in ASM on a 486 with DirectX. It actually anti-aliases all the sprites and all sorts of things. Too bad they don''t have a demo or anything.

Oh well, ttyl ...

Nathan.




nathany.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!