I've almost got the sound engine done for you Shakti and I've got some quadtree code working quite well. As for the error you guys are getting it's most likely because your computer either doesn't support a certain function or your video drivers are puking on it.
It works fine on my machine. I had the same problem with NVidia 56.64 drivers - my 3D failed to init every time..even in dxdiag. Not sure why.
Lurker, I thought you were pulling my chain with that Data/Graphic thing. :o
I checked the EXE in Hex Editor, and what was there?! a directory.. Data/Graphic.... whoops.. thanks dude.
Perty cool man, I like how they remember their destination even after they stop for a while in traffic. Awesome. :)
Yes I get the idot of the day award!
Yeah Shakti was hard at work on that one and I'm glad to see he got it working.
Thnx for your comments. Yes the folderstructure is very important. This weekend I will try to work on them shooting, improve my selectioncode (thnx to Bubba for the idea), and I will try invoke some more things that should happen when They are stuck against another tank. And a special thanks to Bubba who is helping me with this project!
Here is a little update on the work:
I have improved the multiselection code by tons (that is the code that handles the selectionbox). I tried it with 10000 units and I was able to select them all in 0.03 seconds :D ! I dont know if that is very fast but to me that is really fast. With my old code I didnt have the patience to wait for it to finish :)
It runs pretty smoothly. I ran it with wine on Linux. Good work.
Here is my newest demo.
Ive improved my selectioncode (I posted about it in a reply above) and Ive added shooting, so now you can shoot those tanks :) .
Sound engine is near completion. Only need a way to effectively handle DirectMusic segments. Music is ready to go as well. 3D sound is also ready.
Will provide you with the sound code as soon as I make sure it all works and shuts down correctly returning all allocated resources and COM objects.
RGR that Bubba! I really thank you for helping me with this little project of mine!
Ok Shakti I've got some code for you to test. I won't post it here but it is a simple CDXAudio class.
Here is how you use it (as of version .10):
Lots of work left to do on it. Currently it only plays one sound at a time which is no good. However I am implementing Audiopaths as well as 3D sound immediately. This code is simply to test and see if it works on your system. I attempted to make the interfaces to the class very straightforward and extremely simple.
could you include a readme, or post a quick description of how to play? I've got the guys moving around the big green square, but I see you have a bullet image, which leads me to believe I can get into some action some how.
Ok bubba, Send it to me the next time you catch me online.
As for gameplay the only thing you can do now is shoot those tanks, no sides or anything. To shoot another tank select a tank and rightclick on another tank.
Ok, Shakti, quick update.
I've done a lot more research and a thorough read of my DX9 audio book. Here is my current idea for your sound engine. I will need to work closely with you on some key issues but more on that in just a bit.
I'm not sure how much you know about DirectAudio programming or how it all works so I'll keep it fairly simple...but you must know some of it to use it.
First of all DirectAudio is both DirectMusic and DirectSound combined. With the advent of DirectX 8.0 they were combined into DirectMusic. What this means for us is that it is easier to get sound up and running.
Here are some key structures in the sound design:
DMOs -> effects like reverb, etc.
3D sound positioning
In the design of this sound engine I separated DirectMusic and DirectSound - or succintly the music and sound effects use two different classes. The reasons for this are a bit involved so I'll leave that for later.
To get this system working you need to understand audiopaths. Audio paths are quite simply the path that any sound(s) take to get to the final PCM wave data that leaves the soundcard and goes to the speakers. This includes effects, spatial positioning, panning, etc.
In short each tank or CSoundEmitter as I called it is assigned to one of 32 different Audio paths. However this does not leave an audiopath for music which I'm sure you'll want to add later. We need to get together on how you want this thing designed. Don't get an audiopath mixed up with how many sounds can play. Any number of sounds can play on any audio path an unlimited number of times...however there are only 32 3D hardware sound buffers. This means that you and I have to figure out a way to prioritize sounds.
One solution is this:
1. Calculate the squared distance from any CSoundEmitter to the camera...or the center of the screen.
2. If distance lies outside of a certain value then that object has a very low priority and probably will not be heard and as such will not be assigned an audiopath.
3. For CSoundEmitter objects that do pass the test we then assign it an audiopath.
For special reverb effects, etc. I suggest we create 2 or 3 audio paths that have these DMOs already on them. When we want the sound effect to play with reverb effect...we simply call Play with that audiopath pointer. Note that any sound that is played on that audiopath will have the reverb effect.
The 3D sound will be taken care of simply by updating all CSoundEmitter objects that have been assigned an audiopath...and thus are audible....and then calling the CDXAudio function to set the position of the sound in 3D space. Don't worry about 2D vs 3D. If we position the camera directly above the playing field then that is the camera's Z coordinate, not its Y. Since Z increments into the screen on Direct3D and decrements in OpenGL - we simply take the absolute value of the camera height from the playing field and use it for Z. X and Y will then correspond correctly with the camera's orientation and the sound's will be correct.
What this will do is when a tank begins to move you may fire off one segment that is the sound of the tank 'starting up' or beginning to move. Then we transition to another segment that is the tank moving. I can alter the pitch of the sound to simulate the engine revving up and revving down. As the tank moves off center of the screen....it's sound slowly fades away. When the tank moves out of earshot of the camera....it is no longer heard and its audiopath is unassigned. We may wish to make the sound quad much larger than the visual quad of the camera so that offscreen gunshots, explosions, etc... can be heard....albeit barely heard.
I simply cannot go into every detail here as there are tons of them. But I can program the entire 3D sound engine for your game as well as the music portion...when we get there. We, however, need to talk much more about the design and goals of the game and the types of sounds you want as well as the memory footprint you will give for the sounds (how much RAM you'll allow for sounds).
When we get it working with quality sounds (might have to purchase these) and music (I have some composers I know that might be able to help)....it will sound like it was professonally done.
I will get teamspeak up ASAP so we can get to work on the sound engine and so that I can send it to you for testing.
I'm also working on an editor for editing maps to be used in the game.
Also, have you implemented waypoints yet and are you using DirectInput? I've got a very rudimentary DirectInput class that handles keyboard and mouse input. Your waypoint code could look something like this:
void CObject::AddWaypoint(DIMOUSESTATE &mstate)
Pointers might be goofed up and I haven't tested it buy you get the idea.
Ok rgr that bubba, I will try to catch you ASAP! As for the waypoints I dont have that code ready, but I do have a basic idea of how to do it but I will probably have to rewrite big parts of the moving code but it shouldnt be too hard.
Edit: Scratch the part about not having the waypoint code, its there, its working but it aint pretty! I am really happy that I got this one working!