Java-Gaming.org
Java4K - to go         Javadoc:
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, peek at the official java tutorials or join us at irc #jgo.
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Tutorials  (Read 6009 times)
0 Members and 2 Guests are viewing this topic.
Offline dah01

JGO n00b
*

Posts: 46
Medals: 13



« on: 2011-03-14 20:13:03 »

Tutorials

* [GameDev Java Game Programming 1](http://www.gamedev.net/page/resources/_/reference/programming/languages/java/java-game-programming-part-i-the-basics-r1262)
* [GameDev Java Game Programming 2](http://www.gamedev.net/page/resources/_/reference/programming/languages/java/java-game-programming-part-ii-making-a-simple-game-r1360)
* [GameDev Java Game Programming 3](http://www.gamedev.net/page/resources/_/reference/programming/languages/java/java-game-programming-part-iii-the-power-of-ar-r1383)
* [Keyboard and Mouse Input](http://www.gamedev.net/page/resources/_/reference/programming/languages/java/java-games-keyboard-and-mouse-r2439)
* [Active Rendering](http://www.gamedev.net/page/resources/_/reference/programming/languages/java/java-games-active-rendering-r2418)
* [Stone Paper Scissor](http://forum.codecall.net/java-tutorials/12858-game-stone-paper-scissor.html)
* [Open GL tutorials](http://www.leolol.com/tutorials/tutorials.html)
* [Double Buffering, Movement, Collision Detection](http://forum.codecall.net/java-tutorials/15969-double-buffering-movement-collision-detection.html)
* [Advanced Vectors](http://forum.codecall.net/java-tutorials/19090-more-about-vectors.html)
* [Regular Expressions](http://forum.codecall.net/java-tutorials/20181-regular-expressions.html)
* [Pong](http://forum.codecall.net/java-tutorials/14191-game-simple-pong.html)
* [2D Java Game Video Tutorials](http://www.youtube.com/user/Catkill666)
* [A few small game tutorials](http://zetcode.com/tutorials/javagamestutorial/)
* [NewBoston Game tutorials](http://www.youtube.com/user/thenewboston#grid/user/A331A6709F40B79D) : [source](http://thenewboston.com/forum/viewtopic.php?f=2&t=82)
* [BlackJack](http://forum.codecall.net/java-tutorials/10373-black-jack.html)
* [Poker](http://www.tweako.com/writing_a_complete_5_card_poker_game_in_java)
* [ApexJava Youtube tutorials](http://www.youtube.com/user/apexjava)
* [ThousandCodes Java Tutorials](http://www.thousandcodes.com/java/game/)
* [Dice Game](http://forum.codecall.net/java-tutorials/8520-tutorial-simple-dice-game.html)
* [Turk4n's game tutorials](http://forum.codecall.net/search.php?searchid=420375)
* [A few Java Game tutorials](http://forum.nystic.com/viewtopic.php?p=89493#p88684)
* [MrJavaHelp Tutorials](http://www.youtube.com/user/MrJavaHelp)
* [Mouse Acceleration](http://bigbanggames.ca/java-mouse-acceleration-tutorial/)
* [Java 2s Tutorials](http://www.java2s.com/Code/Java/Game/CatalogGame.htm)

---

Libgdx Specific

* [BadlogicGames](http://www.badlogicgames.com/wordpress/?category_name=libgdx-tutorial)
* [libgdx wiki intro tutorial](http://code.google.com/p/libgdx/wiki/MyFirstTriangle)
* [Updated tutorial based on above](http://www.dustypixels.com/blog/2010/11/24/libgdx-ogles2-my-first-triangle-tutorial-part-1/)

---
LWGJL Specific

* [Accelerated Java Game Tutorials](http://www.cokeandcode.com/tutorials)
* [LWJGL Ninja Cave Tutorials](http://ninjacave.com/tutorials)
* [SHMUP with source](http://www.fabiensanglard.net/Prototyp/index.php)
* [NeHe Tutorials](http://www.gamedev.net/topic/255734-lwjgl-nehe-tutorials-now-online/page__p__255734#entry255734)

---
Engines, Frameworks, Libraries

* [Slick2d](http://slick.cokeandcode.com/index.php)
* [Java Monkey Engine](http://jmonkeyengine.com/)
* [LWJGL](http://lwjgl.org/)
* [PulpCore](http://www.interactivepulp.com/pulpcore/)
* [JGame](http://www.13thmonkey.org/~boris/jgame/)
* [Golden T Game Engine](http://www.goldenstudios.or.id/products/GTGE/)
* [Espresso](http://www.espresso3d.com/)
* [Xith3d](http://xith.org/)
* [jPCT](http://www.jpct.net/)
* [Ardor3d](http://ardor3d.com/)

---
Source

* [Ultima Clone](http://min.us/mvknFCq#1)
* [A Link the the Past Clone](https://github.com/MrHus/Zelda)

---
Books

* [Killer Game Programming in Java](http://www.amazon.ca/Killer-Game-Programming-Andrew-Davison/dp/0596007302/ref=sr_1_1?ie=UTF8&s=books&qid=1300152540&sr=8-1)
* [Developing Games in Java](http://www.amazon.ca/Developing-Games-Java-David-Brackeen/dp/1592730051/ref=sr_1_1?ie=UTF8&qid=1300152577&sr=1-1)
* [Beginning Java Game Programming](http://www.amazon.ca/Beginning-Java-Game-Programming/dp/1435458087/ref=sr_1_fkmr0_1?ie=UTF8&qid=1300152676&sr=1-1-fkmr0)
* [Advanced Java Game Programming](http://www.amazon.ca/Advanced-Programming-David-Wallace-Croft/dp/1590591232/ref=sr_1_fkmr2_2?ie=UTF8&qid=1300152676&sr=1-2-fkmr2)
* [Pro Java 3D Game Development](http://www.amazon.ca/Pro-Java-3D-Game-Development/dp/1590598172/ref=sr_1_2?ie=UTF8&s=books&qid=1300152779&sr=1-2)
* [AI Algorithms for a Prototype Game Software in Java 1.6](http://www.amazon.ca/Algorithms-Prototype-Game-Software-Java/dp/3639171586/ref=sr_1_2?ie=UTF8&qid=1300152836&sr=1-2)
* [Introductory Programming with Simple Games: Using Java and the Freely Available Networked Game Engine ](http://www.amazon.ca/Introductory-Programming-Simple-Games-Available/dp/0470212845/ref=sr_1_1?ie=UTF8&qid=1300152923&sr=1-1)
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #1 on: 2011-03-14 21:22:44 »

Holy crap this is amazing! **Bookmarked**

Offline dah01

JGO n00b
*

Posts: 46
Medals: 13



« Reply #2 on: 2011-03-14 21:26:07 »

Hours and hours of digging.
Games published by our own members! Go get 'em!
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #3 on: 2011-03-14 21:26:59 »

You sir deserve an appreciation Smiley

Offline dah01

JGO n00b
*

Posts: 46
Medals: 13



« Reply #4 on: 2011-03-14 22:01:12 »

My first one!  Smiley
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #5 on: 2011-03-14 22:03:01 »

Whoa?!? How did I get 9? I help people too much Tongue

Offline Sinuath

Jr. Member
**

Posts: 55
Medals: 2



« Reply #6 on: 2011-03-15 00:24:34 »

You deserve a lot more then one for that! I gave you your second!

Hey [you][/you], you should totally check out my boring Site ~ http://davediel.com/chris
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #7 on: 2011-03-15 00:46:54 »

Hear ya go, I gave you another one. Which brings your total to.....3 Smiley

Offline Nate

JGO Neuromancer
****

Posts: 1033
Medals: 26


mooooo


« Reply #8 on: 2011-03-15 01:33:48 »

No libgdx!? Fail! Wink

Offline dah01

JGO n00b
*

Posts: 46
Medals: 13



« Reply #9 on: 2011-03-15 07:18:01 »

Thanks guys! I'll keep updating it. I'll dig up some libgdx. I gave you 2 or 3 because you answered like every thread I posted in for like a week.
Games published by our own members! Go get 'em!
Offline dah01

JGO n00b
*

Posts: 46
Medals: 13



« Reply #10 on: 2011-03-15 07:56:30 »

Now with the only books anyone ever mentions!
Offline adon_y_coya

JGO n00b
*

Posts: 37
Medals: 1



« Reply #11 on: 2011-03-15 13:14:04 »

Thanks! Appreciated!
Offline Nate

JGO Neuromancer
****

Posts: 1033
Medals: 26


mooooo


« Reply #12 on: 2011-03-15 14:11:32 »

For learning Java in general I'd recommend Thinking in Java for noobs. If you have a little programming experience already, this online book moves a little faster:
http://math.hws.edu/javanotes/

Offline ReBirth

JGO Ninja
***

Posts: 747
Medals: 10



« Reply #13 on: 2011-04-17 20:37:35 »

The link titled "Turk4n's game tutorials" can't be accessed

Twitter @drabiter
Offline Gingerious

JGO n00b
*

Posts: 26
Medals: 2



« Reply #14 on: 2011-06-21 20:45:27 »

Great compilation of information.

I'm stuck on the GameDev Java Game Programming 2 link.  I figured out that I was getting an error because the author forgot to import java.awt.*;, but now it appears that my repaint() function isn't working correctly.  The count for i is not increasing and it just stays stuck at i = 0.

Does anyone know why this is?  Here's his code below:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
import java.applet.*;
import java.awt.*;

public class SampleThread extends Applet implements Runnable
{
   Thread t;
   int i;
   
   public void init()
   {
      t = new Thread();
      t.start();
     
      i = 0;
   }
   
   public void run()
   {
      while(true)
      {
         i++;
         repaint();
         
         try{
            t.sleep(1000);
         } catch (InterruptedException e) { ; }
      }
   }
   
   public void paint(Graphics g)
   {
      g.drawString("i = "+i, 10, 20);
   }
}


And here's the html page running it:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
<HTML>
<HEAD>
<TITLE>Sample Thread Applet</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Sample Thread Applet</H1>
<APPLET CODE="SampleThread.class">
</APPLET>
</BODY>
</HTML>


Thanks to anyone who can help me!
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #15 on: 2011-06-21 20:59:41 »

You should have started a new thread instead of hijacking an old thread.

But to answer your question, try putting the word "volatile" before the declaration of "int i;"

This happens because usually the CPU caches data that is in use often, instead of accessing RAM repeatedly. This causes variables to not be in sync, especially here since you have a thread updating "i" and another thread, the EDT, repainting the screen. Setting a variable as "volatile" makes sure it is updated among all threads.

Offline Gingerious

JGO n00b
*

Posts: 26
Medals: 2



« Reply #16 on: 2011-06-21 21:16:26 »

Sorry about that.  If a mod can take my first post and create a new thread for it and the responding posts, that would be awesome.

Regarding adding volatile to the declaration of int i, that didn't seem to work.  Nothing seemed to change.

Just so I'm clear in my understanding, the thread I created is updating the value of i, but another thread exclusive to handling events in the AWT is created when calling repaint(), correct?
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #17 on: 2011-06-21 21:19:54 »

Right but it is not created, it is a queue that dispatches events, hence its called the Event Dispatching Thread, EDT.
And also remove that call to "i = 0" that will set "i" back to 0 after the tread starts incrementing it.

Offline Gingerious

JGO n00b
*

Posts: 26
Medals: 2



« Reply #18 on: 2011-06-21 21:30:12 »

I commented out the initialization of i, but still no dice.  I shouldn't have to use a lock, should I?
Offline philfrei

Sr. Member
**

Posts: 434
Medals: 21



« Reply #19 on: 2011-06-21 21:56:50 »

When you create the thread, you need to include "this"

1  
t = new Thread(this);


That's the only way the compiler knows to use the run method you put in.

Also, when you sleep, it might be better to use this form:

1  
Thread.sleep(1000);


The "i = 0;" in init doesn't hurt anything. The init code is only executed once. But it is not needed because when you declare i as an instance variable, the default value of 0 is assigned.

"Life is short, art long, opportunity fleeting, experience treacherous, judgment difficult." Smiley
Offline Gingerious

JGO n00b
*

Posts: 26
Medals: 2



« Reply #20 on: 2011-06-21 22:02:49 »

Philfrei, that seemed to work, thanks.  Does that mean the compiler was using some default run method instead of the one I wrote for it?
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #21 on: 2011-06-22 01:56:00 »

Haha wow I can't believe I didn't notice that. Yeah you need to give Thread the actual Runnable who's run() method should be called, else it uses an empty run() method Tongue

Offline The Voice

JGO n00b
*

Posts: 2



« Reply #22 on: 2011-12-15 01:42:22 »

To many links Smiley...
Online ra4king

JGO Kernel
*****

Posts: 2342
Medals: 152


I'm the King!


« Reply #23 on: 2011-12-15 01:48:59 »

Click em all!!

Offline pyro sauce

JGO n00b
*

Posts: 2



« Reply #24 on: 2011-12-16 22:46:06 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
import java.applet.*;
import java.awt.*;

public class SampleThread extends Applet implements Runnable
{
   Thread t;
   int i;
   
   public void init()
   {
      t = new Thread();
      t.start();
     
      i = 0;
   }
   
   public void run()
   {
      while(true)
      {
         i++;
         repaint();
         
         try{
            t.sleep(1000);
         } catch (InterruptedException e) { ; }
      }
   }
   
   public void paint(Graphics g)
   {
      g.drawString("i = "+i, 10, 20);
   }
}


Thanks to anyone who can help me!


Try this code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
import java.applet.*;
import java.awt.*;

public class SampleThread extends Applet implements Runnable
{
   /**
    *
    */

   private static final long serialVersionUID = 1L; //This is a default ID
  Thread th;
   int i;
        //Initialize vars and such...
  public void init()
   {
      th = new Thread();
      i = 0;
   }

       //Start the Thread...
  public void start() {
      th = new Thread(this);
      th.start();
   }

   public void stop() { //Stopping a thread is important, and destroy() is deprecated so we use this instead
     th = null;
   }

   @Override
   public void run() {
      Thread thisThread = Thread.currentThread();

      while (th == thisThread) {//just makes sense there, if th is null (say, if we wanted it to stop by using stop(),
               //or if it was null because you closed the application straight up) then it wont equal thisThread
                //and it will stop without giving you an error
        i++;
         repaint();

         try{
            Thread.sleep(1000);
         } catch (InterruptedException e) {
                             break; //why didn't you have this there in the first place?
                       }
      }
   }

   public void paint(Graphics g)
   {
      g.drawString("i = "+i, 10, 20);
   }
}

If that doesn't work it's gotta be something wrong with the HTML or something else...
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.17 seconds with 22 queries.