[SOLVED] Racing AI, picking untaken waypoints

Get help using Construct 2

Post » Thu Jul 31, 2014 8:08 pm

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.
Last edited by caiorosisca on Thu Jul 31, 2014 10:03 pm, edited 1 time in total.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Thu Jul 31, 2014 9:28 pm

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.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Thu Jul 31, 2014 10:00 pm

@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.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, Jackriduk, kiki4construct and 28 guests