Page 1 of 2

Play sound in game .

PostPosted: 30 Dec 2009, 18:54
by Vasiliy
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.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 19:59
by DennisBergkamp
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.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 20:04
by Vasiliy
I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 20:10
by Chris H.
Vasiliy wrote:I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.
Does anyone have a url for the needed file? I am not quite sure where to go to find it. :-k

I do like the idea of having some sound effects. It might be fun to hear the computer say "ouch" whenever we damage it. :lol:

Re: Play sound in game .

PostPosted: 30 Dec 2009, 20:12
by Vasiliy
Chris H. wrote:
Vasiliy wrote:I add jl1.0.1.jar to SVN. You can found it from res\lib
Please add it to your local project.
Does anyone have a url for the needed file? I am not quite sure where to go to find it. :-k
http://code.google.com/p/cardforge/source/browse/#svn/src/res/lib

Re: Play sound in game .

PostPosted: 30 Dec 2009, 20:20
by DennisBergkamp
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).

Re: Play sound in game .

PostPosted: 30 Dec 2009, 20:23
by Vasiliy
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).
Do it.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 21:20
by Chris H.
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?

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

Re: Play sound in game .

PostPosted: 30 Dec 2009, 21:55
by DennisBergkamp
Ah yes, I do get those warnings too. Don't worry about them for now, I'll fix those at some point.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 21:58
by Chris H.
OK, I built and ran the project, warnings and all. It works and I like the tapping sound when I tap a card. :D

Re: Play sound in game .

PostPosted: 30 Dec 2009, 23:08
by zerker2000
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.

Re: Play sound in game .

PostPosted: 30 Dec 2009, 23:44
by Huggybaby
Sounds are important, this is a very nice development.

Re: Play sound in game .

PostPosted: 31 Dec 2009, 01:54
by DennisBergkamp
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.
Ah, yes that's right, good point.

Re: Play sound in game .

PostPosted: 31 Dec 2009, 09:49
by Mr.Chaos
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. :lol:
That would be fun. Maybe you could add that famous quote from ALIENS: "Game over, man! Game over!" :lol: That has already been used in lots of other computer games, from action to pinball and it just never gets old.
Or the Terminator qoute for when compy loses: "I'll be back!" 8) (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.

Re: Play sound in game .

PostPosted: 31 Dec 2009, 11:43
by Chris H.
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