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: ,

Given my failure to get started writing Flash code, I decided to try Java. I downloaded Java 5.0 (which comes after 1.4, believe it or not) and Eclipse 3.0. Both of those sites need to have a much easier way to download the software. Java led me down a maze of multiple versions, marketing material, and legalese. Eclipse led me to a page of international mirrors, none of them useful (when I clicked on them, I got a big file listing and had no idea what I needed to download).

Despite some glitches (like some dialog boxes being blank and some being far wider than the screen), I got a simple applet running. My next step is to learn how to draw lines on the screen so that I can start creating a small isometric map. After that I need to learn how mouse events work so that I can let the player select tiles on the map.

The main disadvantages of Java compared to Flash are: it’s not as widespread, and it appears to be a more verbose and cumbersome language. I'd really like to do something with Java3D, but it looks like that is not installed by default on anyone’s machine. I just installed Java and I don’t have Java3D. I don’t want to ask my readers to install new software just to look at my demos. I think Java3D would be much more popular if it were installed by default.

Update: I’m not the only one who had trouble downloading Eclipse.

Labels:

I got Chris Sawyer’s Locomotion two weeks ago. I love Transport Tycoon. I have played several games in the same genre (Transport Giant, Railroad Tycoon, Roller Coaster Tycoon, etc.). Here are my thoughts after playing roughly 10 scenarios of Locomotion. I don’t just want to complain about the game. I do enjoy playing it. It’s just that there are some things that I think would make it much more enjoyable.

  • Summaries. I like the summary views: lists of stations, towns, trains, trams, planes, etc. In my post about Transport Giant, I mentioned that it was really inconvenient to get any summaries. Locomotion is much better. You can sort the lists too. Minor suggestion: it would be nice if the list sort order was preserved, so you don’t have to re-sort when you re-open the list.
  • Pathfinding. Unfortunately the pathfinding is really frustrating. There should be no need to add waypoints for trains. Pathfinding algorithms are efficient enough, especially on simple graph structures like railroads, that entire networks can be scanned easily. Minor suggestion: for rail networks, a simple efficiency trick would be to add “lookahead” shortcut links in the graph structure that skips ahead from one node to a node 10 spaces ahead.
  • Building. Even after playing 10 games, I still find the building to be cumbersome. To edit something you right click on the road or track, but it’s hard to predict which road or track you will edit when you right click on something. Editing needs to be predictable. Locomotion has a definite advantage over Transport Tycoon in that there are many more track/road possibilities available. However, I still think drag & drop is the better approach. Suggestion: make drag & drop building work. I plan to write more on this subject soon.
  • Signals. I like the way the rail signals are built. They are put on a section of track, not on a single point. The arrows on the one-way signals and roads are very nice! I am still puzzled by the various colors on the signals. I think I can figure out red-red-red, and green-red-red, but what does yellow-green-red mean? Minor suggestion: when you mouseover the signal, it can show you which trains are interacting with that signal.
  • Groups. I find that I often need several vehicles that go on the same route and carry the same type of cargo. When this happens, I would like to view information about the entire group instead of seeing them one at a time, mixed in with other vehicles of the same type. Suggestion: automatically detect groups by looking for trains that share a route and cargo, and offer operations on the group: upgrade vehicles, modify the route, or change the cargo.
  • Reliability. I think reliability was an important part of Transport Tycoon. Unfortunately in Locomotion reliability is a factor but you really have no control over it. Suggestion: add a “maintenance depot” that can be added to a station. When the train reaches the station that has a depot and that train needs service, it will receive service there (which takes more time). It should also be possible to add stations that are entirely for maintenance and not for cargo.
  • Look-ahead Pathfinding. I like the idea of trains “looking ahead” to reserve track that they want to go on. However, it’s hard to figure out how far they look ahead. Suggestion: add a “headlight” that shows how far the train scans. (Perhaps the headlight it shown only when the vehicle is selected.)
  • Bridges. I like that bridges are not limited to height 1 and that bridges can have curves and slopes. The various bridge types don’t really appeal to me though. The best ones are the ugliest. Suggestion: add a “reinforced concrete bridge” option that is very clean and flexible, supporting all the curves and slopes. Of course, if I had that, I would not use any of the other options.
  • Construction Mode. While working on tracks, I frequently find that trains do not stop right away. In Transport Tycoon, you could safely work on tracks and trains would not derail. In Locomotion, they frequently crash while I am working on a track. Suggestion: when in construction mode, put construction signs/cones around the track, and make trains travel very slowly. They should not crash while in construction mode.
  • Track Layouts. The track layouts in Locomotion are much nicer than in Transport Tycoon. There are lots of curves available. However, at times it is hard to see the tracks. For example, take a look at the second to last picture on this page about station layouts. It is so hard to see all the tracks that the author created a separate diagram showing them. Suggestion: when in construction mode, add a bright line showing each track segment, with large dots at the endpoints. This would be an overlay on top of the tracks so that you can see the structure.
  • Visibility. Transport Tycoon offered a way to hide buildings, or at least to make them transparent. Simutrans offers a way to show only the foundations of buildings. Locomotion offers a way to hide the foreground buildings without hiding the background buildings. I like the idea, but there is a problem: when in construction mode, the foreground buildings still affect your mouse, even though you can’t see them! Suggestion: If you hide something from the eye, it should be hidden from the mouse as well. If I see something and click on it (or right click to delete/edit), the click should affect what I saw, not the hidden object in front of it.

That’s all for now. I think I have a way to make drag & drop building work with Locomotion’s more extensive set of road and rail segments. I hope to make a demo of it (and this is why I wanted to learn Flash). The basic idea is that you drag from edge to edge instead of from square to square. In addition, you use a modifier key (like shift) to raise/lower the altitude. I won’t know whether I like it until I try implementing it.

Labels:

I wanted to learn Flash so that I could build some simple demos illustrating various concepts on my game programming pages. Unfortunately it looks like it costs $500 to get the flash developer kit! I should try Java instead.

Labels: