Design Questions - Variety Pack #1

Started by
1 comment, last by load_bitmap_file 19 years, 3 months ago
1. How is your game's sound system set up? Right now I have LoadSound(), which loads a sound file from the specified file path and stores it in a std::map with the sound file and its identifier, and PlaySound(), which plays the sound loaded by LoadSound() (PlaySound() is passed the file path of the sound, the loaded sound's identifier. It's a little wonky making calls like PlaySound("\sound\enemy\explosion.wav")). It seems to work fine, but is there a better approach? 2. What is a good maximum texture size to use, to keep compatibility with older video cards? (I'm making a 2d sidescroller, so it'd be nice if a bunch of people with older computers could run it.) 3. When DirectX tutorials (and the Forum FAQ) say not to switch textures, what exactly does that mean? It's not possible to store every single image in a game in a single texture, right? 4. What sort of data structure would you recommend for bounding box collisions? (Or do you roll your own?) I don't think a RECT can be rotated (my original plan). 5. (This isn't really DirectX, it's just C++). With function pointers, should functors always be used instead of raw function pointers? Right now my crude parser's AddCommand() takes a raw function pointer instead of a functor, I'm wondering how bad the lack of optimization is. Sorry if this seems like a lot of questions (it is). [Edited by - load_bitmap_file on February 9, 2005 5:46:16 PM]
Advertisement
Quote:Original post by load_bitmap_file
1. How is your game's sound system set up? Right now I have LoadSound(), which loads a sound file from the specified file path and stores it in a std::map with the sound file and its identifier, and PlaySound(), which plays the sound loaded by LoadSound() (PlaySound() is passed the file path of the sound, the loaded sound's identifier. It's a little wonky making calls like PlaySound("\sound\enemy\explosion.wav")). It seems to work fine, but is there a better approach?


Typically the sounds themselves would be stored as data and you'd load it. So if you load the data that defines a bad guy, bad_guy->death_scream might hold the name of the sound he makes when he dies. Doing things this way also means you can change stuff without recompiling.

Quote:
2. What is a good maximum texture size to use, to keep compatibility with older video cards? (I'm making a 2d sidescroller, so it'd be nice if a bunch of people with older computers could run it.)

It depends on your definition of "old". Old Voodoo cards can only do 256x256, but anyone who cares at all about games will have better than that.

Quote:
3. When DirectX tutorials (and the Forum FAQ) say not to switch textures, what exactly does that mean? It's not possible to store every single image in a game in a single texture, right?

They don't (or shouldn't) say NOT to switch textures, just to minimize the switches. If you have 5 objects that use TextureA and 5 that use TextureB, then it's advantageous to draw all of TextureA's object before moving on to TextreB's.

Quote:
4. What sort of data structure would you recommend for bounding box collisions? (Or do you roll your own?) I don't think a RECT can be rotated (my original plan).

Sphere's work quite well, though technically arent' bounding "boxes".

Quote:
5. (This isn't really DirectX, it's just C++). With function pointers, should functors always be used instead of raw function pointers? Right now my crude parser's AddCommand() takes a raw function pointer instead of a functor, I'm wondering how bad the lack of optimization is.

Are you having performance problems? No? Then don't worry about it.
Stay Casual,KenDrunken Hyena
Quote:Original post by DrunkenHyena
It depends on your definition of "old". Old Voodoo cards can only do 256x256, but anyone who cares at all about games will have better than that.


If a max size of 256 x 256 is really old, 512 x 512 should be enough for what I need to do.

Quote:
They don't (or shouldn't) say NOT to switch textures, just to minimize the switches. If you have 5 objects that use TextureA and 5 that use TextureB, then it's advantageous to draw all of TextureA's object before moving on to TextreB's.


Oops. I was confused about that >_<

Quote:
Sphere's work quite well, though technically arent' bounding "boxes".


Characters in 2d platform games are more often blocky than circular, so I think bounding boxes would be a better approach. *bump* for more thoughts on a data structure for this.

EDIT: I can't rate you up, Drunken Hyena. I've already rated you :/

This topic is closed to new replies.

Advertisement