SwitchTrack: A train shunting puzzle game.

Knocked this up in the last week:

http://www.angryoctopus.co.nz/switchtrack/screen_1.png

It is an implementation of the Inglenook Sidings shunting puzzle.

I think for my next project I should document the steps I go through on the road to abandoning development. I think I generally give up around the point I realize the game is not quite as fun as the one I had imagined in my head.

It looks cool ;D However, I am not so sure what I am supposed to do???

Hmm… Probably should have put some instructions in. Basically you have to assemble a series of 5 train cars and the locomotive on the main line. Everything is controlled via the mouse. You can click on the locomotive to move it forward and backwards and on the two switch tracks (if they aren’t occupied). Clicking between cars will hitch/unhitch a car. The train cars required on the mainline are displayed by the coloured rectangles.

phew, finally managed to beat it.

Very towers of hanoi.

Yeah, it’s not nearly as much fun as I had initially hoped. Still the code is useful if I ever want to do another hex based train game. I had an idea for another train-based puzzle game where you layout a track in order to shuffle passengers round various stations.

I got this exception:


java.lang.NullPointerException
	at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
	at angryoctopus.switchtrack.main.SwitchTrack.<init>(Unknown Source)
	at angryoctopus.switchtrack.main.SwitchTrack.main(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javaws.Launcher.executeApplication(Unknown Source)
	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Windows XP
Java 1.6.0_10-beta

Looks like a sound issue, do you have any other audio applications open at the same time?
I was a bit lazy so using java Clip objects which tend to be a bit over-zealous about grabbing system resources.

Does:


  Clip clip = AudioSystem.getClip();
  clip.open(AudioSystem.getAudioInputStream(new File("sound.wav")));
  clip.start();

Work on your system?

Got it! I didn’t notice the “rectangles” around the wagons!

Yea its not bad. The one trouble I had is that the blue and the purple was very similar.