Download

Racing position - array sorting...

So, I’m working on a twitch integrated racing game. I have my race position working from a calculation standpoint. but I’m having problems sorting the leaderboard.

In this first iteration, I’m not looking to calculate the real-time position of each car (there are 25 per race) based on the distance on the spline the cars are following… - but working off of a delta-seconds and last checkpoint # passed. the data is stored in each car object for what time it crossed the last checkpoint and what checkpoint number it was. Those are multiplied together to give a “race position”. I could always push this data in my race manager object, which will likely be more efficient then querying each car to update the race position. But in any event, what I need to do is sort the cars into their correct positions.

so, what I’m looking to update the leaderboard with is the the car with the highest checkpoint passed and the lowest time is currently in the lead - so I want to build an array of cars in the right order so that i can keep a scoreboard updated.

any thoughts on what the blueprint would look like?