World of Banished

Conversations => Suggestions and Mod Ideas => Topic started by: Abandoned on May 26, 2017, 06:55:05 AM

Title: A Sound Idea
Post by: Abandoned on May 26, 2017, 06:55:05 AM
Okay, everybody duck, here comes another idea, UFO alert.  cc has ducks that make duck sounds, do they not?  You can buy these ducks and put them in a pasture they fly above and make duck sounds when you are near.  Now we can have a 1x1 pasture square and we can have invisible objects.  Could we not have an invisible flying object with different sounds say church bell, or fog horn, or frog that player can place and use at their discretion?  That would be just ducky!
Title: Re: A Sound Idea
Post by: kid1293 on May 26, 2017, 07:59:36 AM
Nice! 8)
Title: Re: A Sound Idea
Post by: marmaladema on May 26, 2017, 08:57:20 AM
great idea!
Title: Re: A Sound Idea
Post by: Gatherer on May 26, 2017, 09:34:32 AM
It is an awesome idea!!!
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 12:15:06 PM
oh thanks  :) I hope that means there's a possibility of it working.  I have some great sound clips like trains, spooky, robin.  I did a lot of cool stuff with music and sounds in my Sim's neighborhoods.  Maybe the placement spot could even be marked with a stone with a fossil or something.
Title: Re: A Sound Idea
Post by: RedKetchup on May 26, 2017, 12:23:46 PM
Quote from: Abandoned on May 26, 2017, 12:15:06 PM
oh thanks  :) I hope that means there's a possibility of it working.  I have some great sound clips like trains, spooky, robin.  I did a lot of cool stuff with music and sounds in my Sim's neighborhoods.  Maybe the placement spot could even be marked with a stone with a fossil or something.

the way sounds work in this game is : or it is linked to a building like the "crowd effect sound" linked to an house. this kind of linked sound plays all the time continuously. so if you want to "happends" only some time, you need to add to it a very long "silence" at the end. for example 1 sec sound with at the end 1min59 of silence. the game will play this 2mins long wave countinuously.

the other way to call sounds is like the animals, but animals needs animations and it is when it switch from an animation to another (animals have a walk and 3 idles animations) there is a very little pourcentage chance (which you can control the chance) that the sound effectively "happends"
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 12:31:34 PM
hmm, sounds complicated. Maybe someone will give it a try though when they have time.  Maybe Luke will surprise us.  :)
Title: Re: A Sound Idea
Post by: The Pilgrim on May 26, 2017, 12:32:56 PM
I tried experimenting with this earlier this year. The concept of the two minute silence is great but the wave files (even for timed silence) add up quickly and lag sets in really fast. The solution in theory is a sequntial instance pattern in the code that calls for the sound ie. ... instanceaudio sound 1 sound1 sound1 sound1 sound2.  Where sound 1 is a silent track and sound 2 is the desired sound. I just couldn't get it to work because I am retarded when it comes to coding anything.
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 12:46:06 PM
@The Pilgrim I remember reading that on BL site.  What about mp3 format instead of wave?
Title: Re: A Sound Idea
Post by: RedKetchup on May 26, 2017, 12:59:09 PM
the game only accept xWMAEncode type of wave
and yeah instance audio is the way animals works.
the problem is the trigger ^^
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 01:08:19 PM
oh, too bad about format type.  For my Sims, the mp3 plays with window media player and I found that in the game I could use a shortcut and have the actual mp3 file out of the game to reduce file sizes.  I could also shorten mp3 file with music editor.  I doubt it would work the same converting to xWMAEncodetype wave.  I think an actual wave editor program would be needed if at all possible.
Title: Re: A Sound Idea
Post by: Bartender on May 26, 2017, 01:14:23 PM
I've been trying to experiment a bit with this at some point, but I couldn't get my sounds to work. Perhaps the settings of my wavs weren't right though, is anything known about that?
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 01:35:33 PM
@Bartender I hope someone can answer that.  I know absolutely nothing about the inner workings or coding in Banished.  Don't know how you guys are able to make all those fantastic mods.  I guess I was hope making thing invisible would then only mean simply swapping one sound file for another.  My sound file are all mp3 format and what I managed to do with them was only pretty simple basic stuff.  Made a big enjoyable difference to my game though.  :)
Title: Re: A Sound Idea
Post by: The Pilgrim on May 26, 2017, 01:59:31 PM
@Bartender   it must be 44.1khz @16-bits. I know the better standard is 48k @32 but the game won't support it.
Title: Re: A Sound Idea
Post by: Bartender on May 26, 2017, 05:46:46 PM
Thanks @The Pilgrim!

I managed to get it working, though I'm afraid the coding seems very limited. I don't think that it's possible to set it to play a certain sequence of files like you proposed, at least I don't see any hints at that in the code that is available.

