I looked into this a while back for a small project, but didn't get too far. I'd like to create a small program that lets a user draw a train track and then allows a "train" to follow said track on a 2D plane. I'd like the track to be pretty free form and result in a nice smooth line. I played around with cubic splines and had decent results, but had a ton of trouble getting the train to follow the spline. I also had a lot of trouble creating multiple tracks and switching a train from one track to another.
Does anyone have advice, articles, or source code that can help me figure something out? Thanks!