Archived

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

DirectX and 2D Games?

This topic is 6157 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

I was just about to start writing some DirectDraw 2D games when DX8 was released. To my surprise though, the new version had no DD, as we all know. What I''m now wondering, should I use DD to make my games, or learn this new Direct3D texture method? I am eager to begin coding but I am puzzled as to what method I should use to start making simple games. Any help?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I suggest DirectDraw7. It''s a little less abstract, and what you learn tends to be handy when you step up to DX8/OGL/Bob''s 3D API.

Share this post


Link to post
Share on other sites
It is actually very easy to do 2D graphics in DX8. You just need some good functions to call. If you want things like lighting, you have to use a view matrix, and that complicated things. I used to have an example coded without the matrixes to do 2D, but I think I lost it. But if you want to see 2D with a matrix, so you can do effects, check out my engine at www.ews.uiuc.edu/~jrbennet/ The only thing is, it is written in VB. The DX calls are almost exactly the same, so if you want to see how you would use Direct Graphics for 2D, go check.

I actually found it to be easy to do 2D in Direct Graphics, but thats only my opinion.

dragon_claw@usa.net

Share this post


Link to post
Share on other sites
Both? That''s what I do, use DD for drawing tiles and sprites, and D3D for effects (lighting, fading, etc.). If you''re not concerned with doing anything too fancy, I''d just stick with DirectDraw.



"We are the music makers, and we are the dreamers of the dreams."
- Willy Wonka

Share this post


Link to post
Share on other sites
if you already know c++ or c (learn c++ it helps) learn windows programming if you havent, then learn dx7. buy windows game programming guru to learn how to make little 2d games and get info on subjects such as ai, paralax scrolling, and other interesting things. dx8 i havent tried but ive heard screwy things about usind ddraw with it. good luck

quote from tryforfulluse(me<>): if you dont like programming dont program

Share this post


Link to post
Share on other sites
I guess I''ll stick to DX7 DD for the time being, until I can get my grubby little fingers into 3D. BTW, does anyone know where I can find the DX7 SDK? I have the DX8 SDK, and that just won''t do.
Thanks for all the help!

Share this post


Link to post
Share on other sites
the dx8 sdk has the dx7 (and all the others) libraries with it.



"We are the music makers, and we are the dreamers of the dreams."
- Willy Wonka

Share this post


Link to post
Share on other sites
Daddy Walrus,

So far, I''ve only used DirectDraw 7, even though I have SDK8 installed. The main reason is because there is a LOT more resources for learning DDraw7 out there right now than there is for learning DirectGraphics 8. If you are just starting out with DirectX, I would highly recommend learning DirectDraw 7 first because you''ll be able to find a lot more useful information about it.

I can''t wait for lots of great beginner''s tutorials on DirectGraphics8 to start popping up, until then, I don''t have the patience to figure it out myself with just the help files.

Todd M. Gillissie
gillissie@yahoo.com

Share this post


Link to post
Share on other sites
Well, if you want some C++ tutorials about how to use Direct3D 8 for 2D, you could have a look at my website:
www15.brinkster.com/furby100, or even www.directdeveloper.co.uk if the stupid domain redirection people have got round to doing their jobs!

There''s a DirectInput tutorial there as well if you''re interested.



Just because you''re outnumbered doesn''t mean you''re wrong.


sharewaregames.20m.com

Share this post


Link to post
Share on other sites
Okay, here''s what I really need to know, I guess: I have an understanding of DirectDraw6, but no actual programming experience with it. If I want to start making 2D games as a start, should I learn the DX8 method (the wave of the future), or will good ol'' DD stick around for a while?
BTW, furby, thanks for the link, it was your tutorials that inspired me to initially post ! I wanted to know if I should stick to DD or learn all about matrices and vertices etc., which I wanted to leave until later if I could (3D games).

Share this post


Link to post
Share on other sites
heres some info some ppl might find intersting it concerns why ms decided to drop directdraw. its a guy from nvidia speaking,
talking about should the programmeur have access to the frame buffer (ie directdraw)
quote:

The short answer is, "no".
The long answer...

The fact that DX8 has _eliminated_ this feature really casts doubt on it. It has caused an absolutely huge number of problems in D3D!

I see two major areas where people might be asking for this access:

- framebuffer access
- texture access

For framebuffer access, use DrawPixels and ReadPixels. Both are fast on GeForce. If it''s not fast, we can optimize it; there is no theoretical reason it would need to be slow, certainly.

For texture access, we are working on ways that texture downloads can be cheaper. There is no inherent limitation that causes TexSubImage to offer poorer performance than directly writing to video memory. There _are_ Windows platform restrictions that make doing this correctly very difficult.

Once we offer video memory pointers to apps, Bad Things can happen quickly. We have to sync the hardware before any such pointer is usable, which kills performance. We have to take some kind of system-wide mutex so that apps don''t stomp on top of each other if we decide to reorganize video memory.

