Help creating AI path

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hi All,

    I'm thinking about making a driving game, and I wanted to know what would be the best system to use for controlling / dictating the path of my AI vehicles.

    I'd like the cars to be able to drive along in individual lanes, and possibly occasionally change lanes. I'm hoping to make a selection of both straight and curved roads, so the AI cars will also need to be able to follow curved paths.

    I was wondering if I could use the Pathfinder behaviour to control the movement of vehicles, but wasn't sure if this would work. So far I've only seen pathfinder examples which use a grid system, and I would need vehicles to sometimes move along a nice smooth curved road.

    Can anyone could offer me some advice?


    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Anyone please?

  • Bump, anyone?

    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Not sure if this is the easiest thing to achieve just yet, especially if you want the cars to react to other cars. Using the path finder, you could have key points around the track which your cars will target as the destination, and then when they get close enough to the next point, the destination changes.

  • Thanks for the advice I wasn't sure, but can PathFinder also be used for curved motion as well as straight lines?

  • Pathfinder will use whatever the shape of the "passable" terrain is. If you have solids blocking in a circular or curved path, then it will follow that shape... but you will need to make them somewhat narrow to keep them from cutting corners and taking a straight line where possible as the logic looks for the shortest path around the solid blocks and a straight line is always shortest...

  • Thanks BluePhaze, for the useful information.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I whipped up a demo using nodes to define multiple paths (lanes) for cars to follow. The cars will change lanes every few seconds.


    Annotated Capx

    I hope this helps.

  • Hi zatyka,

    This is a fantastic example, thanks very much!

    <img src="smileys/smiley4.gif" border="0" align="middle" />

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