Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 [2]
  ignore  |  Print  
  Bunny Golf  (Read 21385 times)
0 Members and 1 Guest are viewing this topic.
Offline gouessej
« Reply #30 - Posted 2008-01-25 22:22:35 »

Update: The final version!  http://www.dishmoth.com/BunnyGolf.html

At least, it's the final version unless you guys think otherwise!  Grin

(In particular, I've only been able to check the full-screen mode on some older versions of Windows, so any feedback on how well that works would be welcome.)

Cheers,
Simon

I have tested your game. There are 2 problems :
- I have no sound, it doesn't come from my configuration as my own game works and uses sound too
- the fullscreen mode doesn't work on my computer, I get a completely gray window
I have no trace of exception in the log or in the console. I'm ready to test it again if you need some help. My computer works under Mandriva Linux 2007, my web browser is firefox, my graphics card is an ATI Radeon 9250 Pro, I have 2 GB DDRAM, I use KDE window manager. Please tell me how you implemented your fullscreen mode. It is really simple, you only have to create an undecorated window as tall as the screen size. I don't know where the problem of sound comes, I use JOGG and JORBIS, I have no problem.

Your game is quite pleasant in spite of these bugs. Good luck and using Java Web Start is an excellent idea.  Grin

Offline dishmoth
« Reply #31 - Posted 2008-01-26 13:03:05 »

I have tested your game. There are 2 problems :
- I have no sound, it doesn't come from my configuration as my own game works and uses sound too
- the fullscreen mode doesn't work on my computer, I get a completely gray window

Hi, gouessej!  Thanks for testing the game.  I'd be very grateful for any further testing you could do to help me get rid of those bugs.

To test the sound, I've uploaded a new version of the JAR in which one of the sound effects is loaded from a WAV rather than an OGG file.  If you hear a sound when the mouse pointer moves over one of the buttons on the title screen, then I'm playing WAV files correctly and it's the OGG files that are the problem.

I'm loading the sound effects into Clip objects and playing them with
1  
2  
3  
4  
  clip.stop();
  clip.flush();
  clip.setFramePosition(0);
  clip.start();


For WAV files, the code to load them is
1  
2  
3  
4  
  AudioInputStream audioStream = AudioSystem.getAudioInputStream(url);
  clip = AudioSystem.getClip();
  clip.open(audioStream);
  audioStream.close();


For OGG files, I'm using Jorbis to read the file as PCM data, and then creating a Clip in the following way:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
  private Clip newClip(int    sampleRate, 
                       int    numChannels,
                       byte[] pcmBytes) throws IOException {

    int     bitsPerSample = 16;
    boolean isSigned      = true,
            isBigEndian   = false;
    AudioFormat format = new AudioFormat((float)sampleRate, bitsPerSample,
                                         numChannels, isSigned, isBigEndian);

    Clip clip = null;
    try {
      clip = AudioSystem.getClip();
      clip.open(format, pcmBytes, 0, pcmBytes.length);
    } catch ( Exception ex ) {
      throw new IOException("failure during creation of Clip (" + ex + ")");
    }
 
    return clip;
   
  }


The console output may say if there's a problem decoding the OGG files.  Could you download the JAR file and run it using the following command?
1  
java -enableassertions -jar BunnyGolf.jar debug

The console output should then include a few lines of info for each OGG file that is loaded.  For example, the last block of OGG output should look like:
1  
2  
3  
4  
Decoding Ogg Vorbis bitstream 
Bitstream is 1 channel, 44100Hz
Encoded by: Xiph.Org libVorbis I 20020717
Constructing clip, 20096 bytes of PCM data


That's all I can think of for now for debugging the sound.

As for full-screen mode, the code looks something like the following.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public class MainWindow extends JFrame {

  ...

  GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
  if ( device.isFullScreenSupported() ) {
    device.setFullScreenWindow((Window)this);
    mIsFullScreen = true;
  }

  ...

  if ( mIsFullScreen ) {
    createBufferStrategy(2);
    mBufferStrategy = getBufferStrategy();
  } else {
    mGameCanvas.createBufferStrategy(2);
    mBufferStrategy = mGameCanvas.getBufferStrategy();
  }

  ...

}


Can you see any problem with that?  The code in full is a bit convoluted (spread between several classes) so I'll hold off posting it for the timebeing.  I'm going to hunt around for some more examples of full-screen mode being used to see if those show me where I'm going wrong.

Thanks again for your help.
Simon

Offline dishmoth
« Reply #32 - Posted 2008-01-26 19:29:38 »

After catching up on a bit of reading (here, here, here) I've tried modifying the code so that it only switches to full-screen mode on an undecorated Frame (rather than a decorated JFrame).

Let's see if that helps any.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #33 - Posted 2008-01-27 00:22:07 »

I tried to launch your JAR and again your game through Java Web Start:
- still no wound (javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported.)
- the window is as tall as the screen but it remains gray and the taskbar is drawn onto your window

Please do something like this:

public final class GameView extends Frame {
....
setLocation(0,0);//sets the window at the topleft corner
setUndecorated(true);//makes the decoration disappear
setIgnoreRepaint(true);//prevents the system from calling repaint automatically      
//gets the size of the screen   
screenWidth=(int)Toolkit.getDefaultToolkit().getScreenSize().getWidth();
screenHeight=(int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();   
setSize(screenWidth,screenHeight);   
//bug fix : under Linux, sometimes the window was drawn below the taskbar
setResizable(true);         
.....
setVisible(true);

This was an extract from my source code, feel free to use it, it is under GPL license version 2. I use JORBIS too, look at main.SoundSystem in my source code.

Offline dishmoth
« Reply #34 - Posted 2008-01-28 20:04:04 »

I'm guessing that the problem with the sound is that on some platforms the number of source lines into a Mixer is restricted.  That could be what's triggering the LineUnavailableException when I try to open 50 Clips at the start of game.  I've adjusted the code now so that it reads in all the PCM data for the sound effects right at the start, but only creates a Clip object when it's time to play an effect.  It also discards each Clip when it's finished playing so that there are never too many active lines to the Mixer at any time.  Hopefully that will fix the problem.

I've also tried adjusting the full screen code a bit, but I'm not optimistic about it having improved anything.  I believe I'm doing everything you suggest, and everything that's described in Sun's FSEM tutorial, so I don't really know what else to try.

If you could try the game again and see if it's working better now I'd appreciate it.

Cheers,
Simon

Offline gouessej
« Reply #35 - Posted 2008-01-28 23:07:51 »

One good point : I heard something just at the beginning of the game, a short noise.

But I had an exception and the screen remains gray:
Exception in thread "Thread-6" java.util.NoSuchElementException
   at java.util.LinkedList.remove(LinkedList.java:788)
   at java.util.LinkedList.removeFirst(LinkedList.java:134)
   at BunnyGolf.SoundEffect.play(SoundEffect.java:115)
   at BunnyGolf.Sounds.playGrabMeSound(Sounds.java:317)
   at BunnyGolf.Button.aftermath(Button.java:163)
   at BunnyGolf.SpriteManager.advance(SpriteManager.java:156)
   at BunnyGolf.GameManager.advance(GameManager.java:62)
   at BunnyGolf.MainWindow.run(MainWindow.java:302)
   at java.lang.Thread.run(Thread.java:619)

Don't give up, I'm sure it is only a very small problem. Don't forget to authorize your window to be resized to solve the problem of the taskbar drawn onto your game. A bug is not the end of a game. If you're not convinced, look at the list of the known bugs of my game.

Offline dishmoth
« Reply #36 - Posted 2008-01-29 17:32:35 »

One good point : I heard something just at the beginning of the game, a short noise.
But I had an exception and the screen remains gray:

Oops!  Silly bug was causing the exception.  Fixed now, I hope.

I think the default Sound Mixer on your system must really hate playing Clip objects!  I've changed the code to hunt for a better Mixer when it starts up.  I'd be interested to know what it finds -- if you run the JAR from the command line as you did before (java -jar BunnyGolf.jar debug) so that it produces console output, then it should list at the start all of the Mixers it finds, and how many Clips each claims to support.  The output for me is:
1  
2  
3  
4  
5  
Default Sound Mixer: Primary Sound Driver, version Unknown Version, max lines unrestricted 
Sound Mixer 0: Primary Sound Driver, version Unknown Version, max lines unrestricted
Sound Mixer 1: ESS Maestro, version Unknown Version, max lines unrestricted
Sound Mixer 4: Java Sound Audio Engine, version 1.0, max lines 32
Using Sound Mixer: Primary Sound Driver, version Unknown Version, max lines unrestricted

I'm guessing that your default Mixer will have max lines as a relatively small number.

Let's see if the sound works now at least!

Cheers,
Simon

Offline gouessej
« Reply #37 - Posted 2008-01-29 20:13:36 »

I think the default Sound Mixer on your system must really hate playing Clip objects!
My system loves playing clip objects as it already works fine for my own game. Look at this:

Default Sound Mixer: V8237 [plughw:0,0], version 1.0.12, max lines 4
Sound Mixer 0: V8237 [plughw:0,0], version 1.0.12, max lines 4
Sound Mixer 1: V8237 [plughw:0,1], version 1.0.12, max lines 1
Sound Mixer 2: Java Sound Audio Engine, version 1.0, max lines 32
Using Sound Mixer: Java Sound Audio Engine, version 1.0, max lines 32

The sound works fine.   Grin

The fullscreen mode doesn't work, it is still grey BUT the taskbar is no more drawn onto your window Grin!! You're close to your aim.
Resize: window (tile 35) -> full screen (width 1280, height 960, tile 40)

Offline dishmoth
« Reply #38 - Posted 2008-01-30 12:48:38 »

My system loves playing clip objects as it already works fine for my own game. Look at this:
Default Sound Mixer: V8237 [plughw:0,0], version 1.0.12, max lines 4

Ah, the "max lines 4" bit must be what was causing me the problems.  In the old code, when I opened 50 Clips during start up, it was probably throwing an exception after the fourth Clip.  Now that I'm searching for the "best" Mixer ("Java Sound Audio Engine" in your case) rather than the default, and not opening the Clips all at once, I guess it's a lot happier.

Have you noticed sound problems with other games, or is no one else stupid enough to try using Clips in the same way I was doing?

Quote
The sound works fine.   Grin

Excellent!  I can sleep at nights again now.  Grin
Thanks for your patience with all of the testing.

Quote
The fullscreen mode doesn't work, it is still grey BUT the taskbar is no more drawn onto your window Grin!! You're close to your aim.

I've put a few more lines into the full-screen code, but I'm not confident they'll change anything.  If the window appears over the taskbar, then I guess that FSEM is triggering.  But if the window is grey then it sounds like the BufferStrategy on the Frame isn't working for some reason.  Hmm.  Please give the full-screen mode one last try, and if it doesn't work I may have to conclude that it's a Windows-only feature, at least until I have some new ideas.

Thanks,
Simon

Offline gouessej
« Reply #39 - Posted 2008-01-30 19:45:29 »

Please give the full-screen mode one last try, and if it doesn't work I may have to conclude that it's a Windows-only feature, at least until I have some new ideas.
[size=20pt]THE FULL-SCREEN MODE IS NOT A WINDOWS-ONLY FEATURE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![/size]

The full-screen mode works fine in my own game under Windows, Mac AND Linux and I don't use setFullScreenWindow(Window w) because it works fine only with Java 1.6 and the benefit under Linux is null because our window managers are clever enough to decide alone to put a window into exclusive full screen mode (under KDE as far as I know) if it occupied all the screen. I advised you to look at my source code that works under several operating systems in order to accelerate your search. On my view, detect the operating system in your code; if it is not Windows, apply only the fake method (an undecorated frame as tall as the screen), otherwise apply your current method. Java is cross platform. If you don't succeed in getting the same correct behavior on all operating systems, it is a serious problem. Don't conclude that the full-screen mode doesn't work under Linux in Java whereas it doesn't work especially in your game.

N.B : the sound works still fine but it is still grey. The method isFullScreenSupported() often returns true in Java under Linux whereas it is not required to use setFullScreenWindow.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dishmoth
« Reply #40 - Posted 2008-02-03 14:08:08 »

THE FULL-SCREEN MODE IS NOT A WINDOWS-ONLY FEATURE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Sorry, I meant a Windows-only feature of my game.

I've changed the code so that it always assumes that isFullScreenSupported() returns false if the operating system ("os.name") is "Linux".  Let's see if that makes any difference.

Cheers,
Simon

Offline CommanderKeith
« Reply #41 - Posted 2008-02-03 14:29:21 »

It's looking really polished. The animations on the text are great and the bright colour scheme really suits.

It would look just like a Flash game if the menus were a bit better-looking and comic-y and there was more animations and activity in the start screen and on the green while playing.  Like maybe shadows of birds flying past, or bigger, moving flowers, or having those floozy pink bunnies clap on the side-lines (and if you hit them you're disqualified?  Smiley ).

Nice work!

Offline gouessej
« Reply #42 - Posted 2008-02-03 14:46:58 »

Sorry, I meant a Windows-only feature of my game.
I've changed the code so that it always assumes that isFullScreenSupported() returns false if the operating system ("os.name") is "Linux".  Let's see if that makes any difference.
It works fine! Good work! The sound works perfectly, I hear everything fine. The full-screen mode works too!

Offline dishmoth
« Reply #43 - Posted 2008-02-04 11:25:06 »

It works fine! Good work! The sound works perfectly, I hear everything fine. The full-screen mode works too!

Wonderful!
A million thanks for all your help with this.
Simon

Offline dishmoth
« Reply #44 - Posted 2008-02-04 11:55:13 »

It would look just like a Flash game if the menus were a bit better-looking and comic-y and there was more animations and activity in the start screen and on the green while playing.
I think that (commercial) Flash games may have a slight advantage in that they're made by people who can draw.  Putting two eyes on a circle is about the limit of my artistic talents. Tongue  Being a bit like a Flash game is something I'm happy to take as a compliment though.

Quote
Like maybe shadows of birds flying past ...
Actually, that's something even I might be able to draw...

Quote
... or bigger, moving flowers ...
Moving flowers?!  Were you playing the game after coming back from the pub? Grin

Quote
... floozy pink bunnies ...
That would make a great title for the sequel! Grin

Thanks for the comments!
Simon

Offline gouessej
« Reply #45 - Posted 2008-02-04 22:21:45 »

Wonderful!
A million thanks for all your help with this.
Simon

Helping you is a way of helping Java gaming in general. It was a pleasure. Good luck. I will follow the improvements of your game.

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #46 - Posted 2009-08-20 20:04:42 »

Very nice little game.

+1 point if the game installs and uninstalls correctly
+1 point if the game doesn't crash ever
+1 point if the game is slickly presented
+1 point if the game has "good" graphics that suit the game
+1 point if the game has "good" sound that suit the game
+1 point if the game's overall style is "good"
+1 point if the game is original or brings a great new original twist
+1 point if your judge enjoyed playing the game
+1 point if the game is complete enough that doesn't feel anything is missing
+1 point if you don't whine and you demand nothing of the mods (simply saying "can you rate my game please" is fine)

Overall game gets a 10/10.

game is generally well done, however feels a little bland (or too clean), adding a few more details around the level/game would make it much more polished, small things like maybe some more flowers or small NPC's running around and maybe sprinkle some more particles and glitter.

FEATURED.
Pages: 1 [2]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

ctomni231 (35 views)
2014-07-18 06:55:21

Zero Volt (31 views)
2014-07-17 23:47:54

danieldean (26 views)
2014-07-17 23:41:23

MustardPeter (28 views)
2014-07-16 23:30:00

Cero (43 views)
2014-07-16 00:42:17

Riven (45 views)
2014-07-14 18:02:53

OpenGLShaders (34 views)
2014-07-14 16:23:47

Riven (35 views)
2014-07-14 11:51:35

quew8 (31 views)
2014-07-13 13:57:52

SHC (67 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!