Libjcsi to the Rescue

I have previously written about my recent exploits in the game development field. To make sure I gain Java programming skills during this exercise, I am writing the whole game in Java. So far I tried rolling my own graphics drawing code. That turned out to be difficult. Some output looked ok. Other graphics were slightly off. This was painful.

Another developer recommended that I use their graphics package libjcsi. This package covers simplifies console output for you. I tried compiling their sample program. In 10 minutes I had a graphical user interface up and running. In an hour I had a bare bones screen of my game going. I was pleasantly surprised that this package also handled keyboard input. So I quickly coded up user input to control the direction of the main character. I now got a guy running around my simple screen. Life is good.

Next I think I will try to place objects on the screen that represent gold. Then if the user walks over top the gold, I want to register that the user picked the gold up. These all seem like baby steps. But once I get the basics down, I can rocket into more complex ideas I have about my game. I will say that I still do not have the hang of Java packages. Perhaps by the time I complete my game, I will have them nailed down.

Screen Output

I am writing a game in Java called dL1. And I need to display a two dimensional grid for the user interface. After Googling the subject, I thought I would try to use the Curses library to do the output. There is a JCurses package for Java which seemed easy.

After I got into JCurses, it took a while to get the test code from the package compiled. However I could never get the test to run without aborting with an exception. I only have 7 days to complete my game for a programming contest. So I decided to roll my own graphics code.

This is a monumental task. However I already have an applet which is displaying some text. Now I need to get my vertical and horizontal positioning down. And I also need to learn how to erase graphics on my screen. But at least I have something to show for it. You can see a screen shot of my first try on my Angband blog page.

Missing Arrays

I am halfway through my college class on Java. There are a number of topics we have not covered yet. Normally that is fine, as we will eventually get to them. However I just entered a programming contest to write a Java game in 7 days. My game will be called dL1.

We have yet to cover packages, arrays, or file input/output. That is a bummer. My game will be on a two dimensional grid. That's where arrays would really come in handy. My plan is to substitute objects that references each other for arrays.

I was hoping to use some third party code to do the actual drawing for my game. So I cannot wait any more. I am reading ahead in my course book to see how to use packages. As of last night, I still had not mastered the topic. I really need to get a move on it. The contest ends in 7 days and I have one Java file which does not compile. May the Force be with me.

Garbage Collection

I read the magazine Software Test and Performance. This is because formal testing plays a large role in the project I work on. The development team does unit testing. An internal team does integration, functional, and regression testing. A customer team conducts software acceptance testing. I need to keep up with the world of testing.

A recent article in the magazine talked about the Java environment. Specifically they referred to it as managed. To me that sounds like Dot Net. They were referring to Garbage Collection. And they thought that it was a danger.

Yes the garbage collector looks after memory in the Java environment. However Java programmers just assume the garbage collector will do its job. Objects which go out of scope are supposed to be cleaned up. However if the garbage collector does not know about an object, or can't determine that we are done with it, the memory will remain unclaimed.

Some industry experts were consulted. One of them said that inefficient code leads to memory problems, even in Java. The recommendation was to be proactive in testing Java applications. The use of automation in testing was also suggested. It was stressed that any Test Driven Development cover all paths in the software.

Here I thought the garbage collection idea was a nice one. I come from the land of C and C++. It is a lot of work to manually control the allocation and freeing of memory. Java is actually a fresh perspective on memory reallocation. But with most things, you can get in trouble if something or someone other than you takes care of the hard tasks. I have learned that by dealing with frameworks for a number of years.

Java FX Mobile

Sun Microsystems has released Java FX Mobile. It is for development of Rich Internet Applications (RIAs). Java FX Mobile is based on Java Micro Edition (Java ME). As you would expect, it is similar to the desktop version of Java FX.

Java FX Mobile can run as an applet in a browser, on the desktop, or on a mobile phone. You know it is going to be targeted to mobile phones. However the beauty of it is that it also works elsewhere.

Java FX itself comes with a lot of default behavior built in. That means it should be easy for developers to produce applications which immediately fall back to defaults which work well. This is unlike plain Java, where you need to roll a lot of your own code from scratch.

There is a Java FX software development kit (SDK) available. I know that as soon as I get a handle on Java basics, I am going to want to be trying different frameworks and APIs in the Java world. Perhaps I may take Java FX Mobile for a spin.

GlassFish Portfolio

When I started learning Java, I downloaded the JDK from Sun like I assume everyone else did. There was one bundle that came with GlassFish, which is an application server from Sun Microsystems. I opted not to get it.

Sun apparently is releasing more stuff for GlassFish with their GlassFish Portfolio. This is a four piece set of products that are related to GlassFish. Now these products are not for free. I think this is one place where Sun plans to actually make some money.

The GlassFish Portfolio consists of the GlassFish web stack, Enterprise Service Bus, Web Space Server, and Management Toolkit. Before downloading the JDK and seeing the GlassFish option, I had never even heard of GlassFish. I suppose that means that not many people use it. Websphere and Weblogic seem to own the application server market. Perhaps some add-ons like the GlassFish Portfolio may help Sun try to even the gap. Alas they may already be too far behind in the race.

Java Platform Bloat

I keep my eyes peeled for any software articles about Java. Recently I read a front page article about Java Enterprise Edition 6 being very bloated. A solution is to wait for the Java Standard Edition 7 to come out. However I get the feeling that Java SE 7 is somehow delayed for a long time.

In the mean time, there is a feature of Java EE 6 called profiles. It allows you to work with a smaller subset of the huge Java EE 6 platform. Unfortunately there is only one profile available. It is the Web Profile bundle. That seems like a useful one. But it would be good if there were a number of profiles readily available.

Luckily the Java Development Kit 7 is supposed to include a feature called modules. It too will allow you to work with a smaller subset of the platform. Right now I only deal with the Java 6 SE. That alone seems large when I query the Java API. I cringe at the thought of working with Java EE 6, which is supposed to be a beast.