Question: Sound for web game event/action.

For discussions about game development that does not fit in any of the other topics.
Post Reply
User avatar
UnknownUser
Posts: 51
Joined: Tue Sep 08, 2009 2:54 pm

Question: Sound for web game event/action.

Post 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-
When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English. ~Author Unknown
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

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

Post 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!
The indelible lord of tl;dr
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

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

Post 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.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Post Reply

Return to “General Development”