Wolfenclone

The Partridge Family were neither partridges nor a family. Discuss.
Firepath
Posts: 77
Joined: March 10th, 2018, 11:53 pm

Re: Wolfenclone

Post by Firepath » November 24th, 2018, 2:00 am

chili wrote:If you're interested, I also did a stand alone video for adding mp3 support to the mix. It's not super hard, and makes your download size a lot better if you have music.
Cool! Thanks Chili, will check it out eventually!

I can't wait to show some progress, when I have some... sigh. Anyways, back to doing something completely unrelated lol!

Firepath
Posts: 77
Joined: March 10th, 2018, 11:53 pm

Re: Wolfenclone

Post by Firepath » December 4th, 2018, 9:15 am

I haven't done much lately. I spent a couple of mornings before work getting a submix voice put in between the 64 source voices and the master voice, and learning about XAudio2 a bit more.

I also tried getting into X3DAudio but couldn't get around it. The MS documentation is pretty good, but kind of short. I'll need to build a simple system with 1 source voice and 1 master voice to get the 3d stuff working. It is pretty cool, you use the 3d stuff to work out the parameters (volumes, pitch shift) to adjust the XAudio2 stuff to simulate spacial sounds and ears. Its idea is based on sound emitters and listeners. You position them in the 3d space and tell the x3d where they are in relation to each other and their velocity (for doppler) and it poops out values to adjust the audio system.


EDIT: Oh! I forgot to mention - I think part of the reason I couldn't get my head around getting the 3d happening is because the sound system chili designed is great for giving sounds you want it to play whenever you need to and it will accommodate BUT... (and this isn't criticism, it is a great design and it is up to me to build what I need for my purposes) it doesn't seem to be (without fairly heavy modification or building-on) good for tying sounds to entities.

My player avatar always needs to emit footstep sounds (for example), and perhaps says things as well, and maybe makes a fireball noise when they shoot one. For this purpose it seems like you need to keep a track of those sounds and not just throw a sound at the sound system to play and forget about it. I might need a handle on the sound being played to stop it if need be or to keep that particular sound emitting from a specific location.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Wolfenclone

Post by albinopapa » December 4th, 2018, 6:40 pm

Some of chili's tutorials do show how he encapsulates sounds being emitted during events. He uses a resource class to store the sounds that need to be played and the entities either get a pointer/reference to this resource class or it's a singleton I can't remember which, actually I'm almost positive it's a singleton. Anyway, each entity is responsible for playing their own sounds including footsteps if I recall correctly.

If not the tutorials, then check out his Project Twin videos, I believe he might cover it in there.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Wolfenclone

Post by albinopapa » December 4th, 2018, 6:49 pm

...the sound system chili designed is great for giving sounds you want it to play whenever you need to...it doesn't seem to be...good for tying sounds to entities.
So in the first part you say it all in my opinion. It allows you to play sounds when you need it to, so why wouldn't it be good for tying sounds to entities? When you move, you play footstep sounds, when you fire your pistol you play pistol sounds, when your character gets hurt you play your "AAAHHHHGGG!!" sounds.

I say all this, but I personally haven't gotten to use it all that much, so I could be missing something. As for the 3D audio stuff, I most certainly haven't gotten into that, but it sounds interesting. Perhaps you can find a way to create an addon or modify chili's audio class in such a way that users might easily supply said "emitters and listeners" locations and a Sound object.

Anyway, good luck and keep going.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Firepath
Posts: 77
Joined: March 10th, 2018, 11:53 pm

Re: Wolfenclone

Post by Firepath » December 5th, 2018, 10:05 am

albinopapa wrote:
...the sound system chili designed is great for giving sounds you want it to play whenever you need to...it doesn't seem to be...good for tying sounds to entities.
So in the first part you say it all in my opinion. It allows you to play sounds when you need it to, so why wouldn't it be good for tying sounds to entities? When you move, you play footstep sounds, when you fire your pistol you play pistol sounds, when your character gets hurt you play your "AAAHHHHGGG!!" sounds.

I say all this, but I personally haven't gotten to use it all that much, so I could be missing something. As for the 3D audio stuff, I most certainly haven't gotten into that, but it sounds interesting. Perhaps you can find a way to create an addon or modify chili's audio class in such a way that users might easily supply said "emitters and listeners" locations and a Sound object.

Anyway, good luck and keep going.
I feel the sound system would need to work fairly differently to be good for holding the sound channels for each thing that emits sound in each thing.

The problem is when 3d or positional (even 2d) comes in. A monster might be roaring but depending on its location you need to modify THAT sound (that channel / voice) to make it sound like it is coming from where it is. (So quieter when further away, left / right balance, etc.) If you just give the roar sound to the sound system you lose the ability to position / adjust that channel.

I think a system where you request a channel from the sound system as part of an entity's setup would be needed. The entity hangs onto this channel and what happens to the sounds playing through it can be managed from the context of the entity. You could still have the same functionality to play "sourceless" sounds that just play (menu / hud sounds for an example).

I guess now I have a more clear idea that it needs to work this way, so the system seems appropriate, but needs the ability to hand out channels. I think this is probably a short-sighted approach though as there are limited channels and would run out quickly.

I was looking at submix channels (and need to look further) thinking that I could submix all channels that one entity has (footsteps, roaring, gunfire, etc.), into a single output channel. This could then have ALL the 3D positioning, etc. modifications applied to it in one step instead of on each input. Then this channel is given to the sound system to be played. I guess if the queue of sounds exceeds the max channels it just doesn't get played. I guess this submix channel could be fed into one of the "play this" channels that the sound system already has (though I think they would need to be submix channels to take a channel as an input). If there are none free, it doesn't play it. I need to look at the SoundSystem and Channel classes. You see this is the bit where I think it needs to work significantly differently than what I currently have.

