Page 1 of 1

Question: Sound for web game event/action.

Posted: Wed Nov 09, 2011 1:23 am
by UnknownUser
Hey guys, i was thinking to my self hum whats the best way to implement sound into a "game".
For example attacks gives short sound effects another example would be fire attack/spell.
Gives the correct sound for that event/action,and when you add loot u hear the sound of it.
Dropping into your bag,

So i started to think how you could i build a simple sound handler, an event/action type handler ->
you could just do click->on click play this for the player but that gave problem with sound delay,
and and different browsers had there own problems so on, i have a lot of ideas how to make this.

But I've decided to ask you guys before i start anything.
So my Question: Is how would you do it or is there a good.
Open source one out already all info would be greatly appreciated

I'm all open to read what you have to say on this subject
and i thank you for your answers in advance!

-U.U-

Re: Question: Sound for web game event/action.

Posted: Wed Nov 09, 2011 2:17 am
by Jackolantern
Sound used to be a serious problem for web games, and really there were no good options outside of plugins and a few hacks. Of course, there have almost always been ways to just play a sound through the browser, but not without a player, and not through the actions of a game.

But now HTML5 comes to the rescue! While a Google search of "How to add sound to HTML5 canvas game" turns up a ton of articles, here is a concise one that should get you started!

Although these are talking about canvas games/animations, the premise is the same. "Canvas" apps are just Javascript, and if you can play a sound in the canvas, you can play it for anything else, too!

Re: Question: Sound for web game event/action.

Posted: Wed Nov 09, 2011 8:12 am
by Chris
HTML5 Audio tag. That simple. There's even functionality in WebGL to make the sound 3D (come from different points in perspective). I'm working on a canvas version.