[color="#4B0082"] Be sure to read the license agreement before using the code.[/color]
[spoiler][font="Courier New"]"Code On The Cob"
Source Code License Agreement
Copyright (c) 1998 Chris Hargrove
The licenser, Chris Hargrove, is herein referred to as the "licenser".
This license agreement, the source code provided, the executable(s)
compilable thereof, and all other contents of the distributable archive
including the archive itself are herein referred to as "covered" by this
Reading, compiling, running, or otherwise using any item covered by this
license constitutes automatic acceptance of the rules described in this
license, as precedes and follows in the remainder of this file.
All items covered by this license agreement are the sole property of the
licenser, and are licensed as-is to the public for educational use only.
No items covered by this license may be distributed in any archive other
than that which is originally provided, and said archive may only be
distributed via mediums that require no cost for retrieval of said archive
other than those required by the medium itself and its direct providers
thereof. None of the items covered may be modified or duplicated in any
form, with the sole exception of modifications and duplications made by
licensees for educational use only. Said modifications and duplications
may only be made to source code covered by this license, and all said
modifications and duplications become the immediate and sole property of the
licenser. The licenser is not responsible for any damages, direct or
indirect, that may result from usage, proper or improper, of items covered
under this license.
Any violation of the above rules must be authorized via express written
consent of the licenser, or it may be punishable by civil legal action.
THE LICENSE PARAPHRASED:
I'm writing this code so you can read it and learn from it. If you
understand it and find some bits and pieces useful as-is, feel free to make
use of them. But don't go taking credit for that which is not yours, and
don't go trying to make a buck off of my effort directly without my
permission. I'm doing this for your personal growth, not for your wallet
or your ego. In general, don't screw me and I won't screw you. The spirit
of sharing information is why I volunteer my already limited time to write
this series. That same spirit is behind a lot of what I and many others have
learned, and what we're all still learning to this day. This license is
basically my way of saying that I don't want some random guy out there to
ruin it for myself and everyone else. Be ethical.
"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"Kiwidog" Hargrove is a programmer at 3D Realms Entertainment working on Duke Nukem Forever.
Code on the Cob is (C) 1998 Chris Hargrove.
Reprinted with permission.