Advice on tracking Player/AI positions during race

This forum is currently in read-only mode.
  • 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! <img src="smileys/smiley2.gif" border="0" align="middle" />

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)