Doodle Jump for PC

Works fine in Mac Os X Safari for me.

Thanks for feedback.

Guys, I have just updated JDoodle Jump, finally getting rid of of javax.swing.Timer and it works much better now. I suggest to anyone starting game dev to make their own game loop and NEVER use Timer.

Have you tried my suggestion? It does not work on my machine…

Yes I have been extensively testing with Canvas and Applet but BufferStrategy and other issues are giving me trouble.

[quote]Guys, I have just updated JDoodle Jump, finally getting rid of of javax.swing.Timer and it works much better now. I suggest to anyone starting game dev to make their own game loop and NEVER use Timer.
[/quote]
Since I’ve used a Timer and had no problems, an absolute “NEVER” makes me pause. You don’t say whether you’ve tried a util.Timer (the only type I’ve used). Maybe it doesn’t exhibit the same problems as a Swing.Timer?

In pursuit of knowledge, I searched for and just found this article:
http://java.sun.com/products/jfc/tsc/articles/timer/
It purports to describe the differences between the two timers and how to choose which one to use…
Reading…
The most significant diff seems to be that the Swing Timer(s) all execute code on the EDT, whereas the util Timer spawns independant background threads. Thus, it seems like the Swing.Timer should only be used for quick GUI-related tasks, like blinking a cursor. And thus, maybe NOT a good choice if this Timer is also responsible for updating game data. Nothing like a good collision detection algorithm to clog up the EDT? The util.Timer however spawns separate background threads, and has a bit more functionality. So, it should be much superior to the Swing.Timer for simple game loop purposes.

I’ve actually never even looked at java.util.Timer.
Thanks for the info!

Beware synchronization issues accessing variables across multiple threads. If you use a Swing timer, you won’t have this issue, as your updates and rendering will both be done on the EDT. If you use a java.util.Timer, you have to handle this yourself.

This isn’t a vote for one Timer over the other, but it is a suggestion to keep your game single-threaded if at all possible. Makes game logic much simpler, and avoids having to synchronize every frame.

I use 1 thread for updating and I use the EDT for repaint.

Did some extensive testing and what I found out was very weird.
Using JComponent, wherever I add MouseListener works, only adding KeyListener on contentPane works.
Using Canvas, only adding MouseListener and KeyListener on the Canvas works.

So AWT components work better with listeners than Swing components? Huh?

EDIT: These tests were done in AppletViewer and in all major browsers.

Well, I decided to completely rewrite my game engine :smiley:
This is one feels very professional and works quite well.

Could anyone test to see if I have correctly implemented KeyListener and MouseListener this time around?
What I did was have a Canvas where I would draw everything into, instead of having 2 different JComponent’s. All I did was create an InputListener class that you would attach to my Game class, which would delegate all mouse, motion, scroll, and key events to the InputListener.

I have still the same bug, sorry. I don’t know what is wrong. This is the same symptom, nothing happens when I press a key but the mouse works.

Edit.: It works now, it depends on when I start pressing any key at the first time, strange :s

Edit2.: I get this:
java.security.AccessControlException: access denied (java.net.SocketPermission 24.131.46.230:5050 connect,resolve)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkConnect(Unknown Source)
at sun.plugin2.applet.Applet2SecurityManager.checkConnect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.(Unknown Source)
at java.net.Socket.(Unknown Source)
at jdoodlejump.HighScores$3.run(HighScores.java:149)

Well I’m glad that’s resolved :smiley:

About that AccessControlException, I believe it is a problem on your side since I open a socket to the same IP address as the web server, which is allowed. Plus it works for the hundreds of other visitors that visit my site daily :slight_smile:

Thanks for trying it! ;D

It does not work when I’m behind a proxy, you’re right, it is not your fault.

The bug is mainly resolved but it still happens sometimes, maybe it has something to do with the annoying popups (not yours, only the ads). Do you plan to use sourceforge.net?

I have a link to a zip file containing the source code so I don’t think I will be using sourcefourge.

Sourceforge allows to have an ad-free hosting, a database, a versioning system and your project would be more visible. Using a versioning system would be helpful to follow your projects, the changes, to detect any regression, it is a lot better than a simple ZIP. The ad popups are quite annoying, there is no such popup on Sourceforge. Github is nice too, but GIT is poorly supported in Eclipse 3.6 (it is better in Eclipse 3.7). It is only a suggestion.

Your game is fun :slight_smile: I enjoyed playing it several times as you can see in the highscores. Great job ;D Have you had any problem of copyright?

They have a versioning system? Hmmm I will consider using Sourceforge. Thanks! :smiley:

And glad you enjoy it. I have had no problem with copyright so far (phew :P)

You’re welcome. Sourceforge supports at least CVS and SVN, maybe Mercurial too. I personally use SVN while eGIT does not work reliably in Eclipse. SubClipse and Subversive work fine in Eclipse Helios.

Will you put it into Chrome Web Store?

Thanks for the tips. :smiley:

School is finally over so I now have a lot of time to play with these nifty tools.

How do I put this in the Chrome Web Store?

Just tried it on gamejolt (thx for rating my game :slight_smile: ). Guess I need to run windows?

javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:494)
at com.sun.media.sound.DirectAudioDevice$DirectClip.implOpen(DirectAudioDevice.java:1280)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:107)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1061)
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(DirectAudioDevice.java:1151)
at gameutils.Sound.add(Sound.java:42)
at gameutils.Sound$Loader.run(Sound.java:207)
at java.lang.Thread.run(Thread.java:662)
Exception in thread “Thread-10” java.lang.NullPointerException
at gameutils.Sound.play(Sound.java:99)
at jdoodlejump.bars.Bar.playSound(Bar.java:86)
at jdoodlejump.Doodle.update(Doodle.java:193)
at gameutils.GameWorld.updateComponents(GameWorld.java:89)
at jdoodlejump.JDoodleJump.updateMenus(JDoodleJump.java:431)
at gameutils.Game.update(Game.java:340)
at gameutils.Game.run(Game.java:273)
at java.lang.Thread.run(Thread.java:662)