4 Replies Latest reply on Jun 6, 2010 10:19 AM by 843853

    Java Game Developing in general

      I'm pretty good at Java in general, although i still have some stuff i need to learn about.
      I can make some Java apps, but i've decided to look up Java Game developing.

      So where can i find some good articles to get me started? Only ones i found on Google were an outdated book and an even more outdated guide.
        • 1. Re: Java Game Developing in general
          Java Tutorial is always a good place to start.

          I did a Google with "java game development" and there are several very relevant articles in the first 10 listings.

          There are also several books on the subject and they can be see by adding books to that same query.
          • 2. Re: Java Game Developing in general
            This is a good tutorial/example how to create a space invaders game using Java. The later articles show how to do this with LWJGL, which is an API set that allows you to use OpenGL, OpenAL and gives access to gaming devices on several operating systems.


            Also, I would look into using Slick, which is an easy framework to create 2D games with.


            In any case, if you want to learn game development, it is good to put some effort into learning what OpenGL is all about. It would be better to try and learn that outside of the Java environment - there are far more resources available for C++ programming for example. The code should not be that hard to convert using an API like LWJGL.
            • 3. Re: Java Game Developing in general
              I'm following this good tutorial:

              • 4. Re: Java Game Developing in general
                Hi, I'm new, I have a project game 3d for graduate, but I did not proficient. I want loader a file m3g, (use blender), but when I write program is don't run, and error "can not found MIDlet". People, help me please. Now, I don't know how to write code. My thinking is create a object3D than more a flying disc and loader in the Canvas, my game is very simple, may control a fly disc avoid sprites in the mobile. I try fix error but do not. This my code canvas, I think I did false:
                * To change this template, choose Tools | Templates
                * and open the template in the editor.

                package Skywar.m3g;

                import javax.microedition.midlet.*;
                import javax.microedition.lcdui.*;
                import java.lang.Object;
                import javax.microedition.m3g.*;
                import java.util.Timer;
                import java.util.TimerTask;
                import javax.microedition.lcdui.game.*;

                * @author BDPL
                public class SkywarCanvas extends Canvas implements Runnable {
                private static final String sk = "/sk.m3g";
                // public static final int mb_ID = 2;
                public SkywarCanvas mCanvas;
                public Camera mCamera;
                public World mWorld;
                public Graphics3D g3d;
                public Group root;
                public boolean isRunning = true; //truy van canvas
                //private TimerTask mRefreshTask = null;
                //private Timer mRefreshTimer = new Timer();//thoi gian lam tuoi
                private static final float g3dx = 15.f;//toa do truc x cua doi tuong tren man hinh 2D
                private static final float g3dy = 0.25f;//toa do truc y cua doi tuong tren man hinh 2D
                //private AnimationController animSky = null;
                private int oldg3dX = 1; //toa do cu theo truc X
                private int oldg3dY = 1; //toa do cu theo truc Y
                private int width = getWidth();//chieu cao cua canvas
                private int height = getHeight();//chieu rong cua canvas
                //private boolean isplay;//kiem tra vong lap sprite
                //private long delay;
                // private int sprx, spry;//toa do hien tai cua sprite

                //bat dau canva

                public void showNotify(int sleeptime){
                //tao ra mot luong chay game
                Thread thr = new Thread();
                isRunning = true;
                //dung canvas
                public void hideNotify(){
                isRunning = false;
                //khoi tao doi tuong vaf load doi tuong
                protected void init(){
                g3d = Graphics3D.getInstance();
                Object3D[] object = Loader.load("/sk.m3g");
                mWorld = (World) object[0];
                Camera mC = mWorld.getActiveCamera();
                float aspect = (float) getWidth()/(float) getHeight();
                mC.setPerspective(60.f, aspect, 1.0f, 1000.0f);
                } catch (Exception e){
                /* public void getObject(){
                root = (Group)mWorld.find(mb_ID);
                //bao gom cac hoat canh va mot so doi tuong khac ve thoi gian
                public void run(){
                while (isRunning){
                if ((mWorld != null)&& (g3d != null)){
                int sleep = (int)System.currentTimeMillis();
                //co the goi boi canh ra roi moi den doi tuong
                try {
                } catch (Exception e){}

                protected void paint(Graphics g){
                //cat 1 hinh chu nhat de hien thi
                if ((g.getClipWidth() != width) || (g.getClipHeight() != height) ||
                (g.getClipX() != oldg3dX) || (g.getClipY() != oldg3dY)) {
                g.fillRect(0, 0, mCanvas.getWidth(), mCanvas.getHeight());

                // render the 3D scene
                if ((g3d != null) && (mWorld != null)) {
                g3d.setViewport(oldg3dX, oldg3dY, width, height);
                public Displayable getD() {
                //thu tuc dieu khien doi tuong
                public void keyPressd(int keyCode){
                int gameAction = getGameAction(keyCode);
                if(gameAction == Canvas.FIRE){
                Transform transform = new Transform();
                float[] direction = {0.0f, 0.0f, g3dy, 0.0f};
                mWorld.translate(direction[0], direction[1], direction[2]);
                } else {
                case Canvas.LEFT:
                mCamera.postRotate(g3dx, 0.0f, 1.0f, 0.0f);
                case Canvas.RIGHT:
                mCamera.postRotate(g3dx, 0.0f, -1.0f, 0.0f);
                case Canvas.UP:
                mCamera.postRotate(g3dx, 1.0f, 0.0f, 0.0f);
                case Canvas.DOWN:
                mCamera.postRotate(g3dx, -1.0f, 0.0f, 0.0f);
                public SkywarCanvas(){
                * duoc su dung nham lam tuoi che do cho canvas moi khi chay
                private class RefreshTask extends TimerTask{
                public void run(){
                /* public String name() {
                return("Binary World");
                I use Netbeans6.8, but I don't know folder resource of a project. I see, when build project with WLTK 2.5.2, has folders "src" and "res", but when build with Neatbeans, I don't see folder "res", so we put resource in where?. Because, I know j2me not long ago, so not understand much. Everybody help me complete this game, please. I need write code Sprite3D, but don't know how to start, and how create sprite3d.....
                If you have code this problem, send for me (haingoc.cntt.tn@gmail.com), Thanks.

                Edited by: Ngoc_miao on Jun 6, 2010 3:18 AM