Sunday, October 31, 2004

A few months ago I had been thinking about a UI for building roads and rails. When I got Locomotion, I found that the building UI was a little bit annoying, and that inspired me to work on my UI some more. I tried Flash but couldn't find a free and easy way to get started, so I turned to Java instead. The Java documentation on Sun’s site is nice. For example, take a look at their Java 2D documentation.

After playing with it for half a day, I have an applet that lets me build roads. One of the most confusing things was figuring out how to write <object> and <applet>. Ick. (Let me know if it doesn’t work for you.)

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

The basic idea is that roads (or rails) should be between edges, not tiles. Road segments are cubic splines between two edges. It’s a little tricky to select the right edge; I need to think about that problem a little bit more. There’s a larger version on my other page.

This building UI isn’t directly usable for games like Locomotion. It would need length and angle constraints, diagonals, bridges, and tunnels. To make it more usable, I need to add pathfinding, so that you can drag across the grid and it will figure out which segments need to be built. I will probably get bored before finishing all of that, though.

Labels: ,