• Advertisement

Archived

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

How many surfaces in DirectDraw?

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

Hey, I just wonder how i should design my game, should every little piece of gameobject (with one little graphic/bitmap) have it''s own surface? ...Or can I do it in a better way? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
well, I''m using one surface per object (sprite, powerup et cetera) in my upcoming space shooter, i think the management for keeping 10 spriters per surface would be to un-comfy.. but hey, some smart-one-kickass-coder might have a way.

Share this post


Link to post
Share on other sites
In my animation object, I have one surface for the overall image and then one surface to which I blit the section of animation every frame. I haven''t really tested this, and am further into this project then I have ever been before.. but I don''t know of any performance issues involved.

How else would you have your surfaces? Create one surface and then pass a pointer to that surface to all the objects relating to it..

I don''t know.. I am thinking as I am typing here.. you can only learn as you go along.

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

Share this post


Link to post
Share on other sites
Maybe I could have one surface with all the animations for one gameobject, and in my animation class I would have a function called getCurrentAnimationGraphic(int frameNumber) which returns a rectangle. I can then use this rectangle to copy the part that I want from the whole surface...

Sounds like it should work?

Share this post


Link to post
Share on other sites
If you are using textures instead of directdraw7 you get some benefits such as: Alphachannel and faster performance.

Also using textures you can place all your objects on one big texture and use UV values to decide which to show at any one polygon and having them act as individual objects.

This saves you the Texture state change (which is expensive if used often) and the benefit of higher performance due to 3D hardware acceleration.

These are features in my API (this version is not released yet) but should be simple enough to implement for anyone using DirectX Graphics.

It is a bit more work involved in setting this up but the benefits far outweigh the use of DirectDraw.

____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites
I dont think that having all the graphics in one big texture is good. What if I have 1000 sprites and every sprite is 100x100 pixels. That would make the texture about 3000x3000 pixels large. Too much for the videomemory.

Correct me if I''m wrong.

Share this post


Link to post
Share on other sites
quote:
Original post by kobingo
I dont think that having all the graphics in one big texture is good. What if I have 1000 sprites and every sprite is 100x100 pixels. That would make the texture about 3000x3000 pixels large. Too much for the videomemory.

Correct me if I'm wrong.



You can have surfaces far bigger than that. It depends mostly on videomemory. Also having textures that are power of 2 in size is more efficient from a hardware optimizing point of view.
Most games today use this technique and is also recommended by the DirectX team.

____________________________________________________________
Try RealityRift at www.planetrift.com

