Simple top-down driving AI

  • I'm creating a simple top-down driving game and wanting to speed up the development process.

    Currently, the game AI car finds a waypoint, and then I set the next way point. Each way point is a clone.

    Ideally, I'd like to be able to copy each waypoint instead of creating a new object, and also have the one event that iterates through each instance of the waypoint.

    I've come across one tutorial, but it's a bit complex. What's the simplest way of doing this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You wouldn't have the points as different objects first of all. You would likely have a location point with an instance variable, you create them in the layout and set the instance variable to a number order. Then you create a global variable that relates to the instance variable during gameplay.

    So you have one event, find path to location point where locationpoint.var=global variable. So 0 to start with. Then you have another event on arrived at location point, add 1 to global variable and run the find path event again. This would then look for the next location point where the instance variable is 1.

  • Thanks ! That's what I had in my head, however, I'm still struggling with the specifics in Construct3 syntax.

    If you get the opportunity, I would really appreciate any screenshots of the actual blocks required to achieve this.

  • You wouldn't have the points as different objects first of all. You would likely have a location point with an instance variable, you create them in the layout and set the instance variable to a number order. Then you create a global variable that relates to the instance variable during gameplay.

    So you have one event, find path to location point where locationpoint.var=global variable. So 0 to start with. Then you have another event on arrived at location point, add 1 to global variable and run the find path event again. This would then look for the next location point where the instance variable is 1.

    Here is a copy of my C3P file. Hoping it helps :)

    https://mybcecatholicedu-my.sharepoint.com/:u:/g/personal/sletts_bne_catholic_edu_au/EZn4Ye0d9tNHhZWlQhrjDOABDyUgV_Fd1qZM7-7U_KBJOg?e=uOYRv6

  • There you go dropbox.com/s/0tofjnr7rau19j7/Racer%20%281%29.c3p

    That's awesome! Thanks! I didn't realise there was an event on pathfinding found!

    Thanks again :)

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