Real 2D game prog. in D3D8

Started by
24 comments, last by MatuX 22 years, 3 months ago
oops, i guess i was unclear about the "NEVER lock() a vertex buffer more then once". let me rephrase and explain it better. you should never lock() the vertex buffer more then once per frame. if you do, you should not lock the same vertices over (like when doing particle systems) and should still lock at least 20-100 vertices at a time. ussually its easier to handle translations via custom software routines and faster then using matrics unless you go the hardware TnL route, even in that case you probally get better speed using custom translations. though this is specific to 2d sprite/tile stuff.

AnonPoster: of course it would be accelerated if using a 3d video card. it however may not be the best solution. camera view only will affect non transformed vertices. though since dx requires a perspective transformation anyway, you will have all the calculations done regardless of view type.

Mautaux:
even more advice. being a naive person i thought you were trying to do a traditional 2d game and not an isometric game (the pics should have clued me in, heh). i ussually consider isometric games 2.5d since they try to fake a 3d look moreso then traditional 2d games.

you say using square art will be taboo due to isometric style of your game and it would hinder the art creation. i hate to say, but using alpha blending on all those polys is bad and killing your fillrate, it will be even worse on older cards. you have two options:

1. alpha testing which should be faster since no blending is performed at all. not sure if older cards support that though.
2. square tiles that are skewed to fit how you want them to look. though this is probally a difficulty when creating the tiles. though you could just post process your tiles to be square then later when rendering skew them. there should not be too much quality loss.

even if you dont use 64x32 tiles with some bigger or smaller, you can still place them on a single texture for groups. i dont understand why you are so against doing this. if you really dont want to change your artwork at all, then dont use dx8. dx8 will require some compromises since 3d video cards were not designed with this sort of thing in mind.

also as another little remark, ff tatics which used an isometric view, used square artwork which was skewed to give the isometric look. while certain things will require more layers of art to accomplish the same look you seem to be going for, it may be faster in the long run.

do you have artwork already or are you using tradtional iso artwork form another game?
must you support voodoo and old tnt 1 cards? seems to be a little silly in this respect since many pcs nowadays have at least a tnt2/intel/better then voodoo2 video card. not usre if voodoo3 has 256x256 limitation though.
and the most important question, does your old engine with dx7 run as fast as the current dx8 engine at the SAME resolution and color depth?

also running in 16bit instead of 32bit will help with fillrate issues.
Advertisement
quote:
Anarchi: You''re crazy, I bet you will have a +400fps boost if you stop using that d3dxsprite bullshit. Don''t remember where I readed it, but it said D3DXSprite was meant as an easy way to render sprites for debugging purposes, and it IS slow.


I dont understand why so many people dislike using D3DXSprite, all it does is set up the vertices, textures, and matrix for you, if u did it yourself it would be the same code anyway, why re-invent the wheel?
Ive seen a comparison and they both perform the same. The only time D3DXSprite is slower is when the programmer does not know how to use the interface properly, which is probably because the SDK Docs dont explain the usage well.
Download my platform game and see 4 yourself.


Oh, as for the "real 2D" thing, DirectDraw and D3DXSprite both display the same output on the screen, the only difference is the blitting system, and since 3D is getting faster all the time, DirectDraw will be a thing of the past when games are concerned, its primary purpose was/is to accelerate WinGDI drawing functions and video acceleration.

Downloads, D3DXSprite tutorial, New platform game: .-= The ZeroOne Realm =-.

Downloads, Free GoldLib game library, D3DXSprite tutorial, New platform game: .-= The ZeroOne Realm =-.

I was able to blit 192 25x25 surfaces onto the screen at 400x300 at 32 bit, with DirectDraw7, and get over a thousand frames per second on my TNT1. Incase some people dont realize, DirectDraw ALSO uses hardware acceleration, just like Direct3D. If your card supports hardware acceleration, DirectDraw for 2d can be a lot faster.
quote:Anarchi: You''re crazy, I bet you will have a +400fps boost if you stop using that d3dxsprite bullshit. Don''t remember where I readed it, but it said D3DXSprite was meant as an easy way to render sprites for debugging purposes, and it IS slow.

This is just plain wrong. It is meant as an easy way to render sprites, that doesn''t mean it''s for debugging only, or that it sucks.
quote:I dont understand why so many people dislike using D3DXSprite, all it does is set up the vertices, textures, and matrix for you, if u did it yourself it would be the same code anyway, why re-invent the wheel?
Ive seen a comparison and they both perform the same. The only time D3DXSprite is slower is when the programmer does not know how to use the interface properly

Well, that''s not quite true either. You can do it much faster than D3DX, the question is, do you need to? If your game is already hitting the refresh rate, why would you need to speed it up?

Anarchi''s game proves that D3DXSprite is a viable option for 2D. Unless you already have a better implementation handy (or you''re doing it for educational purposes) I''d recommend that people use D3DXSprite until it shows that it''s not sufficient, then look into an alternative. In a console-style 2D game on decent hardware, D3DXSprite will do just fine.

I could write something significantly faster than D3DXSprite, but I haven''t needed to. I may do it now for "research" purposes so I can publish something showing that D3DXSprite is fast, but if you need it, you can do it faster. Hell, I''d do it tonight but I have to get on a plane in a few hours and I haven''t finished packing.

Maybe I''ll write it when I get back from Tennessee (as long a bear doesn''t eat me).


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena
quote:Original post by Anarchi
DirectDraw is kinda getting on a bit, D3D8 is the way to go if u want to create a "good" 2D game since D3D supports scaling, rotation and alpha blending without loss of performance.

Ive been using D3DXSprite for my platform game and people have reported it running at 150FPS (GeForce) with full effects and parallax backgrounds.

If u like, come to my site and download the D3DXSprite wrapper at:

Downloads, D3DXSprite tutorial, New platform game: .-= The ZeroOne Realm =-.





This library looks like just the thing for a rookie like
me to get things going with Direct3D in DX8. I worship at
your feet mighy programmer! I know this isn''t the ONLY way
to accomplish a 2D game in DX8, but it sure looks the easiest
way. This way I can create things, study Direct3D, and avoid using DirectDraw.

Thanks! Kelly

quote:Original post by Anarchi
DirectDraw is kinda getting on a bit, D3D8 is the way to go if u want to create a "good" 2D game since D3D supports scaling, rotation and alpha blending without loss of performance.

Ive been using D3DXSprite for my platform game and people have reported it running at 150FPS (GeForce) with full effects and parallax backgrounds.

If u like, come to my site and download the D3DXSprite wrapper at:

Downloads, D3DXSprite tutorial, New platform game: .-= The ZeroOne Realm =-.





This topic is closed to new replies.

Advertisement