Archive for February, 2010

the guy in red

Sunday, February 21st, 2010

Last week I was in a book, this week I’m in an Indian newspaper!

No, it’s not about me at all. The guy in the main photos is an Indian friend of mine I met in Hong Kong who wrote sent the article. It’s about his Hong Kong experiences. Instead I am the guy in red standing next to him in front of the giant Tian Tan Buddha in the background, located at the Po Lin Monastery in Ngong Ping. It’s not about me, but at least I’m in it!

If your ever in the Hong Kong area then I highly recommend visiting the monastery. You can get there via cable car with impressive views of the Hong Kong Airport and the surrounding untouched tropical wilderness of Lantau island. Although their cable cars do occasionally crash into the surrounding mountains.

Next week, I’m on the back of an envelope!

A history of Circles

Monday, February 15th, 2010

Not too long ago I uploaded my second tech demo, Circles. Very small, very simple and was built also as a tutorial for my framework.
Circles ScreenshotBut it’s history goes back a lot further then that.

The version on my site is built in Java but originally it was built in Ruby using OpenGL. It was something small I’d knocked up in an hour called Physics Balls and built for an easy-going weekly competition called the Wednesday Workshop over at SoCoder. You can find it here.

The original Circles, on SoCoder


Overall it went down like a lead balloon. “Not much of a game” was the description given, and the consensus from most users. But that wasn’t the end!

During my time at university I’ve been very priviledged to be able to work with the Greenfoot team building example scenarios, testing and creating worksheets. The software allows you to easily build games and interactive scenarios with very little code and includes an web portal, the Greenfoot Gallery, where they can be uploaded. One of the projects I uploaded was a newer version of Physics Balls: Circles, and later it was included in a combination scenario I built: the JL235 Collection (which I thought was really cool, but people weren’t that impressed).

Some of my GreenfootGallery scenarios

Last year a book was released for Greenfoot for which I was asked if I could provide my Circles scenario. So I’m in a book, WOOT! Here is the book…

Inside this copy looked as though it had been through a washing machine


and in Chapter 10 on page 157-158, is Circles!

Circles, but my name is wrong! I never call myself 'Joe Lenton'

So is that it? Of course not! For my third year project at uni I’m building a highly concurrent framework in Erlang for which I’ve also made a version for another small tutorial…

In this version each Circle is updating in it's own seperate process

Next week, the magical Square!

isMouseDown() is bad

Tuesday, February 9th, 2010

I’m currently trying to solve a UI issue with Space Snake Galaxies. On the universe map you can bring up highscore and level info for each galaxy where you play.


When you click outside of either they dissappear.

The issue is that there are places where you can both click outside of the highscores and on a button and so both detect that a mouse click has occurred. Why can you do this? Because I’m still using the old basic way of handling controls through simple function primitives. i.e. isMouseDown, isKeyDown, getMouseX and getMouseY. i.e.

if ( getControls().isMouseDown(Controls.LEFT_MOUSE) ) {
    // do something
}

It’s crazy that indie game programmers still recommend doing this. It’s like the GOTO of controls. Dead simple and you can build anything with it, but it’s a real mess to code anything sophisticated (like good buttons!).

In GUIs you don’t do this. When I press a key an event is dispatched to the top level component. If it cannot handle the event it will pass it on to another component (and so on and so forth). This means the GUI is passive; it’s mouse and keybaord handling code is only run when an event occurres. With the basic active code above it will make a check on every frame to see if the mouse is down or not, wasting CPU time.

But there is another difference. If an event can be handled by a component then the event is removed. That sole property is almost impossible to build using basic functions like isMouseDown. You either need to permanently alter the state of the controls (so future checks on isMouseDown return false) or tie all components together globally (have a button check if any other buttons have handled mouse controls first, and if they haven’t then it will).

I think the solution will be to build a passive event system into my framework. To allow easy event based input for buttons and panels whilst keeping direct input for guns and shooting. Because sometimes all you need is isMouseDown.

BOOOO! Oracle

Friday, February 5th, 2010

Sun were giving all their products away for free and wasn’t making any money. To help out Oracle buys Sun. At first I thought this was excellent news because both companies have exceptional products, but neither have many flagship products (note flagship) that directly compete with each other. So it seems like a good mix.

This was until I received…

In short, Project Kenai is closing and taking my open source sf-library along with it. BOOOO!

So I’ve had to move the whole project across to Google Code. But it has me annoyed because Project Kenai is clearly prettier then Google Code:

However what really is quite worrying is that the JOGL project (Java OpenGL bindings) will also be closing along with Project Kenai and there are no plans to move it back to it’s old home java.net or to anywhere new (but there are some custom branches around on github). But it annoys me as yet another example of how Java, a very mature and successful language, is failing to capture the desktop market. I did a blog post a month or two ago mentioning WebGL which will allow you to do 3D in the browser, yet you’ve been able to do it for years with Java. It’s crazy it doesn’t get more support for this kind of thing from Sun,.. sorry, Oracle.

BOOOOOO!