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.

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.

So, it should be much superior to the Swing.Timer for simple game loop purposes.

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.

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 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.

Well, I decided to completely rewrite my game engine 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.<init>(Unknown Source) at java.net.Socket.<init>(Unknown Source) at jdoodlejump.HighScores$3.run(HighScores.java:149)

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

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 I enjoyed playing it several times as you can see in the highscores. Great job Have you had any problem of copyright?

Just tried it on gamejolt (thx for rating my game ). 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)

I use Oracle Java 1.6 update 25 & 26. With OpenJDK 1.6, I have often no sound as many Java applications try to get Java Software Audio Mixer which is only in Oracle Java. Maybe OpenALSoft would be a better solution than plain JavaSound.

Installation: +0 - I took off a point because it won't run in Safari and took literally 18 minutes to download all of its assets and startStability: +0.5 points - The game didn't crash, but after I went to the high score menu then back to the main menu and started a game, it was frozen and wouldn't continuePresentation: +0 - The presentation feels kind of lackluster, honestly. Could use a little bit of sprucing up.Graphics: +1 point if the game has "good" graphics that suit the game - although I'd make your own graphics instead of lifting the Doodle Jump ones directlySound: +1 point if the game has "good" sound that suit the gameStyle: +1 point if the game's overall style is "good"Innovation: +0 - A clone of Doodle Jump, so nothing newFun Factor: +1 point if your judge enjoyed playing the gameCompleteness: +1 point if the game is complete enough that doesn't feel anything is missingFreebie: +1 point if you don't whine and you demand nothing of the mods (simply saying "can you rate my game please" is fine)6.5/10

Not featured, yet. It is what it is (a clone of Doodle Jump), but you can still be featured for sure if you fix some things. #1 most important and easiest win is to make the game start up faster than 18 minutes. That's pretty crazy, no player is going to stick around for that. Especially because the game isn't exactly graphically intensive. Maybe you need a faster server? The Safari problem might not even be your issue, I wouldn't worry too much about it yet. I'd try to repro my bug that I knocked off 0.5 for stability (play the game, die, go to high scores, navigate around in them, go back to the main menu, start the game, notice it never unpause).

If you fix both of those, you're up to an 8 which is easily featured (you only need a 7). But I'd also look to improving your presentation, generally just making the game more responsive and feel better to interact with. Right now it feels finicky and kind of.. applet-y (sorry to say).

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