Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: 1 ... 8 9 [10]
 on: 2014-12-18 23:48:11 
Started by Ed_RockStarGuy - Last post by KudoDEV
Looking good keep up the good work!

 on: 2014-12-18 23:07:43 
Started by BurntPizza - Last post by Mr.CodeIt
Used the java Bluetooth API to scan for all devices with Bluetooth on.

 on: 2014-12-18 23:03:51 
Started by Ed_RockStarGuy - Last post by Ed_RockStarGuy
New world render system seems very stable in the V0.0.1_9 Build you can now have a map 6,400,000,000 tiles in size and have no lag Cheesy epic

 on: 2014-12-18 23:02:35 
Started by matanui159 - Last post by philfrei
I haven't worked with OpenAL, but I am curious about one aspect of your question, and it might lead to a solution.

With Clip (in javax.sound.sampled), a common newbie practice is to reload the sound anew from the source file with each playback. They don't realize that the Clip was designed to only be loaded once, and that there are methods to reposition the "playback head" of the sound back to the start, and replay it.

Is this possible with the sounds you are trying to play? It seems really inefficient to me to have to destroy and reload a sound for the simple task of playing it more than once. Chances are, once it is in memory, there is a way to reset it to the beginning and restart.

 on: 2014-12-18 22:48:15 
Started by RKJ - Last post by BurntPizza
Somehow synchronize access to those shared resources.

Either using synchronized blocks/methods, Locks, or perhaps AtomicReferences.
There are other ways, but these are relatively straightforward.

This way you restrict access to the resource to only 1 thread at a time, so any updates to the resources (which may involve momentary nulls) appear as instantaneous to other threads.

EDIT: or simply don't store temporary values (esp. null) in shared references. This is probably the best solution, but it's good to be acquainted with synchronization since there isn't a workaround sometimes.

 on: 2014-12-18 22:46:39 
Started by RKJ - Last post by RKJ
Yes it is!  Thus, my game is really updating before repaint is completed, since paint is called in different thread. Is there any way to avoid this?

 on: 2014-12-18 22:39:43 
Started by RKJ - Last post by tdegroot96
But Swing creates several threads, one of which is the repaint thread. Otherwise the program would appear to freeze whenever you clicked buttons or something.
Wait.. I remember having to make my own threads for that kind of stuff. Are you sure?

 on: 2014-12-18 22:37:52 
Started by RKJ - Last post by BurntPizza
Yep, that loop uses at least 2 threads. Your thread running that loop, and the Swing EDT thread, which calls paint() sometime after repaint() is called on your thread.


import java.awt.Graphics;
import javax.swing.JFrame;

public class Race {
   public static String str = "Hello World";
   public static void main(String[] a) throws InterruptedException {
      JFrame f = new JFrame() {
         public void paint(Graphics g) {
            g.drawString(str, 0, 0);
      while (true) {
   public static void update() throws InterruptedException {
      str = null;
      Thread.sleep(1); // slight pause while 'update' occurs
      str = "Hello World";

Try resizing the frame with the mouse a bit (to force repaints) and see that very quickly there is an NPE thrown by drawString().

 on: 2014-12-18 22:30:39 
Started by GameQuester - Last post by tdegroot96
I've had this problem once as well. This might have to do with checking collision after moving the player. Try doing it before moving, one axis at a time. Before moving you should check if you can actually add n pixels to the axis. The reply above should get the job done if you cant get it done this way.

 on: 2014-12-18 22:30:08 
Started by RKJ - Last post by HeroesGraveDev
But Swing creates several threads, one of which is the repaint thread. Otherwise the program would appear to freeze whenever you clicked buttons or something.

Pages: 1 ... 8 9 [10]

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50 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‑
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!