I did find a way to make it randomly select a file out of a list of options each time the camera comes within the set range, though then it keeps repeating that sound until the camera moves away again. It's not ideal yet, but it might be a step in the right direction ;).
Title: Re: A Sound Idea
Post by: Abandoned on May 26, 2017, 07:36:56 PM
oh my gosh @Bartender sounds like a giant leap in the right direction.  :)  Is it limited to the time length of the sound?  if the sound is repeated more often, than a longer length of sound might be better, if that makes any sense.  Can the range be made smaller, that would limit the length of time the sound would be heard, less chance of it being annoying and if placeable by the player even better.  To occasionally hear a favorite sound would be an enjoyable treat.  :)
Title: Re: A Sound Idea
Post by: brads3 on May 26, 2017, 08:46:55 PM
what part of the code causes it to decide when a forester hits a tree and make the sound or a bs hits the anvil? can that part be manipulated. i understnad this will mean a worker is required to do it but there must a trigger in that part.
Title: Re: A Sound Idea
Post by: Bartender on May 27, 2017, 01:02:26 AM
@Abandoned The things you mention should all be possible in theory indeed ;). The sounds have to be looped, otherwise it stops after playing once and then never comes back. Making the sounds long enough could keep it from getting annoying indeed. Theoretically the random selection could give us more freedom to decide how often the sound is played, though it does depend on the camera behaviour of the player so it's not ideal. I'll do some further testing to see how well it all works in practice :P.

@brads3 All those 'occasional' sounds are linked to the animations. unfortunately the code that links the ingame events (for example a citizen starting to work in the blacksmith) to the animation (hammering animation and sound) is not available to us. We would be able to change the sounds for the currently existing animations, but we wouldn't be able to create new animation events ourselves.
Title: Re: A Sound Idea
Post by: Abandoned on May 27, 2017, 04:59:52 AM
@Bartender  :) that sounds very promising, thank you so much.  Random selection less often may be better than longer.  No stop start to loop, that would have made it easier.  If indeed possible I think the player will need to use sparingly with caution, less is more theory.   I will have to check my music editor to see if it can convert mp3 sound to that wav format, problem is I've been know to disappear when I go near my desktop.
Title: Re: A Sound Idea
Post by: brads3 on May 27, 2017, 08:26:09 AM
ok i'll brainstorm for a minute. i will take it that the sound for a forester  does not have to be the same for all foresters? like RED's fodder forester has adifferent sound than a normal forester.therefore, we could create a gatherer who runs around the map working at 20 different places and make sound.can the sound be different for each "work-place" or does it always have to be the same sound?how far apart can work places be? say you make a mod that is invisiable that has a worker go 30 spaces apart doing work at 4 compass points.he runs to the north point makes 1 sound. runs to the south point and makes a different sound?not practicle but possable?
Title: Re: A Sound Idea
Post by: Abandoned on May 27, 2017, 08:41:17 AM
@brads3 , I don't want a worker making sounds, the suggestion here is to have an invisible spot that will make it appear as if a sound is coming from an object like a church bell for a church, a train sound for a choo choo, a frog for a pond, a fog horn for a lighthouse, a spooky sound for a graveyard, since no sound can be added to those buildings or items.  There is no worker and shouldn't be a worker, workers and workplace already make there own sounds.
Title: Re: A Sound Idea
Post by: brads3 on May 27, 2017, 10:14:41 AM
don't bite me. i know. i did say it wasn't "practical". i was trying to think of a way to force the game to do that. a work-around to the coding.
Title: Re: A Sound Idea
Post by: Bartender on May 27, 2017, 01:44:56 PM
In the code the sounds are connected to the animations (so the actions), not to the specific professions. Any worker that uses an axe will make the same sounds while doing so, regardless of what their profession is. Ofcourse we can change the sounds of those existing animations, but we can't add any new ones of our own.

I'm currently trying to figure out how to get different types of buildings to play the sounds.. for the moment I've managed to change the sound of the houses, but those already have a looping sound in vanilla. I've found an old thread over at BL where the almighty ShockPuppet claimed that all buildings could play looped sounds using the same code, but I didn't get that to work yet. If anyone knows the trick ( @RedKetchup and @The Pilgrim might remember that thread), I could use some help ;).

EDIT: nevermind, I got it ;). Apparently buildings other than residency buildings can only play sound if it starts at the moment they are created. This does confirm that ghosted sound emitters are a possibility.
Title: Re: A Sound Idea
Post by: RedKetchup on May 27, 2017, 02:14:58 PM
if you read that thread over BL , i think i explained about i changed the temple one to put a bell + long silence and every 2 mins, cause there was 1min57 of silence... you could hear a church bell.

