Basic 2d game engine with sprite collision detection

I’ve spent a few hours playing around with the Java2D api over the weekend, and with the tutorial on this site, I’ve got a basic framework for implementing a simple 2D game. So far I’ve got a keyboard handler to control the player’s movement and collision detection against solid objects. You can move the player character around the screen and with solid objects (tiles) on the screen it wouldn’t be too far from this point to implement a simple maze or platform game.

At this point this is probably more than I need since I was thinking of implementing a version of one of the original Game & Watch games as a starting point. I’ll keep you posted on how I progress and at some point I’ll also post the source.

Writing a 2D arcade game using Java2D API

Every now and again I get the urge to develop a game in Java, but I never get it complete. I’ve done a few prototypes modeling bouncing balls and simplified gravity on moving objects, but have never finished a game to completion (in Java at least – I wrote some simple games in Sinclair BASIC almost 20 years ago, and also a 2D side scroller variant in STOS BASIC on the Atari ST sometime in the late 80s).

Once of my main hurdles in Java has been ‘how do I get stuff on the screen?’. I’ve tried things in Applets using the Graphics Class, and also looked at very simple tile-based graphic layouts using, of all things, a GridLayout in Swing. I just found this tutorial however, which shows incredibly simply, how to the the Java2D api to write images to the screen using Buffering. This is an awesome article because it bridges the gap for me – I’ve read a few Java2D articles and skimmed through the Java2D online tutorials, and the part that seems to be missing in most is how you actually get an instance of the Graphics2D class. Now to go away and do something creative 🙂 Actually, I’m going to have a crack at a Nintendo ‘Game & Watch’ style simple game…. I’ll keep you posted on how it goes…

(I don’t know which came first, but the article mentioned above is also extended somewhat in this other article – you can see there are name changes, but it’s the same code… I get the feeling the first article came first…)

Glassfish V2 – to include performance improvements?

I tried running a couple of simple webapps that I currently run on JBoss 4.x on Glassfish V1 (including this website and blog), and was surprised to find out that my apps ran painfully slow. This was just an observation, I don’t have any exact timings, but where my webapps on JBoss 4 the pages load within the snap of your fingers, on Glassfish V1 it seems that pages were taking a couple of seconds to come back, and it didn’t improve even after successive page hits.

I heard on the JavaPosse’s interview with the Glassfish developer guys that the Final Release Candidate for V2 has a number of performance improvements (since V1 was just a developer release), so I’m interested to give it another try sometime soon.

I’ve used JBoss for a number of years to run my sites, but from being used to using Weblogic and Websphere during my ‘day job’, I’m used to having a rich administration front end, which I think is the one area where JBoss lacks. Glassfish on the otherhand has an admin console to compare with the big guys, and this is particularly attractive to me. I’ll post an update when I’ve tried it out again.