Play sound in game .
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Play sound in game .
by Vasiliy » 30 Dec 2009, 18:54
In r243 I add new feature "Play sound in game"
Now if you tap land then play sound. I add new sounds in the future.
But I not found in Forge code which execute when tap any card, play card from hand, draw a card, lose life, gain life and any another player actions.
Please help me and show for me these code.
Now if you tap land then play sound. I add new sounds in the future.
But I not found in Forge code which execute when tap any card, play card from hand, draw a card, lose life, gain life and any another player actions.
Please help me and show for me these code.
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 DennisBergkamp » 30 Dec 2009, 19:59
Cool, except I'm getting errors when I download the latest SVN. Can you also include the MP3Player classes (javazoom.jl.player) ?
- tap() in Card.java should handle all cards tapping.
- drawCard(string player) in GameAction.java.
- addLife(int life) and subtractLife(int life) in PlayerLife.java.
- resolve() in SpellAbility.java.
- tap() in Card.java should handle all cards tapping.
- drawCard(string player) in GameAction.java.
- addLife(int life) and subtractLife(int life) in PlayerLife.java.
- resolve() in SpellAbility.java.
-
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 » 30 Dec 2009, 20:04
I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.
Please add it to your local project.
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 Chris H. » 30 Dec 2009, 20:10
Does anyone have a url for the needed file? I am not quite sure where to go to find it.Vasiliy wrote:I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.
I do like the idea of having some sound effects. It might be fun to hear the computer say "ouch" whenever we damage it.
-
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 Vasiliy » 30 Dec 2009, 20:12
http://code.google.com/p/cardforge/source/browse/#svn/src/res/libChris H. wrote:Does anyone have a url for the needed file? I am not quite sure where to go to find it.Vasiliy wrote:I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.
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 DennisBergkamp » 30 Dec 2009, 20:20
Ok, yes it's working for me now... But would it be a good idea to also just add the package into the SVN? (just like the com, org, treeProperties... I could add javazoom).
-
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 » 30 Dec 2009, 20:23
Do it.DennisBergkamp wrote:Ok, yes it's working for me now... But would it be a good idea to also just add the package into the SVN? (just like the com, org, treeProperties... I could add javazoom).
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 Chris H. » 30 Dec 2009, 21:20
Hmmm ...
I tried to merge r244 into my local copy and then built the project. The 5 errors have been replaced with 42 warnings. Dennis, are you getting the same errors on your computer when you build?
I tried to merge r244 into my local copy and then built the project. The 5 errors have been replaced with 42 warnings. Dennis, are you getting the same errors on your computer when you build?
- Code: Select all
Description Resource Path Location Type
The serializable class DecoderException does not declare a static final serialVersionUID field of type long DecoderException.java /ForgeSVN/src/javazoom/jl/decoder line 29 Java Problem
The serializable class JavaLayerError does not declare a static final serialVersionUID field of type long JavaLayerError.java /ForgeSVN/src/javazoom/jl/decoder line 29 Java Problem
The serializable class JavaLayerException does not declare a static final serialVersionUID field of type long JavaLayerException.java /ForgeSVN/src/javazoom/jl/decoder line 35 Java Problem
The serializable class PlayerApplet does not declare a static final serialVersionUID field of type long PlayerApplet.java /ForgeSVN/src/javazoom/jl/player line 38 Java Problem
The serializable class BitstreamException does not declare a static final serialVersionUID field of type long BitstreamException.java /ForgeSVN/src/javazoom/jl/decoder line 40 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 47 Java Problem
The field Player.frame is never read locally Player.java /ForgeSVN/src/javazoom/jl/player line 47 Java Problem
The field AdvancedPlayer.complete is never read locally AdvancedPlayer.java /ForgeSVN/src/javazoom/jl/player/advanced line 48 Java Problem
The field AdvancedPlayer.lastPosition is never read locally AdvancedPlayer.java /ForgeSVN/src/javazoom/jl/player/advanced line 49 Java Problem
The local variable start is never read jlc.java /ForgeSVN/src/javazoom/jl/converter line 49 Java Problem
The field huffcodetab.tablename2 is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 52 Java Problem
Hashtable is a raw type. References to generic type Hashtable<K,V> should be parameterized FactoryRegistry.java /ForgeSVN/src/javazoom/jl/player line 53 Java Problem
Hashtable is a raw type. References to generic type Hashtable<K,V> should be parameterized FactoryRegistry.java /ForgeSVN/src/javazoom/jl/player line 53 Java Problem
The field huffcodetab.linmax is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 57 Java Problem
The field huffcodetab.ref is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 58 Java Problem
The field huffcodetab.table is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 59 Java Problem
The field BitReserve.buf_bit_idx is never read locally BitReserve.java /ForgeSVN/src/javazoom/jl/decoder line 60 Java Problem
The field huffcodetab.hlen is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 60 Java Problem
Type safety: The method put(Object, Object) belongs to the raw type Hashtable. References to generic type Hashtable<K,V> should be parameterized FactoryRegistry.java /ForgeSVN/src/javazoom/jl/player line 61 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized FactoryRegistry.java /ForgeSVN/src/javazoom/jl/player line 64 Java Problem
The local variable rc is never read WaveFileObuffer.java /ForgeSVN/src/javazoom/jl/converter line 70 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized AudioDeviceFactory.java /ForgeSVN/src/javazoom/jl/player line 72 Java Problem
The local variable k is never read WaveFileObuffer.java /ForgeSVN/src/javazoom/jl/converter line 89 Java Problem
The local variable rc is never read WaveFileObuffer.java /ForgeSVN/src/javazoom/jl/converter line 90 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 110 Java Problem
Enumeration is a raw type. References to generic type Enumeration<E> should be parameterized FactoryRegistry.java /ForgeSVN/src/javazoom/jl/player line 114 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 121 Java Problem
The local variable crc is never read jlc.java /ForgeSVN/src/javazoom/jl/converter line 121 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 127 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 141 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized JavaLayerUtils.java /ForgeSVN/src/javazoom/jl/decoder line 201 Java Problem
The local variable majorVersion is never read Bitstream.java /ForgeSVN/src/javazoom/jl/decoder line 221 Java Problem
The local variable revision is never read Bitstream.java /ForgeSVN/src/javazoom/jl/decoder line 222 Java Problem
The local variable layer is never read Decoder.java /ForgeSVN/src/javazoom/jl/decoder line 274 Java Problem
The field huffcodetab.bitbuf is never read locally huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 420 Java Problem
The local variable hs is never read huffcodetab.java /ForgeSVN/src/javazoom/jl/decoder line 456 Java Problem
The method DDCRET_String(int) from the type RiffFile is never used locally RiffFile.java /ForgeSVN/src/javazoom/jl/converter line 469 Java Problem
The method getBytes(int, int, byte[], int) from the type String is deprecated RiffFile.java /ForgeSVN/src/javazoom/jl/converter line 490 Java Problem
The local variable convert is never read Bitstream.java /ForgeSVN/src/javazoom/jl/decoder line 517 Java Problem
The local variable idx is never read SynthesisFilter.java /ForgeSVN/src/javazoom/jl/decoder line 973 Java Problem
Class is a raw type. References to generic type Class<T> should be parameterized SynthesisFilter.java /ForgeSVN/src/javazoom/jl/decoder line 1620 Java Problem
The method compute_new_v_old() from the type SynthesisFilter is never used locally SynthesisFilter.java /ForgeSVN/src/javazoom/jl/decoder line 575 Java Problem
-
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 DennisBergkamp » 30 Dec 2009, 21:55
Ah yes, I do get those warnings too. Don't worry about them for now, I'll fix those at some point.
-
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 Chris H. » 30 Dec 2009, 21:58
OK, I built and ran the project, warnings and all. It works and I like the tapping sound when I tap a card.
-
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 zerker2000 » 30 Dec 2009, 23:08
Try using Class<?> instead of Class. Also, for Spell/Ability playing, I think that should actually go in MagicStack.pop(), which is where it is usually called anyways.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.
--Eladamri, the Seed of Freyalise
- zerker2000
- Programmer
- Posts: 569
- Joined: 09 May 2009, 21:40
- Location: South Pasadena, CA
- Has thanked: 0 time
- Been thanked: 0 time
Re: Play sound in game .
by Huggybaby » 30 Dec 2009, 23:44
Sounds are important, this is a very nice development.
-
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 DennisBergkamp » 31 Dec 2009, 01:54
Ah, yes that's right, good point.zerker2000 wrote:Try using Class<?> instead of Class. Also, for Spell/Ability playing, I think that should actually go in MagicStack.pop(), which is where it is usually called anyways.
-
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 Mr.Chaos » 31 Dec 2009, 09:49
That would be fun. Maybe you could add that famous quote from ALIENS: "Game over, man! Game over!" That has already been used in lots of other computer games, from action to pinball and it just never gets old.Chris H. wrote:I do like the idea of having some sound effects. It might be fun to hear the computer say "ouch" whenever we damage it.
Or the Terminator qoute for when compy loses: "I'll be back!" (best use of the "shades" smiley so far.)
Seriously though, a sound to be played at the end of the AI's turn would be helpfull.
Actually, a soundeffect at the end/or beginning of a phase would make sense.
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.
The only thing we do with way to many soundeffects every year is welcomming the new year.
So I brace myself for the barrage of fireworks and hope nobody gets hurt by it.
= 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 Chris H. » 31 Dec 2009, 11:43
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?
-
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
28 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 101 guests