[edited by - MichaelT on January 23, 2003 12:38:34 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Why is it always people give crap answers when someone asks a DirectDraw question.
"You should use 3D quads etc."

To answer the question: it''s quite handy to have more images on a single surface, especially for animation and easy disposal of related graphics. It doesn''t matter if you take a big surface or more small ones, the amount of vidmem used will be almost the same.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
Why is it always people give crap answers when someone asks a DirectDraw question.
"You should use 3D quads etc."

To answer the question: it's quite handy to have more images on a single surface, especially for animation and easy disposal of related graphics. It doesn't matter if you take a big surface or more small ones, the amount of vidmem used will be almost the same.



The reason for the quads is because they are better. And if they are better why should you not use it? I doubt very much you can offer any reason why you should not use the better alternative. There is nothing wrong in pointing out a better approach before the person is doing too much work and still have time to fix it. Also it very much matters if you are using one big or several smaller surfaces, one reason is waitstates amongst other things. If you do too much switching of any settings in the hardware you are not using your card effeciently and you will pay by having the card brought down on its knees doing nothing but switching states all the time. Really, I think you should not be so critical against 3d quads and they are not hard to learn either. Secondly you should listen to the advice the people from the industry is giving you (In this case Phil Taylor from Microsoft who is one of the head designers of DirectX) You should also not disregard suggestions but instead offer a better solution if you have one.


____________________________________________________________
Try RealityRift at www.planetrift.com

[edited by - MichaelT on January 23, 2003 3:10:57 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
So you says it''s better when your game doesn''t run on non-accelerated hardware? You might be surprised that most of the computers today have no 3D hardware yet. Your nice quad engine will run like slack on those.

It''s this crap that I was talking about.

500 x 2^X

Share this post


Link to post
Share on other sites
quote:

If you do too much switching you are not using your card effeciently and you will pay by having the card brought down on its knees doing nothing but switching states all the time.



In DirectDraw using surfaces I''m not switching states I''m I?
I''m only copy memory from one surface to another...

Share this post


Link to post
Share on other sites
quote:
Original post by kobingo
In DirectDraw using surfaces I''m not switching states I''m I?
I''m only copy memory from one surface to another...



Actually you are, every time you draw a different surface you are "turning the knobs" (to use Richard Huddys (former nVidia guru)expression) And that causes penalties. Although small they will eventually grow to become larger summed up together. It all depends on how much you are drawing of course and how many different surfaces you use. But just think about how much data must be sent over the system bus for the coordinates alone.
And every time you use the system bus is bad time, this is the first thing Richard is looking at when offering suggestions (or so he said anyway)

____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
So you says it''s better when your game doesn''t run on non-accelerated hardware? You might be surprised that most of the computers today have no 3D hardware yet. Your nice quad engine will run like slack on those.

It''s this crap that I was talking about.

500 x 2^X



Actually most computers today do have accelerated cards. I don''t know where you got this notion. To be quite blunt, they need to upgrade if this is the case because they would not be able to play anything released today decently. You must draw the line on how far back you want to offer support. It is simply not realistic to support non-hardware accelerated cards today.


____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites
Just to add my 2 Cents on this thread, I''m going to say that I''m with AP on this one. I''m not saying that it wasn''t a good that you offered the suggestion that maybe there is a better option out there. However in the title of the thread it say:

How many surfaces in DirectDraw? (Anyone can post a reply.)

Given this fact I would think that this programmer is looking for an anwser that involves "DirectDraw".. I have seen alot of threads that will tell anyone the differences between DirectDraw and Direct3D and I would say that if someone asks for something dealing with DirectDraw that they have probably looked at Direct3D and DirectDraw and decided that they want to make a game in DirectDraw for whatever that reason is..

Because of this I''m on AP side, the question was regarding DirectDraw and I would say unless you can answer the question, don''t post.. a better post might have been, this is how you would do it in DirectDraw.... however another alternative is Direct3D.. that way you answer the question and offer an alternative...

Please visit Turt99 Productions

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by MichaelT
Actually most computers today do have accelerated cards.


No they don''t. There''s masses of people out there with older computers. I''ll leave the statistics searching up to yourself.

quote:

To be quite blunt, they need to upgrade if this is the case because they would not be able to play anything released today decently.


That the most silly argument available in this matter.


Obviously, you have no clue whatever you''re talking about.

Share this post


Link to post
Share on other sites
MichaelT: So how big textures you can have nowadays if they can be far more bigger than 3000x3000 pixels?

My gfxadapters maximum texture size is 256x256. Naturally, surfaces can be far more bigger. I live in faith that requiring hardware support for texture sizes like 2048x2048 narrows down quite a bit your target audience. I know that my Voodoo3 is outdated, but what is the acceptable texture size requirement for adapters that can be called "modern"?

Ok, this was a bit off from the original topic, but..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
He doesn''t care.
Everybody should upgrade to match his requirements.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster

No they don't. There's masses of people out there with older computers. I'll leave the statistics searching up to yourself.
That the most silly argument available in this matter.
Obviously, you have no clue whatever you're talking about.



3d cards have been around since 95 and a few years ago you couldn't even buy a computer without one.

I do want to give you a thought to think about:
How many game developers today develop non accelerated games today?

Not enough.



[edited by - MichaelT on January 23, 2003 12:25:51 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I wasn''t talking about what is selling today, but the millions of computers already out there. There are enough people who like to play simple and straightforward games on that type of hardware, and more important, willing to pay for it. Not everybody in the world is about playing Quake you know.

If you feel different that''s OK with me. I don''t like and can''t afford to go into personal rants, so I will refrain from further comments.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
I wasn''t talking about what is selling today, but the millions of computers already out there. There are enough people who like to play simple and straightforward games on that type of hardware, and more important, willing to pay for it. Not everybody in the world is about playing Quake you know.

If you feel different that''s OK with me. I don''t like and can''t afford to go into personal rants, so I will refrain from further comments.



Well I am referring to the business situation today.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by MichaelT
If you do too much switching you are not using your card effeciently and you will pay by having the card brought down on its knees doing nothing but switching states all the time.


Is this really true? Especially for a 2D game. I tried this, drawing 10000 quads, once using the same texture and binding it once (ok, so I used Gl, but it''s still the same hardware) then again with two different textures being binded for each quad (i.e. 10000 texture changes)
The drop in FPS was from 65 to 61 on a large window. Hardly crippling performance.

It could be a bad test, but I just want to know if this is valid for this kind of thing (It will be slightly different for 3D)

One, more important in my opinion, factor is the use of the cache. Keeping flicking about with surfaces or textures doesn''t make good use of the gpu cache, neither does using large surfaces/textures. But then this depends on whether your program would make good use of the cache anyway by how the data is manipulated.



Also, a problem with using 3D hardware is the 256x256 texture size limit. Now, I know that modern cards can beat this, but unless you want to limit your market you need to respect the common limitations.

Share this post


Link to post
Share on other sites
quote:
Original post by MichaelT
If you do too much switching you are not using your card effeciently and you will pay by having the card brought down on its knees doing nothing but switching states all the time.


Is this really true? Especially for a 2D game. I tried this, drawing 10000 quads, once using the same texture and binding it once (ok, so I used Gl, but it''s still the same hardware) then again with two different textures being binded for each quad (i.e. 10000 texture changes)
The drop in FPS was from 65 to 61 on a large window. Hardly crippling performance.

It could be a bad test, but I just want to know if this is valid for this kind of thing (It will be slightly different for 3D)

One, more important in my opinion, factor is the use of the cache. Keeping flicking about with surfaces or textures doesn''t make good use of the gpu cache, neither does using large surfaces/textures. But then this depends on whether your program would make good use of the cache anyway by how the data is manipulated.



Also, a problem with using 3D hardware is the 256x256 texture size limit. Now, I know that modern cards can beat this, but unless you want to limit your market you need to respect the common limitations.

Share this post


Link to post
Share on other sites
quote:
Original post by Eepos
MichaelT: So how big (surfaces (edit)) you can have nowadays if they can be far more bigger than 3000x3000 pixels?

My gfxadapters maximum texture size is 256x256. Naturally, surfaces can be far more bigger. I live in faith that requiring hardware support for texture sizes like 2048x2048 narrows down quite a bit your target audience. I know that my Voodoo3 is outdated, but what is the acceptable texture size requirement for adapters that can be called "modern"?

Ok, this was a bit off from the original topic, but..


As big as there is memory available. FYI I once had a 4096*4096 texture (not surface) on my current card but that is another issue. What is important when having such large graphics is to use compression to save space. There is some fidelity loss but worth the savings you make. I target GF2 as a minimum equirement today. It is cheap so a user will not have to spend a lot of money on the card update and it is fast enough for almost all games available today. But my testing of my own code is on a 733 celeron GF 256 and ATI rage 8mb card which by todays standard is not even a minimum requirement card. But the development is on a ATI radeon 9700 pro. Just to be up to date. I know it is expensive but then I am not using the radeon card as a minimum target either.


____________________________________________________________
Try RealityRift at www.planetrift.com

Share this post


Link to post
Share on other sites
I think you guys may be surprised in the amount of older people buying very cheap computers with no 3D accelerated cards at all, because all they plan on doing is using email and playing very simple 2D games. I personally know people who have done just this within the past year. If they buy the machine from a place that listens to what the customer wants, they'll save them the couple $100 by removing the unneccesary 3D card.

So, it depends on the audience you are programming for. If you are making the latest 3D FPS, then obviously forget about non 3D accelerated machines, since everyone who will be playing your game is going to have a 3D card. If you are making a simple puzzle game, be nice to the potentially 50% of the people who are going to buy it who do not have 3D acceleration. People today are still buying the used machines of yesteryear for simple email and puzzle games for a couple $100. I really wish I could see some stats on just how many are doing this.

Jason Doucette
www.jasondoucette.com

[edited by - Jason Doucette on January 23, 2003 1:07:43 PM]

Share this post


Link to post
Share on other sites

  • Advertisement