but like we said, it is a loop that continually run
Title: Re: A Sound Idea
Post by: RedKetchup on May 27, 2017, 02:19:16 PM
building has :

AmbientEmitterDescription ambientemitter
{
bool _addOnCreate = true;
SoundEffect _soundEffects
[
"Audio/Effects/BellEffect.rsc"
]
}


belleffect.rsc has:

SoundBuffer version0
{
bool _looping = true;
String _wave = "Audio\Effects\Bell30D1.wav";
}

SoundBuffer version1
{
bool _looping = true;
String _wave = "Audio\Effects\Bell60D2.wav";
}

SoundBuffer version2
{
bool _looping = true;
String _wave = "Audio\Effects\Bell120D3.wav";
}

SoundEffect resource
{
float _radius = 15.0;
float _innerRadius = 12.0;

Sound _sounds
[
{
//float _startOffset = 0.000000;
Buffer _buffers
[
{ SoundBuffer _soundBuffer = "version0"; float _volume = 0.8;  }
{ SoundBuffer _soundBuffer = "version1"; float _volume = 0.8;  }
{ SoundBuffer _soundBuffer = "version2"; float _volume = 0.8;  }
]
}
]
}

ComponentDescription ambient
{
// how often to update
UpdatePriority _updatePriority = 1;

// declare types that will be used
Description _descriptions
[
"ambientemitter",
]
}

//AnimAudioEvent event
//{
//SoundEffect _soundEffect = "resource";
//float _chance = 0.02;
//}

AmbientEmitterDescription ambientemitter
{
SoundEffect _soundEffects [ "resource" ]
}



the .waves are in the .zip
Title: Re: A Sound Idea
Post by: Gatherer on May 27, 2017, 02:22:43 PM
But can it be heard if the game window is not in the area? I think that is the main question here and the one that @Abandoend is asking as well. It should work the same as pasture sounds, only if the game window is on top of it.
Title: Re: A Sound Idea
Post by: RedKetchup on May 27, 2017, 02:23:00 PM
bell30D1.wav is 30 sec , in the end it DONG 1 time.
bell60D2.wav is 60 sec , in the end it DONG 2 times.
bell120D3.wav is 120 sec , in the end it DONG 3 times.

when in the area of the building like under the 50-80 tiles, you can hear it (of course when it dong lol although the silence too you hear it .... it is silence lol)

it was my variants made with SoundForge 11.0
Title: Re: A Sound Idea
Post by: Bartender on May 27, 2017, 02:43:48 PM
Thanks @RedKetchup ! I made some simple tunes for my tests, but it will be nice to have some fitting sounds to try :)! Your code looks pretty similar to mine, I just noticed that you changed the updatePriority to 1. Did you find any effect of that?

@Gatherer Yes, these sounds also fade out if you move away from the object. We can even control how far the sound carries, though I'm not quite sure how the game determines the 'center point' of this radius. For some reason the buildings I've tried seem to have their sound center point somewhere floating above the mesh, because zooming in on the building actually made the sound softer.
Title: Re: A Sound Idea
Post by: RedKetchup on May 27, 2017, 03:55:11 PM
Quote from: Bartender on May 27, 2017, 02:43:48 PM
I just noticed that you changed the updatePriority to 1. Did you find any effect of that?

i have no idea where it is from
Title: Re: A Sound Idea
Post by: Abandoned on May 27, 2017, 06:31:42 PM
@Bartender I checked my sound effects files and they are all mp3 format, my converter convert to mp3 not to wav.  Sound to me like you are making progress.  :)
Title: Re: A Sound Idea
Post by: Abandoned on June 01, 2017, 10:34:31 AM
@Bartender any progress on this ? :)
Title: Re: A Sound Idea
Post by: Bartender on June 01, 2017, 06:08:35 PM
I'm currently on a field trip so nodding is on hold for a week, but I'll continue this when I get back ;). I've almost completely figured out the code bits, the rest is just implementation.
Title: Re: A Sound Idea
Post by: Abandoned on June 02, 2017, 03:27:45 AM
Sounds great @Bartender , thank you
Title: Re: A Sound Idea
Post by: Abandoned on July 11, 2017, 07:43:54 AM
Don't forget about this, please. :)
Title: Re: A Sound Idea
Post by: Bartender on July 11, 2017, 02:55:50 PM
I haven't forgotten about this ;)! I'm just having a bit of trouble with the coding.. I got some sounds working, but not reliably.. sometimes they don't play, and their location also seems to change randomly.. I'll need to study it a bit more I'm afraid :P.
Title: Re: A Sound Idea
Post by: Abandoned on July 11, 2017, 04:24:40 PM
Just a reminder, no rush, @Bartender  :) that sounds like some progress, thank you.