Sunday, October 16, 2011

GWT and HTML Canvas

I started to learn Google Web Toolkit this weekend and am very pleasantly surprised.
I installed it via Eclipse update site and got right to work.
I was able to manipulate the base project and look at the demos to figure out stuff.
I was interested in creating a demo site using HTML 5 Canvas. With little effort and writing zero JavaScript I was able to get an effective Demo.
I used mainly base GWT classes but I did use some of the classes in gwt-g2d. The main classes appear to be partly integrated into GWT so I mainly just used the support classes. It would be nice if gwt-g2d did some of the things it had on it's list and wrapped GWT's canvas classes.
GWT's tooling was very refreshingly fast and easy to use.
I was able to write a little demo artificial intelligence app to show off different programming techniques I had learned in the class I'm taking.

It would be nice if I could fail over my canvas to something else for browsers that don't support HTML 5. LimeJS appears to do this autmatically. LimeJS is probably better for writing HTML based games but I don't want to write a bunch of JavaScript which is why I like GWT. GWT automatically converts all my Java code into JavaScript for me.

Another thing is it puts the war contents in a war directory. All the conventions I've seen it is always a WebContent folder. Also the default source and test directories don't match the standard Maven structure which I imagine I could manually change but it's nice to be able to do it when creating a new project.

Saturday, October 1, 2011

WebGL and game development

I would like to create a game with WebGL and have mainly a Java background.
I don't have much game development experience and no professional experience.
I have worked with OpenGL but it was years ago in college.

I would like to know what engine/framework others would recommend.
I don't really want to pay for a license or pro features so free would be one stipulation.

Akka Actors

I really like the notion of using akka actors in Java. Basically it is trying to solve the problem of easily writing thread safe code. It does this by passing immutable messages to actors which process them. The idea is that the actor should be stateless and only act upon the immutable object it's given. They also appear to have Software Transactional Memory (STM) for when you do need mutable object and locking.


I have doubts novice programmers which couldn't write a correct singleton or proper thread safe class would be able to use akka to write thread safe code. I could see them creating all kind of actors which are not thread safe.


I did find it was really easy to get a lot of concurrency almost to a fault where my laptop was maxed out and overheating. Of course that may have been my fault as I gave it an infinite computation to work on.


I don't understand why packages don't have remoting support built for the Servlet API. Akka has a remoting support but I always work in a full J2EE container so getting ports opened and bypassing it would not be an option. I would like to know who needs stand alone remoting and is not working with at least Tomcat.

I'll definitely check akka out in more depth.

Guava

I really like the Guava libraries. One of the best things in there is ImmutableList. I like the idea of using ImmutableList on an interface. This way you don't have to worry about synchronizing the list because the list won't change on you and throw a concurrent modification exception. The builders are awesome. Unlike Apache Commons Collections it supports Generics on collections which is awesome. There's other Immutable collections and objects in this library too.

I do find a lot of other useful utility classes in Guava but it is not as complete as Apache Commons Lang and Collections. So I find myself using all three.