Reputation: 24
Summary:
So, as the question suggests I'm trying to develop a racing game. Although, I need to create a system to keep track of what positions the Player and AI are in. Positions as in first place, second place, third place, etc.
What I've tried:
At first I was going to use a system that was made by Jimmy Vegas in one of his tutorials for developing a racing game, but this system only works with two cars and an enclosed track/circuit. My game is an off road racing game, this means the track is open and the player will be able to make there own shortcuts and no walls will restrict the player's ability to roam the map. This renders Jimmy Vegas's system useless for my type of racing game. I tried to mess around with the code to find a way to still use his system, but I'm afraid it won't work. Any help would be greatly appreciated!
Upvotes: -1
Views: 723
Reputation: 315
I won't be writing the code for this as it's too implementation-specific, but here's some checklist pseudo-code.
Use the following to compute relative positions between two players:
If you want absolute positions of all players, make an array, and sort it using laps, then breaking ties with checkpoints, and finally breaking ties with distance.
Even a hundred-entity race running this every frame shouldn't have any problems.
Upvotes: 1