Been working on a little wooden train set building game I started for gamejam. General idea is to build a track and then ride along it in a toy train.
The theme of the jam was ‘comfy’ so I’ll be steering clear of the frantic time-restricted building you often see in track-based games. I’ll probably have some token objectives to deliver items from one side of your track to the other, but my main aim is a relaxing sandbox.
Track following works through a system of traces which bounce along the grooves, interpret the route and update a spline curve representing the path to follow.
The spline runs a little ahead of the train which means I can interpolate along it for smooth turning. Additionally it can leave a trail if needed for attached carriages to follow without having to do the calculations again.
Depending on the direction the game takes I might try to build the spline before the game starts, at the moment it dynamically checks ahead of where the train currently is.
The game uses no ‘real’ physics, everything is interpolation along a spline so I had to make my own gravity system.
As the spline is being made it’ll accelerate downwards if there is no track. Because everything is being faked I can more easily manipulate the effects of momentum off ramps, keep the train safely grounded and in the grooves unless it goes over a proper ramp etc.