Jump to content
  • Advertisement

Archived

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

kobingo

How many surfaces in DirectDraw?

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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!