Race AI

Get help using Construct 2

Post » Wed May 15, 2013 6:24 pm

I've made a Micro Machines clone and have a basic AI using Pathfinding which works for 1 race but not the other. I wondered if anyone had any other way of making a race AI as its something I haven't seen much on the forum. I find that pathfinding is too accurate with the line the computer takes and wanted to be able to add hazards on the corner that the computer could hit ie. oil.

My game is currently hosted at
http://dataresearch.netii.net/

The Dining Table level is the one that "works" but as you can see the computer gets "lost" occasionally.

This is my first attempt at anything using Construct so any help/advice would be appreciated.
B
3
Posts: 8
Reputation: 241

Post » Wed May 15, 2013 6:32 pm

I'd have thought pathfinding would be a bit CPU intensive, especially when you have a few CPU racers...

I'd be thinking down the lines of an invisible sprite ahead of the racer that makes "decisions" based on what the car is approaching, and have a room for error built into the variables...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Thu May 16, 2013 4:19 pm

Thanks for the advice Pixel.

I have amended the game to use a path of points to turn towards instead of pathfinding which will hopefully free up CPU, I'm now going to look at putting 2 points on the front corners of the car to detect any objects before the car hits it to make it steer away from the object.

Andy
B
3
Posts: 8
Reputation: 241

Post » Thu May 16, 2013 5:26 pm

I have tested the idea of the points on the front corners to reasonable success :) The car definitely "drives" itself around the track.

Here is the capx of my test AI. Hopefully I can work more on this to make it actually go straight on the straights and "see" the track more.

https://www.dropbox.com/s/xip3d7kc3josbvf/Race%20AI%20Test.capx
B
3
Posts: 8
Reputation: 241

Post » Thu May 16, 2013 6:40 pm

nice job, I'll have a look at that...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 19 guests