Advice on tracking Player/AI positions during race

For questions about using Classic.

Post » Fri Jul 01, 2011 5:06 pm

I started to sit down and brainstorm a good way of keeping track of the player and ai opponent positions in real time as they raced around a track in the top down racer I have been working on. I was trying to also come up with the best way to do it most accurately. My end idea was to set overlap checkpoints around the track and after the overlap occurs then you would compare the distance to the next checkpoint. The problem with this is when you go around sharp corners and the checkpoints are near each other the system then become faulty.

I'm just curious if anyone has other suggestions or ideas on how to achieve the tracking of positions in real time with as much accuracy as possilbe? Any ideas would be helpful!
B
2
G
1
Posts: 37
Reputation: 524

Post » Sun Jul 03, 2011 8:07 pm

I put together a small example of how some things are working in the original game so far if it helps anyone to understand what I am trying to accomplish.

I realize now, that I am first going to have to check which lap each car is on then which checkpoint they are at. If two cars are neck and neck I will also have to check if they both are at the same checkpoint. If they are then I need to measure which is closer to the next checkpoint. I know how to grab all this information but coming up with some type of algorithm to sort all cars into there specific position is confusing me especially since in the original game there are 21 ai opponents. Any suggestions? I'm really lost on this one.

Demo Example
B
2
G
1
Posts: 37
Reputation: 524

Post » Sun Jul 03, 2011 9:57 pm

Maybe this thread might help?
http://www.scirra.com/forum/solved-make-a-list-of-values-order-them_topic42310.html

You could possibly use some sort of algorithm to use weighted measurements; eg. assign say 100 points for a car passing a lap, (assign them all to a Family to check them all), 10 points for passing a checkpoint, 1 point for being closer to the next checkpoint etc. Then sort by total points descending to determine the order.
B
9
S
2
G
3
Posts: 75
Reputation: 1,964


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests