[SOLVED] Racing AI, picking untaken waypoints

0 favourites
  • 3 posts
From the Asset Store
75 vehicle sound effects, from real looping car engines to jet aircraft and sci-fi engines.
  • Hi, I'm working on a simple racing game, and while trying to make some collision between the AI I ran into some problems.

    The problem I'm having is that sometimes the AI get stuck and stop moving. I'm still not too sure about what is happening, I'm trying to avoid that making the ai cars choose different paths along the track, so they avoid a bit of collision.

    My track is set up like this, each waypoint is in fact subdivided in 3 (Waypoint object has 3 variables, number, path and taken). Number goes as usual, 1..2..3 until the track finished, path ranges from 0 to 2, 0 means inside part of the track, 1 means middle of the track and 2 means outisde.

    What I'm trying to do is to make the car choose only Waypoints that aren't "taken". For some reason I'm stuck on this, I'm realy struggling trying to set it up in Construct,

    something like this:

    while(pickedWaypoint.taken) pick another one.

    The real problem is more speficly in the AI event sheet, events 11 and 12 in case someone wants to help.

    Any tips on how to make better collisions are also welcome.

    Edit: Problem solved using sub picking events, 1st I pick every Waypoint with the desired number, then I pick again all the ones that aren't taken and then I pick a random one within them.

  • I've not checked the .capx so haven't looked at your exact events.

    Why not cheat a bit. When the first AI car gets to the next waypoint why not set every other AI cars next waypoint that way you can easily avoid picking a used waypoint. You may have to track waypoints differently by having a current waypoint/next waypoint system or maybe storing them in an array.

    Again haven't checked the .capx but this would be the sort of system I'd use.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Minor, I managed to get the picking system working like I wanted. I just needed a break, as I thought it wasn't as hard as it was looking.

    Anyway I still have problems with the collision and cars getting stuck, I'll open another topic to discuss collision options as it's outside the main topic here. if you get the time please have a look at it as I know you also use the MoveTo behaviour.

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