Play sound in game .
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Play sound in game .
by frwololo » 31 Dec 2009, 15:32
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.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.
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 .
by 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).
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).
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Play sound in game .
by 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:
Now sounds playing if menu item "Play sound" is selected and file is exist
Screenshot:
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 .
by 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.
It never seems clear to me whose turn it is.
-
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 .
by 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.
After several games/shuffles the sound file became corrupted and Forge died with a Heap error.
-
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 .
by Mr.Chaos » 04 Jan 2010, 19:46
So, basically, compy didn't like the sound of it then?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.
(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.
- Mr.Chaos
- Tester
- Posts: 625
- Joined: 06 Sep 2008, 08:15
- Has thanked: 0 time
- Been thanked: 0 time
Re: Play sound in game .
by Snacko » 06 Jan 2010, 16:57
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.Chris H. wrote:Agreed.So my advise would be to keep them simple and not over use them.
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?
You could ease storing and pruning them by using Google Collections, which just hit 1.0 (MapMaker factory class).
Re: Play sound in game .
by mtgrares » 06 Jan 2010, 17:22
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.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.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
Re: Play sound in game .
by 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.
-
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 .
by 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?
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 .
by 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.
-
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 .
by 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.
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 .
by DennisBergkamp » 06 Jan 2010, 22:12
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).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?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
28 posts
• Page 2 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 86 guests