Music and Sounds

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Music and Sounds

Post by LordGarth »

Hello,

Is it possible yet to input music and sounds into the editor when making a game.

Thx,

LordGarth
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

There are different ways of doing different types of sounds. What exactly are you trying to do?
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Hello,

I would like to put in mp3 music and mp3 sound effects like lightning and horror type sounds.

I have downloaded them already and I just would like a good tutorial on how to put them into the game while using the editor strikes back program.

Thx,

LordGarth
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

You need to write some Lua code first to set them up. Then you can access them in the editor. I don't have time to do that for you today, perhaps Sophia can give you some pointers...
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Okay

Thx,

I also see that the wallwriting does not work right. What I type is not shown on the wall in game.

Thx,

Gary
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

LordGarth wrote:I also see that the wallwriting does not work right. What I type is not shown on the wall in game.
Are you typing your message in UPPER CASE?
You'll need to do that if you want the wallwriting to show up properly. It works fine in the test_dungeon.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

I will try that

Thankyou

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Hello,

The all CAPS worked and I am still hoping to get music and sounds into the game.

Thx,

LordGarth
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

What's wrong with music and sounds?

If you just need instructions on how to do it, take a look at this post:
http://www.dungeon-master.com/forum/vie ... 53&t=29191
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Where should the sounds files be stored.

Thx,

LordGarth
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

You can simply put them in the same folder as your dungeon lua files. Or if you want to be more organised, you can put them in a subfolder and define them like this:

Code: Select all

snd.orc_move = dsb_get_sound("ORC_MOVE", "foe/orc/orc-step.wav")
Music however MUST be in your root dungeon folder, you can't put it anywhere else. Use something like this lua command to play music (you can put it in a function that can be called from a trigger in ESB):

Code: Select all

gt_music_handle = dsb_music("mymusicfile",true)
The "true" parameter means the music will loop. Note that you don't have to put the extension; your filename might be "mymusicfile.mp3", but you can leave the .mp3 off.

See this DSB Wiki page for more information; http://dmwiki.atomas.com/wiki/DSB/Expos ... _and_Music
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

How exactly do I edit the amibient sound icon in ESB. I am trying put in an exvar similar to what is in the test dungeon.
sound = "thunder1" But it says illegal name. Must be alphanumeric.

Thx,

LordGarth
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

That's correct, you need an exvar: sound ="name_of_sound"

Maybe it doesn't work if there's a number in the filename (despite the error you got)? Try it just with letters in the filename?
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

You don't need to type the "sound =" part.
First, define a new exvar called sound. Then, it will let you type in the value. Put in "thunder1", including the quotes, so Lua and DSB know it's a string.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Okay,

It would not play the sound. Will it play wav files? Also in the past there was a way to make a trigger invisible, without the pad on the floor. Is there still a way to do that?

Thx,

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Wont play mp3 either.

It says untriggered nil

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Okay

In the graphics folder, I added snd.thundera = dsb_get_sound("THUNDERA")
I does play the sound and it still says untriggered nil. LOL

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

I have used music the same way as sound and it works.

YAY

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Hello,

The music seems to decrease in volume as I move away. Is there a way to keep it at the same volume.

Thx,

LordGarth
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

The reason it decreases in volume is because you're playing with an "ambient_sound" object, which is designed specifically for that purpose.
If you want to just play background music, you'll need to call dsb_music instead.

You can do this in a few ways, but the simplest for what you're doing is still using an "ambient_sound" but specifying music instead of sound as your exvar. Because it streams the music file, you'll need to specify the filename itself (without an extension) rather than an entry in snd. As such, you won't need to dsb_get_sound your music, because DSB streams it right off the disk. For example, if you want to play mymusic.mp3 just set your music exvar to "MYMUSIC".

As for the "untriggered nil" issue, Gambit ran into this too. Can you tell me what you did, possibly with an ESB screenshot? Even better, if you can recreate the problem in a very simple dungeon, I would like to see that dungeon. I've tried to reproduce the problem and I so far haven't been able to.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Thx,

Music works great now.

I am using a trigger from floorflats menu. OPBY party and activate target. I am editing the main files as I do not want to have to edit files each time I make a game. I will have to send you the base file and dungeon file. The dungeon file is 116MB with all the music and sounds I have to have in that folder.

If there is a place I can upload the files please let me know.

Also is there a place where I could download some extras like graphic files.

Thx,

LordGarth
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

LordGarth wrote:I am editing the main files as I do not want to have to edit files each time I make a game.
If you mean you are directly editing files in base, then this is not a very good idea if you want to distribute your dungeon.
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

^^^ Yep, Sophia is right. LordGarth, DON'T edit the base files! This is not the way to do it. You won't be able to distribute your dungeon if you work that way.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

In Lua, redefining a variable or function simply overrides it.
So anything in the base code that you want to replace, just write your own version and it will work.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Hello,

The ambient sounds are working very well. I think it is the best way to scare the pants off of anyone playing my dungeon.

I will distribute the entire file together as a stand alone file.

Thx,

LordGarth
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Also

I believe the untrigged nil come from walking over the trigger without any heroes in the party.

LordGarth
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

While it might be hypocritical given the presence of FTL's graphics in graphics.dat, I should point out at no point have I given anyone permission to distribute modified versions of the DSB base code. As of this post I am explicitly denying permission to do so.

While I'm happy to let people modify DSB and I love code contributions and suggestions, I want to maintain "editorial control" over the base, core DSB program. I do not want mutually incompatible, impossible-to-upgrade versions of DSB floating around, and I don't want someone downloading a DSB dungeon and trying to play it with one of these modified standalone DSB distributions and wondering why it won't work.
LordGarth
Apprentice
Posts: 41
Joined: Thu Jan 27, 2011 6:21 pm

Re: Music and Sounds

Post by LordGarth »

Hello,

I will keep the dungeon for myself then. Or perhaps I can send the files and then the user can put them into a manifest if the will work with the programming needed for the situation.

LordGarth
User avatar
Gambit37
Should eat more pies
Posts: 13715
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Music and Sounds

Post by Gambit37 »

Lord Garth, you should create a proper dungeon by copying your new code into your own Lua files in a fresh dungeon folder. Look at how the test dungeon works to see how it's done.
Then you can distribute it as a stand-alone dungeon.

Once you've got all your code into a stand-alone folder, you should then re-install DSB. You don't want all your changes in the base code, this will probably break the game, as Sophia mentioned.
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Music and Sounds

Post by Sophia »

I'm really not trying to be obnoxious about this, but modified standalone DSB distributions are bad for you, bad for me, and bad for everyone, so I am absolutely going to nip this in the bud.

Here are all the reasons against it:
- If you find a bug, it will be almost impossible to determine if it's something I need to fix or something wrong with your custom base code.
- If there is a bug found elsewhere in the DSB base code, it won't ever be fixed for you, because your version is essentially frozen.
- When I make upgrades to dsb.exe that require changes/additions to the base code, you won't be able to upgrade your exe, either.
- Someone downloading another custom dungeon will probably have weird things go wrong if they try to play it with your modified base code.
- ... and if they forget/aren't aware of your changes, I'll assume the problems are bugs with standard DSB, and we'll all waste lots of time trying to debug it.
- I lose control over what is "DSB" and what is not, and I don't really like that.

Compare that to the one in favor of doing it:
- It makes the task of dungeon creation supposedly simpler for you... only it doesn't, really.

Why not just learn how to do it the right way? It really, really isn't that hard. :)
Post Reply