[Request] Car+Pathfinding

0 favourites
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hi everyone, I'm new to the Construct 2 development world, I've built a few projects that helped me get a basic understanding of the program.

    I'm wondering if there is a plugin that combines the car features with the pathfinding features, or if there is a way to combine them within Construct 2 to use the pathfinding logic to get the path, but the car behavior to navigate said path.

    If this can be done, or if someone already has a plugin made, I would be grateful, if such a plugin does not exist, and wouldn't be too difficult for someone with experience writing plugins to make, also I would be grateful.

    Thank you.

  • You might see this plugin, although it is not using path finding.

  • it doesn't "Have" to use pathfinding, as long as I can simulate NPC vehicles, one thing I did notice is the vehicles don't seem to care if there are other vehicles on the road, they won't try to avoid them, simply smash into them without concern.

    As of this moment tho, this seems to be the best fit, thank you.

  • Cyles

    It is possible to make the car not too closed to other cars (not collision free).

    See the first demo of this plugin, the ship will try to fly to the target without hit these rocks.

  • rexrainbow

    Awesome, I'm gonna tear that apart and see how it works


  • Cyles

    There has one problem: what is the behavior (i.e. AI) of your car?- When to speed up, when to slow down, when to turn left/right. This plugin only provides an advice according to current environment.

  • rexrainbow

    I'd like the AI to be able to navigate traffic, slow down to a stop if they cannot continue on their path due to a red light, traffic, etc continue when room becomes available, turn in certain directions based on randomized target points throughout the map. Every Tick Pathfinding would be perfect for on screen objects, but I cannot simulate car physics with Pathfinding (car chase/race/etc) unless there is a way to combine the behaviors which I have yet to find a way to get the path, then drive on it using car physics.

    I'm sure for basic traffic I could use events to produce the effects desired, but as I said, with things like car chases, races, etc I would like the AI to be able to react to the environment using car physics in a similar way to what we see in Need for Speed games and such.

    EDIT: Upon further inspection, it appears as tho the race track .capx is almost exactly what I need. So I guess the request would be now, is there a way to make the vehicles use pathfinding waypoints as target locations instead of manual waypoints? Like add car physics to pathfinding, or add the pathfind system to the car logic. I'm sure this would be really simple, as both already exist by default, I just know if I try to go in and look at the code I'll just muck it all up.

  • Cyles

    I guess you might create some instances at the result points of path finding by events.

  • rexrainbow

    I'll check that out, see if I can't rig it up, I'm sure I seen an example of finding pathways and placing arrows, I could do the exact same for the waypoints, perfect, based on what I've seen of your contributions, as always, thank you. You just opened my eyes to a whole new level of development for my project

  • Cyles

    In my example, I only use one attracting point in the same time, to make the attracting source/direction clearly. It might be another thing you have to watch out in your case.

  • rexrainbow

    This looks really complicated, I love being new at stuff, gonna take me a minute to figure all this out, I'm unsure exactly what behaviors you used on the vehicles, I assume LJPotential, Car, and Solid, but they don't appear in the actual behavior editor, maybe it's an advanced thing I'm unfamiliar with lol.

    As for the waypoints, I found the template that inserts arrows into the pathfinders path that the player auto follows, I could use that same logic to create waypoints that follow the logic used by your waypoints system. The mapping for my first attempt will be mainly grid based, so north/east/south/west direction.

    I'm going to be building the main traffic flow on events, and using your system for special events like racing and such.

    I think I have to take a step back and figure out the objects you've used so I can emulate this, unless I can reverse engineer this I'm learning nothing, even the layout of your objects seems more advanced then I'm even aware of.

    Either way, I believe this is perfect for my project with some workaround to create instances of the waypoints along a pathfinders path. Thanks for your assistance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Cyles

    If there is only one attracting source, and no rejecting. You might easy to turn the head of car toward this attracting source. It does not need LJPotential actually.


    I forgot you might want to reduce the car accident, so the rejecting still need.

  • rexrainbow

    For the pathfinding, I would be using every tick to re-calculate the path to take, and destroying and replacing the attracting points, because it will use pathfinder logic, it will avoid other cars and buildings set as solid by default, but will still potentially sideswipe other vehicles, causing damage to the car using collision depending on friction, drift recovery, steer speed, etc causing damage to the car.

    The basic logic on how I'm going to do it is there, I just need to figure out how to use these custom plugins/behaviors properly.

    Edit: I'm gonna leave my mistake and simply point out that I'm from the department of redundancy department. LOL

  • Cyles

    [quote:2rebykpi]You should also avoid pathfinding every tick, since this will cause extremely high CPU usage and also increase the amount of time it takes for other objects to determine their paths.

    The path finding is an asynchronous action, so you will not get the result immediately.

  • Ahh, So if I use it on 1-2 objects (competitors in a race) to navigate through bullet behavior solid traffic, and buildings, would bog down too much? Or simply not be suitable for finding alternate paths on the fly.

    Is there an improved pathfinding system that would suit the on the fly re-calculation of navigation points, or am I simply going about this the wrong way.

    Maybe what I could do is create pre-located instances that spawn during certain missions, was kinda hoping for the whole random destination thing.

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