Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Tutorials  (Read 13755 times)
0 Members and 1 Guest are viewing this topic.
Offline dah01

Junior Duke


Medals: 7



« Posted 2011-03-15 00: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)
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2011-03-15 01:22:44 »

Holy crap this is amazing! **Bookmarked**

Offline dah01

Junior Duke


Medals: 7



« Reply #2 - Posted 2011-03-15 01:26:07 »

Hours and hours of digging.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #3 - Posted 2011-03-15 01:26:59 »

You sir deserve an appreciation Smiley

Offline dah01

Junior Duke


Medals: 7



« Reply #4 - Posted 2011-03-15 02:01:12 »

My first one!  Smiley
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2011-03-15 02:03:01 »

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

Offline Sinuath

Junior Duke


Medals: 2



« Reply #6 - Posted 2011-03-15 04: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
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #7 - Posted 2011-03-15 04:46:54 »

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

Offline Nate

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #8 - Posted 2011-03-15 05:33:48 »

No libgdx!? Fail! Wink

Offline dah01

Junior Duke


Medals: 7



« Reply #9 - Posted 2011-03-15 11: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! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline dah01

Junior Duke


Medals: 7



« Reply #10 - Posted 2011-03-15 11:56:30 »

Now with the only books anyone ever mentions!
Offline adon_y_coya

Senior Newbie





« Reply #11 - Posted 2011-03-15 17:14:04 »

Thanks! Appreciated!
Offline Nate

JGO Kernel


Medals: 149
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #12 - Posted 2011-03-15 18: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
« Reply #13 - Posted 2011-04-18 00:37:35 »

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

Offline Gingerious

Junior Duke


Medals: 2



« Reply #14 - Posted 2011-06-22 00: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!
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #15 - Posted 2011-06-22 00: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

Junior Duke


Medals: 2



« Reply #16 - Posted 2011-06-22 01: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?
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #17 - Posted 2011-06-22 01: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

Junior Duke


Medals: 2



« Reply #18 - Posted 2011-06-22 01: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
« Reply #19 - Posted 2011-06-22 01: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.

"It's after the end of the world! Don't you know that yet?"
Offline Gingerious

Junior Duke


Medals: 2



« Reply #20 - Posted 2011-06-22 02: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?
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #21 - Posted 2011-06-22 05: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

Junior Newbie





« Reply #22 - Posted 2011-12-15 06:42:22 »

To many links Smiley...
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #23 - Posted 2011-12-15 06:48:59 »

Click em all!!

Offline pyro sauce

Junior Newbie





« Reply #24 - Posted 2011-12-17 03: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]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (35 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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

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