We _cannot_ give you a pointer to the start of your framebuffer without taking a system-wide OS mutex. What happens if you move the window? The part of the framebuffer used by your app moves with it. That means we have to take a mutex that prevents any window events from occurring. In turn, this means that if you take the lock and never release it, the system will hang. Even if you take it for, say, a second, the system will suddenly become very unresponsive to input. NT does a better job than 9x here, but not good enough for us to trust apps. In fact, in certain ways, it is worse on NT, to the point where it may not be safe to do this at all.

Finally, direct writes to video memory are actually _not fast_ on most PC platforms today. In fact, this is the "Fast Writes" feature that some of you have heard about. Without that feature, writing to video memory directly is _much slower_ than writing to AGP and then pulling from AGP. (which only the driver is in a position to do). Even where they are implemented, in many cases, there are motherboard and chipset bugs that break things pretty quickly. Also, they only work for sequential writes (just like AGP write combining), and apps that read from video memory directly (don''t laugh, lots of old [and new] DirectX apps do this) get absolutely horrendous performance, since CPU readbacks over the AGP bus are absolutely disgustingly slow, and video memory is uncached.

The reason this works for vertex array range is that video memory vertices are best reserved for static vertex data. In fact, we specifically recommend AGP instead for dynamic data. Also, the synchonization hazards for vertex data are much simpler than those for framebuffer data -- vertex data is read only, and we have spun off the synchronization problem to the app (NV_fence), and there is no way that vertex data can get asynchronously relocated like framebuffer memory can.

There are genuine problems with the current situation, and we are working to solve them, but unfortunately there are platform limitations and there''s only so much time in a day. Furthermore, none of these limitations are inherent OpenGL limitations.

Offering these pointers (either FB or texture) to apps opens up the biggest Pandora''s Box in all of graphics programming. Microsoft did it, and they regretted that decision for years. I refuse to make that mistake again with OpenGL.



basically dont expect a new version of directdraw anytime soon if you''re happy with directdraw6 by all means use it though

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
What I said in another thread a while back, was that, graphic card venders just arent concerned with accelerating 2d anymore. Well since its easy to draw a quad, texture it and use alpha blending to get transperency.(all 3 are hardware accelerated) By placing the camera directly at the quads and using flat shading its just like doing 2d, you just move the quads along the x & y acis . Its a little more work then blitting but in the end it makes up for it. Plus you get access to some really cool effects like stretching and lighting, and you can even set the camera to perspective mode. This technique was used in Diablo2 and Im sure we''ll be seeing more of it. One other plus is that you get access to hardware antialiasing, rotating the quads is a snap too as well as stretching textures.



*****confused by earlier errors, bailing out....*****

Share this post


Link to post
Share on other sites
I can''t think of one good reason to stick w/ DX7. I was reluctant at first too, but it makes everything SO much easier. My initialization code is now 1/4 of the size, and so is everything else. And if you DO get into 3D, they''ve simplified that, too!

------------------------------------------------------------
He wants a shoehorn, the kind with teeth, because he knows there''s no such thing.

Share this post


Link to post
Share on other sites
I''m in the same predicament. I''m new to C++, but spent 2 months diligently learning the basics before I started DirectDraw.

I bought "Tricks of the Windows Game Programming Gurus" by Andre LaMothe and it''s a great book, but DirectX 6.0. After that, I have bought and have started Ian Parberry''s "Game Programming with DirectX 7.0". Also a great book, but these cover the basics. (Andre''s book covers more) I''m wondering now if I should just skip the 7.0 step since DirectDraw is history and move to 8? Problem is, not much information out there except the SDK presently. Andre Lamothe''s 2nd book that actually covers 3d is overdue for release. I wonder if he''ll cover DirectX 7.0 or DirectX 8.0?

All I can say is wow... That''s alot of Algebra, Trig, Geometry, Physics. I love math, but it''s time to dust off the college books and dive back in. Andre also gives you alot of helper functions to make things easier to program in DirectDraw 7, so that helps even more. Supposedly, Microsoft has also added some helper functions in Direct 3d.. d3dx I think. Dont know how helpful they are yet. I probably will finish these books then make the Direct3d plunge, but at the same time, this is taking alot of time to learn, (I''m a seasoned VB/ASP/java-script/SQL/HTML programmer which helps, but not alot) which is frustrating. Part of me wonders if I should just dive into the SDK, if it will be quicker? Either way, I appreciate the game developers alot more after my experience. I would recommend DirectDraw for now though. Alot of information out there for it, and the concepts are nearly the same when more DirectX 8 D3D info comes available.




Dave
_________________

There are three kinds of people in this world: Those who can count, and those who cant.

Share this post


Link to post
Share on other sites
I use the first DD interface and it has everything I need to make a good game. Someday I''ll have to learn DX8, but for now I enjoy being stuck in the past.

-----------------------------
C++ is great, but when is B-
coming out?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I use the first DD interface and it has everything I need to make a good game. Someday I''ll have to learn DX8, but for now I enjoy being stuck in the past.

-----------------------------
C++ is great, but when is B-
coming out?

Share this post


Link to post
Share on other sites