Anyways, I'm circling around and around, but getting a clearer understanding and idea of what I need. Putting my thoughts down is helping straighten them out. I think maybe even "play sound" could return the channel which can be held and managed externally. I think this would remove being able to lump them all into a single submix channel, but maybe not. The single submix channel may not be a problem, though.

Maybe "play sound" returns a submix channel and if you have one already and want to add another sound to play (call "play sound" again), it tacks it into the same submix channel for you. Yeah that sounds good. I'm not sure if it works that way, but that's the direction I want to pursue.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Wolfenclone

Post by albinopapa » December 5th, 2018, 12:27 pm

Sounds like you need to setup something like a call graph. Something that you send sounds through that transforms them from plain sound data to dampened/amplified, then positional ( front left/right, rear left/right ) then sent to the channel to be played by the sound system.

A resource manager could still hold all the sounds required for a particular level.
Each entity emitting sound would just pass it's position and sound to be played to the first node of the call graph.

As far as sub mixing, and channels go, I'm not even going to try.

But, you do have stuff that as you say has no point of origin like BG music and other ambient sounds like maybe thunder, water dripping in a cave and such that might need different call graphs for transformations like echo and reverb, or maybe dampening because the player is inside while a battle rages outside.

It is nice to put thoughts down in writing actually, or even saying them out loud. It can allow you to step back and see what might work or what a particular problem might be. My wife just looks at me all funny when I do this, and then something clicks and she's like "glad I could help" even though all she did is listen.

I hope you continue to share your journey into the 3D audio realm, it would be nice to have a good reference to refer to.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Firepath
Posts: 77
Joined: March 10th, 2018, 11:53 pm

Re: Wolfenclone

Post by Firepath » December 6th, 2018, 9:23 am

albinopapa wrote:A resource manager could still hold all the sounds required for a particular level.
Each entity emitting sound would just pass it's position and sound to be played to the first node of the call graph.
Ha! I had this (almost) exact thought after I posted (when I was going to bed). A manager with the sound system in it could manage the sounds, with info about the entities that emit the sounds needed for 3D processing. This gives me the level of separation between game things that emit sounds and the sound system. I wasn't comfortable with having to manage some level of sound in the entities, seemed wrong.

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Wolfenclone

Post by albinopapa » December 6th, 2018, 9:57 am

One of the concerns I suppose I had with your original idea was if there are 1,000 entities, some might need the same sound, your options would be to use a shared_ptr, use a resource manager class or have several copies of the same sound. Shared_ptr isn't too bad an idea, but using a resource manager with the singleton pattern seems to be a descent option as well.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Firepath
Posts: 77
Joined: March 10th, 2018, 11:53 pm

Re: Wolfenclone

Post by Firepath » December 24th, 2018, 2:51 am

I'm back again gang-stars. This time with something interesting.

Being the Xmas holidays I've worked on this project quite a bit for a couple of days. Actually I split off to a simpler project (cloning Commander Keen, which I'm calling Overzealous Max) as the 2D game is very much like the level designer I am making and sound is a lot simpler - just play sounds when things happen.

Buuuttt everything I've worked on is pretty much still Wolfenclone so I'm still working on this.

I signed up to GitHub with a free / public account and put this project on there. As it is built on Chili's framework (and using Wolfenstein's assets, though they can be substituted) it is purely an educational thing. So I thought I'd make it easier on myself in terms of backing up and also being able to share with you guys.

https://github.com/Firepath/Wolfenclone

Since last time I added a File / Save menu item to my menu bar. I had some bugs (still have one that I'll get to one day) in the menu bar that I had to fix, that only showed up when I had more than one menu on it.

I had to add the ability to load the map before I could save it, so that functionality is there too.

The loaders I had for the various settings inherited from a base loader class. I rearrange everything so the base loader inherits from a base file accesser class. Saver (my base class for saving) also inherits from this so I get to share some functionality. I thought that was kinda neat.

I spent some time working and fleshing out the design of my map fixtures and have an inheritance tree that I feel works well to give the properties and functionality I need with minimal code. Check out Fixtures.txt in the Notes filter / folder for my design there. I still need to add other things to it, but for now I need to complete what is there first.

I also fixed the drawing and map enclosing logic of pickups / decorations as they will draw as sprites not 3D. Doors were also just Walls so they have their own type now that doesn't enclose like walls do, so they act more correctly in that regards.

I want to extract some more treasures and perhaps other decorations / pickups like health and ammo and flesh out the insert menu with them.

So check it out, have a look at the rage and naive code in my commits. I'm using VS 2017 if you want to clone it and have a look at it / tinker.

I left the assets I'm using in there, I was going to remove them but then it wouldn't run for anyone else, so what's your opinion on that?

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Wolfenclone

Post by albinopapa » December 24th, 2018, 8:15 am

Code: Select all

		switch ( Mode )
		{
		case FileIOConstants::IOMode::Fixture_Decoration:
			fixture = std::make_unique<Decoration>( name, type, texture );
		case FileIOConstants::IOMode::Fixture_Door_Dark:
		case FileIOConstants::IOMode::Fixture_Door_Light:
			fixture = std::make_unique<Door>( name, type, texture );
			break;
I think I found a bug. The first case block doesn't have a break for Fixture_Decoration, which means it falls through and overwrites the fixture with a unique_ptr to a Door rather than a unique_ptr to a Decoration.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply