Server side sound
by Lee Latham · in Torque Game Engine · 02/07/2008 (6:32 pm) · 7 replies
I've got (what I think is) an interesting problem. I'd like my dedicated server to make a nice "bong" noise whenever someone joins the server. This way, I and others can jump in and play so that people can get a better sense of what my new game has to offer, since it is a multiplayer game and requires human players to be fun.
So I know how to make a sound in 3d space in the mission, or "attach" it to objects like players. But how would I go about getting the server itself to play a sound?
Any input would be greatly appreciated.
So I know how to make a sound in 3d space in the mission, or "attach" it to objects like players. But how would I go about getting the server itself to play a sound?
Any input would be greatly appreciated.
#2
Yes, I suppose it's kinda weird.
02/08/2008 (9:11 am)
Sorry, I probably wasn't clear. This is just a single sound for the dedicated server. So that I, as the admin, can know if someone has joined. You know what I mean?Yes, I suppose it's kinda weird.
#3
You could add a call to your OS's 'Beep' function (don't know what platform you're on). You're usually able to change the sound effect through the OS's preferences/control panel.
If you're compiling a true dedicated server, I don't believe sound is linked in. If you do indeed have audio working then take a look at alxPlay() to play a sound. There should be enough examples in the FPS demo to see what it requires.
Under Windows I believe PlaySound() could also be used without need to load in OpenAL. Found this in MSDN: msdn2.microsoft.com/en-us/library/ms712879(VS.85).aspx
Hope that helps.
- LightWave Dave
02/08/2008 (9:46 am)
Greetings!You could add a call to your OS's 'Beep' function (don't know what platform you're on). You're usually able to change the sound effect through the OS's preferences/control panel.
If you're compiling a true dedicated server, I don't believe sound is linked in. If you do indeed have audio working then take a look at alxPlay() to play a sound. There should be enough examples in the FPS demo to see what it requires.
Under Windows I believe PlaySound() could also be used without need to load in OpenAL. Found this in MSDN: msdn2.microsoft.com/en-us/library/ms712879(VS.85).aspx
Hope that helps.
- LightWave Dave
#4
Although your idea sounds simple enough. I appreciate your digging up that link :-)
I hadn't thought about whether OpenAL is even loaded or not--that's a good point. I'm not running a binary compiled dedicated, but just using the -dedicated switch, but I wonder if that could still be an issue. My feeling is that it probably is.
02/08/2008 (12:22 pm)
Hmm, I was contemplating the OS Beep function, actually, so I dig what you're saying. Unfortunately, I'm not a competant coder, so I was kinda hoping there might be something built into Torque.Although your idea sounds simple enough. I appreciate your digging up that link :-)
I hadn't thought about whether OpenAL is even loaded or not--that's a good point. I'm not running a binary compiled dedicated, but just using the -dedicated switch, but I wonder if that could still be an issue. My feeling is that it probably is.
#5
02/08/2008 (5:00 pm)
Sound is not initialized by the dedicated server in stock, you can easily change that by initializing OpenAL in the server scripts (as you do in the client scripts) - probably init.cs or canvas.cs (?)
#7
@Gary: unfortunately I'm stuck on Winblows for the time being. :-( But you make a good point that it's pretty straightforward, and maybe I ought to take a swing at David Wyand's suggestion. Hmmm actually I just read through his post a little more carefully...this is just the sort of reason I keep a clean TGE 1.5.2 install lying around...hmmmm
02/08/2008 (6:00 pm)
@Stefan: I think I could do that, but do you have any idea how one would create the sound then in script? Is there a server "object" or something?@Gary: unfortunately I'm stuck on Winblows for the time being. :-( But you make a good point that it's pretty straightforward, and maybe I ought to take a swing at David Wyand's suggestion. Hmmm actually I just read through his post a little more carefully...this is just the sort of reason I keep a clean TGE 1.5.2 install lying around...hmmmm
Torque Owner Stefan Lundmark