C o d e o n t h e C o b :
The Sounds of Madness
by Chris "Kiwidog" Hargrove

Download this week's code files: cotc10src.zip (193k)

Be sure to read the license agreement before using the code.

"Every babe that weeps at your approach, every woman that cries out, 'dear god what is that thing!' will echo in your perfect ears." - Wesley, The Princess Bride

Thought you'd gotten rid of me? :)

As you can guess from the title, today I've added a small sound system to the codebase. After all, this wouldn't be a game project without sound, now would it?

For those of you who are wondering when I'm going to be finishing the DirectDraw stuff, remember I told you there was going to be another "interim" article before I went back to that topic, and this is that article. So I haven't forgotten about DirectDraw, it just hasn't had the focus (bad pun intended).

Anyway... what was I saying? Oh yes, sound. Even though the project now has sound code in it (with the addition of four files, snd_win.* and snd_main.*, as well as a new linkage to dsound.lib), I'm not going to spend much time in today's article explaining the internals of it. Like I said last time, you're grown-up boys and girls now, and you can read the code on your own. There's nothing particularly tricky in the sound system as it stands; snd_win holds the DirectSound-specific stuff, and snd_main is the primary interface. DirectSound is actually one of the easiest DirectX APIs to work with (unlike several others), and implementing support for it is pretty straightforward. Everything pretty much goes through DirectSound's "Secondary Buffers", and that's about it. Once you're past that point, the control structures used at a higher level are generally up to you. In my case, I've written the sound system (by sound system I mean pure "sounds", i.e. sound effects, not music which is a separate thing) to do everything through sound handles and play handles at the lower levels, and then sound slots and resource manager IDs up in the main section (that's right, the resource manager rears its head! :) All in all the implementation is pretty straightforward, with snd_win.cpp being no more than 500 lines.

So there's not much to talk about in the sound department, and I'm going to keep this article short and to the point as a result. But first I'm eager to discuss the game project itself, and our plans for it. Today COTC hits the magic article number 10. With the addition of sound, the soon-to-be completed graphics subsystem, and networking not far down the pipe, it's starting to get close to game time. So I've been working up some ideas in my head, and I've taken suggestions from people as often as I possible.

The preliminary decision is to go with a small-scale strategy game, with less complexity than RTSs but still plenty to go on. I'm thinking along the lines of "Worms2 meets Archon" if you know what I mean. We're currently on Article 10, and my goal is to have a small game of this form up-and-running and reasonably solid by Article 20 (if not entirely polished, remember there's only one guy on this project), at which point things will get wrapped up.

So, assuming there's about 10 articles targeted until completion, what all would you most like to see work its way into the project? You can figure that at least 5 of those articles are definitely spoken for, but there are several left over that might be open for additional features or topics of coverage. What would you like to see dealt with? Anything in particular you'd like to see make it into the game? I'm all ears; drop me a line or post a message on COTC message board and give me your thoughts.

Until next time,

Chris Hargrove

- Chris"Kiwidog" Hargrove is a programmer at 3D Realms Entertainment working on Duke Nukem Forever.

Code on the Cob is 1998 Chris Hargrove.

Reprinted with permission.

Discuss this article in the forums


Date this article was posted to GameDev.net: 10/29/1999
(Note that this date does not necessarily correspond to the date the article was written)

See Also:
Code on the Cob

© 1999-2011 Gamedev.net. All rights reserved. Terms of Use Privacy Policy
Comments? Questions? Feedback? Click here!