It is currently 27 Apr 2024, 06:11
   
Text Size

Play sound in game .

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Play sound in game .

Postby frwololo » 31 Dec 2009, 15:32

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...
frwololo
DEVELOPER
 
Posts: 265
Joined: 21 Jun 2008, 04:33
Has thanked: 0 time
Been thanked: 3 times

Re: Play sound in game .

Postby DennisBergkamp » 31 Dec 2009, 19:59

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).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Play sound in game .

Postby Vasiliy » 03 Jan 2010, 12:03

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
Sorry for my english. I speak english very bad.
Vasiliy
Programmer
 
Posts: 47
Joined: 15 Nov 2009, 12:26
Has thanked: 0 time
Been thanked: 0 time

Re: Play sound in game .

Postby Huggybaby » 03 Jan 2010, 18:08

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.
User avatar
Huggybaby
Administrator
 
Posts: 3207
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 701 times
Been thanked: 594 times

Re: Play sound in game .

Postby Chris H. » 04 Jan 2010, 17:08

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. :(
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Play sound in game .

Postby Mr.Chaos » 04 Jan 2010, 19:46

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.)
](*,) = coder at work, according to a coder.It does explain some of the bugs. :wink:
Mr.Chaos
Tester
 
Posts: 625
Joined: 06 Sep 2008, 08:15
Has thanked: 0 time
Been thanked: 0 time

Re: Play sound in game .

Postby Snacko » 06 Jan 2010, 16:57

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).
Snacko
DEVELOPER
 
Posts: 826
Joined: 29 May 2008, 19:35
Has thanked: 4 times
Been thanked: 74 times

Re: Play sound in game .

Postby mtgrares » 06 Jan 2010, 17:22

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.
mtgrares
DEVELOPER
 
Posts: 1352
Joined: 08 Sep 2008, 22:10
Has thanked: 3 times
Been thanked: 12 times

Re: Play sound in game .

Postby Rob Cashwalker » 06 Jan 2010, 18:44

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)
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: Play sound in game .

Postby Marek14 » 06 Jan 2010, 19:11

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?
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Play sound in game .

Postby Huggybaby » 06 Jan 2010, 19:42

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.
User avatar
Huggybaby
Administrator
 
Posts: 3207
Joined: 15 Jan 2006, 19:44
Location: Finally out of Atlanta
Has thanked: 701 times
Been thanked: 594 times

Re: Play sound in game .

Postby Marek14 » 06 Jan 2010, 21:56

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.
Marek14
Tester
 
Posts: 2761
Joined: 07 Jun 2008, 07:54
Has thanked: 0 time
Been thanked: 297 times

Re: Play sound in game .

Postby DennisBergkamp » 06 Jan 2010, 22:12

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).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 86 guests


Who is online

In total there are 86 users online :: 0 registered, 0 hidden and 86 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 86 guests

Login Form