Saturday, November 25, 2006

Working with in-game sound


The one thing that is really comfortable when working on a project alone is that you decide which workingtask is coming up next. The core isn't yet fully completed with code and its graphics, allthough I've decided to start the soundcreation - mostly to try to develop everything alongside each element.
(Of course there are many downsides with developing alone, especially the social contact and the time every single thing takes.)

At the moment I'm trying to build the themesong so it comes as closely as it gets to the overall game-experience, this isn't easy - especially when I don't have the actual foundation (that might be why you should build the game first and add music and soundeffects to it later..) - but, hopefully I can let the sound decide some of the events that you'll see and not the other way around.

The sound - from my point of view - is equally important to the graphics, the sound makes you feel the bounce of the ball and that dustcloud you just created with a hard hit in the wall. Therefore I have set up a little script which will randomize the characteristics of the sound. Every simple sound (like when your mouse roll over a menuitem) has five different recorded characteristics, and when adding the simple script looking a bit like this:

on channelRotate
if availableChannel <> 7 then
availableChannel = availableChannel + 1

else
availableChannel = 1
end if
rSound = random(5)
case rSound of
1: soundStartTime = 0 soundEndTime = 500
2: soundStartTime = 500 soundEndTime = 1000
3: soundStartTime = 1000
soundEndTime = 1500
4: soundStartTime = 1500
soundEndTime = 2000
5: soundStartTime = 2000
soundEndTime = 2500
end case
pNote = +random(3) -random(3)
end
end

--Calling the sound from elsewhere

channelRotate
sendSound = "ppr_mouseOver"
sound(availableChannel).queue([#member: member(sendSound), #startTime: soundStartTime, #endTime: soundEndTime, #rateShift: pNote])

the sound will automatically rotate in the available channels and get 25 (5x5) different characteristics, so.. solong repetitive sound!

In case you wonder, the scriptlanguage is Lingo.

No comments: