Page 2 of 2

Re: Play sound in game .

PostPosted: 31 Dec 2009, 15:32
by frwololo
Mr.Chaos wrote:But any more soundeffects would probably get cheesy real quick, no matter how funny the "ouch" thing is at first.
So my advise would be to keep them simple and not over use them.
t is probably doable to let people customize the sounds somehow. Then the engine can play the sound if the file exists, and do nothing otherwise.
In Wagic there is a sound effect when a card comes in play (based on its type or abilities), it actually helps a lot to recognize what kind of card just entered the game.
Example here:
http://www.youtube.com/watch?v=ZZCjg63z2Yw
And example here for the "customization" part:
http://www.youtube.com/watch?v=H2kKI4Zb8Lc
(go to the middle of the video - sorry for the sound normalization issue...)

The code for that is very simple: take (one of) the subtypes of the card. If a file with the name [subtype].wav exists in the audio folder, play it when the card comes into play.
That kind of stuff...

Re: Play sound in game .

PostPosted: 31 Dec 2009, 19:59
by DennisBergkamp
Yeah, actually it looks like that's how we'll end up doing it ... sounds are in /res/sounds and will have meaningful names (currently we only have tap.mp3).
Since I listen to music all of the time, I personally would rather play without sounds (except maybe a sound indicating the beginning of a new turn).

Re: Play sound in game .

PostPosted: 03 Jan 2010, 12:03
by Vasiliy
In r256 I add menu item "Play sound" in Game menu.
Now sounds playing if menu item "Play sound" is selected and file is exist

Screenshot:
Image

Re: Play sound in game .

PostPosted: 03 Jan 2010, 18:08
by Huggybaby
Awesome. Is there a trigger so the game can announce "Computer's Turn" and "Player's Turn" ?

It never seems clear to me whose turn it is.

Re: Play sound in game .

PostPosted: 04 Jan 2010, 17:08
by Chris H.
I recorded the sound of a deck of cards being shuffled and turned it into a small 8k mp3 file. I added a couple of lines of code to the card shuffling routine in GameAction (?) ... The first shuffle when starting the game sounded great.

After several games/shuffles the sound file became corrupted and Forge died with a Heap error. :(

Re: Play sound in game .

PostPosted: 04 Jan 2010, 19:46
by Mr.Chaos
Chris H. wrote:I recorded the sound of a deck of cards being shuffled and turned it into a small 8k mp3 file. I added a couple of lines of code to the card shuffling routine in GameAction (?) ... The first shuffle when starting the game sounded great.

After several games/shuffles the sound file became corrupted and Forge died with a Heap error. :(
So, basically, compy didn't like the sound of it then? :lol:
(sorry, could not resist that one. I will try to behave now.)

Re: Play sound in game .

PostPosted: 06 Jan 2010, 16:57
by Snacko
Chris H. wrote:
So my advise would be to keep them simple and not over use them.
Agreed.

And I wonder if sounds get cached into memory like the HQ pics. If we add additional sounds will we have problems similar to what some people are seeing with the HQ pics? :-k
You should be using SoftReferences for caches, because SoftReferences pointing to softly reachable objects are guaranteed to be cleared before the VM will throw an OutOfMemoryError.
You could ease storing and pruning them by using Google Collections, which just hit 1.0 (MapMaker factory class).

Re: Play sound in game .

PostPosted: 06 Jan 2010, 17:22
by mtgrares
Huggybaby wrote:Awesome. Is there a trigger so the game can announce "Computer's Turn" and "Player's Turn" ?

It never seems clear to me whose turn it is.
I probably should try to make this more visual and stick it somewhere in the gui. Shandalar had a clear way of showing who's turn and phase it was.

Re: Play sound in game .

PostPosted: 06 Jan 2010, 18:44
by Rob Cashwalker
just change the background color of the frame around the current player's life box. Optionally, change the border color to indicate the active player. (if there is such a difference)

Re: Play sound in game .

PostPosted: 06 Jan 2010, 19:11
by Marek14
I don't think it's necessary to show active player - if Forge lets you do something, you must have the priority.

BTW, if we have Time Walk and such, would it be possible to implement random starting player (or even the play/draw rule) by skipping the first human's turn if the computer starts?

Re: Play sound in game .

PostPosted: 06 Jan 2010, 19:42
by Huggybaby
I disagree, it's easy for me to skip my turn on accident, I've done it many times and when I do I quit the game. You guys play this so much that you're used to it and take all the quirks, I mean, "interface issues" for granted.

Re: Play sound in game .

PostPosted: 06 Jan 2010, 21:56
by Marek14
I meant the player who has priority. I am definitely for showing whose turn it is.

As for accidental skipping of your turn, I wonder if the stopping at end of turn shouldn't be on by default - that makes it a bit easier to notice your turn.

Re: Play sound in game .

PostPosted: 06 Jan 2010, 22:12
by DennisBergkamp
I don't think it's necessary to show active player - if Forge lets you do something, you must have the priority.

BTW, if we have Time Walk and such, would it be possible to implement random starting player (or even the play/draw rule) by skipping the first human's turn if the computer starts?
Yeah, this is definitely possible... I'm not sure if I did this correctly, but the way it currently works is that Forge keeps track of an extraTurns variable for each player. It can be negative (which was necessary for Chronatog). Once a player takes a turn, this number is decremented. (Or if the number is negative, it gets incremented).