I was working last night on changing the waypoint activities that can be specified by the player. I’ll start saying player instead of user because it sounds more fun.
I finished some work on the A.I of the trains. They can now detect when they are sitting on a turnout that is needed to get somewhere and the train moves past the turnout then reverses and takes the turnout to the destination. It’s fun to watch it do a bunch of direction changes to go between just two waypoints that happen to cause the train to get stopped on the turnouts between them.
I also fixed some problems related to the temporary waypoint that gets created for the purpose of using switchbacks. The train needs to know to go to a certain location to use a switchback before moving on to the next regular waypoint. I did this with temporary waypoints. it’s all working very well now that I keep track of them very separately from the regular waypoints.
So back to the waypoint actions. I’m going to need waypoints that have no stop or speed change for the train. How else can the player tell the train to take some loop of track to change orientation of the train on the main line? there’s no reason to stop while doing that and a stop would also allow the train to reverse which might cause it to go back the way it came.
I also need to have speed limits of sorts. Not the speed limits that might apply to an entire area, which will be needed someday, but speed limits so that the train can slow to couple without stopping at the given waypoint. In fact, I’m considering avoiding the speed limit thing by just having the train detect when another train in one the track ahead and slow to couple or slow to stop at the end of the other train. If there is a coupling waypoint set near there that the train passes to get to the other train, that tells it to do the coupling action instead of hitting the other train, stopping, and complaining that the route is blocked. Hmmm, there’s an idea. Stop at the other train and wait for the route to become unblocked would be handy.
I have yet to decide if the train will slow before the waypoint or not. Getting to the waypoint and then creeping along at 3MPH until the other train is connected might be a long and boring process. My engineers should be better than that.
Another Consideration unrelated to coupling.
I think that the game should have a way for the player to pay for more advanced railroading features. If they don’t pay for a guy to work near a turnout, and later for a building to house some sort of remote controls, then they are stuck with the train having to stop before each turnout that is in the wrong direction. There would then need to be a a way to tell the game which direction a turnout should be set normally so that trains going in that “normal” direction need only slow a little to see that the turnout is the correct direction before they get there. The train would really be set to stop at the turnout and then when close enough to detect the direction “visually”, the train would resume normal speed if possible and stop if needed. That type of operation would be cool because the train would act on its own in interesting ways. Of course a real railroad would have few turnouts compared to the many miles of track needed to get anywhere.
Next things to Code
So the next things to code are:
- Management of multiple “trains” which include cuts of cars with no locomotive.
- Coupling and speed management during coupling.
That should be plenty for tonight and then for the weekend. At that point, I should have enough working to actually think about making a train do something interesting. the list of things to do after that will be huge and even more interesting as things get closer to being a playable game.