February has been another busy month because I’ve needed to work on my fantasy F1 competition and haven’t been able to spend much time on Oversteer Racing. In the time I have managed to find I’ve been working on the end of the race. On the face of it this might seem a pretty simple task, show the positions of the cars and add up championship points, but it’s actually a lot more tricky than it might first seem.
The main complication around the end of the race is determining the positions of the cars. There are two scenarios to consider:
- The player completes the race normally – In this situation the finishing position of the player is known, as is the position of all the cars that finished before the player did. However, although we allow the race to run for a few seconds after the player crosses the line we cannot be sure all the cars have finished (unless the player is last). As not all cars will have finished then we need to look at the cars that are still running whilst also accounting for others that might’ve retired and determine the complete finishing order. In the simplest case we could just assume that the remaining cars finish in the same order as they are currently running but should the result always be predictable in that case?
- The player retires or crashes – In this situation determining the final race order is much more tricky. It may be that some cars have crashed out but there will always be some cars that are still running. If none of the cars have pitted or all of the running cars have completed their final pit stops then determining the order is relatively easy (it’s a similar task as the first scenario). That said, if the race is still in its early stages then we should include some degree of unpredictability as the finishing order is unlikely to remain the same as the current running order. If the race is part way through and some cars have pitted but others have not then the current running order when the player retired is not representative of what the running order should be once all the strategies have played out. This is a more complicated scenario to model as we must also take into account cars on different strategies. In order to do this we need to work out what cars are out of position, determine if that is due to a scheduled stop or due to a stop for a replacement wing etc and then work out the expected running order once all of the cars have pitted. We then need to predict the final result and this may also have an unpredictable element to it (i.e. just because a car will be leading after the pit stops doesn’t mean it will always win the race).
So, in summary, not only is there the practical task of storing race data there is also a task to model/predict the result of the race in some cases. At the moment I’m just focusing on the simplest case since even that includes some element of result modelling and, once that’s done, I’ll look at the more complicated situation.
I’ll continue working on the code to handle the end of a race.