Skip to main content

Return to Java

After playing around with Java in the early days (JDK 1.2/1.3) and doing lots of JNI work, I left that area and worked mainly in C code and got lured into the C#/.NET world.

Recently I evaluated lots of toolkits with the idea of playing around with 2D games and stuff like that. I found some C# DirectX projects, but nothing great. The interesting toolkits/libraries like :

C#

SDL.net
Irrlicht.NET

I found lots of others, but nothing that had either a small download for development (didn't want to download 400MB SDK), small deployment runtime, and was pure C#.

Then I toyed with some native toolits, there are a lot more to choose from:

Native

HGE - excellent Windows 2D C++ toolkit
SDL - cross platform C/C++ toolkit
PureBasic - excellent, easy to get sprites blitting examples up and running, hard to judge performance because demo is always in debug mode but IDE is great and easy to use
BlitzPlus - demo seemed ok, bad IDE, samples were not good.


I saw an extra set of SDL bindings for the D language that were great, the sample games were extremely fast and minimal system impact. D looks interesting, much more so than C++ which I am not interested in.

MS have keep making C# and managed direct X incompatible with each release and now it's deprecated and they are wanting developers to move to XNA, which is a C# system for PCs and the XBOX360. It's not cross platform or small, but it is free in that XNA Studio and Visual Studio Express are free downloads.

Then I had a thought that if I was looking at Basic, C,C++ or D, then why not Java. I had some limited experience of it already. C, C++ and Java are the industry first choice languages and extra experience would help with work.
If C# can be used for games, then so can Java, in fact Java has improved in leaps and bounds since the old games and there seems to be go reason for not choosing Java.

Java has progressed a lot

I found a few small Java game toolkits and played around with those. It was fun to reboot into Ubuntu and run the same samples (at twice the performance of Windows).
I looked into enabling the Java2D rendering with DirectX on Windows and OpenGL on both and the performance was great.

I'm going to code up some small demos and samples for fun and learning.

With 3D, the Java choices are much improved these days. Java3D looks excellent.

Java3D
jPCT - excellent performance on my machine
lwjgl - excellent toolkit used for lots of new Java games
Java Quake2 - runs really fast for me

A killer new Java feature is Web Start. It's excellent at letting people run a program with a single click, I found that to be a brilliant way to run demos and samples.

My PC is a dual CPU Athlon X2 so it's quick. But my graphics card is the onboard nvidia type, so I figure that if things run fast for me, then they'll run faster for people with proper gfx cards. I guess I'll get something like a 7600 GS later on.

As I find more toolkits I'll add news about them and other Java desktop programs.

Popular posts from this blog

Overcome Java JNI gdb errors on GNU/Linux

If you happen to try to debug any Java JNI programs using gdb on GNU/Linux you will soon come across error messages. For example : $ gdb --args java MyJavaProgramUsingJNI cannot find user-level thread for LWP nnn: generic error warning: Cannot initialize thread debugging library: versions of libpthread and libthread_db do not match The reason for this is that the java program mucks around with LD_LIBRARY_PATH and that prevents gdb from running correctly. To overcome this, you have to run your Java program and place a pause in the Java code, such as reading a key, and then in another shell, run gdb to attach to the running Java process. You can then set your breakpoint on your JNI code and debug it. Here is an example : Compile your Java program: $ javac JNITest.java Generate the JNI header file: $ javah -jni JNITest.java Create and compile your C code library: $ cat jnilib.c #include "JNITest.h" JNIEXPORT jint JNICALL Java_JNITest_addValues( JNIEnv...