Designing Custom AI with Car Behavior

0 favourites
  • 3 posts
From the Asset Store
Fly Bound
$2.49 USD
Design for game, asset for game, game kit, UI design, completed design for game FLY BOUND
  • I'm working on a game concept which is set amongst a sandbox-style city (think really, really simple 2D Google Maps) where the player must walk or drive from destination to destination to continually "getaway" from his pursuers. There are two styles of AI car mechanics I want to employ:

    1. The cars follow a "casual" course throughout the city. Just about any game set to a cityscape - Legos Avengers, Spider-Man 2, GTA, Need For Speed: Most Wanted, etc, etc, etc - that has NPC cars driving about, turning at intersections, avoiding other cars... Sunday drivers of the best sort.

    2. Enemy AI cars that are actively chasing down the player but pursuing in Car behavior style. This quickly becomes problematic when factoring in things like collisions with Solid-behavior objects and how to get the Car AI to back up when necessary and know when enough is enough to resume the proper course.

    I would and have attempted to use the Pathfinding behavior, but this also quickly defeats the impression of enemies following in Car behavior style. And the enemies still get stuck on Solid objects even then, even when using cell padding.

    I would appreciate any suggestions, alternatives, full-blown solutions that I can use for my own... I'm aware that I'm attempting something well beyond my current skill set and I'm just at a lost.

    Thank you for your help and input.

  • There’s this older topic with some ideas. The ones I did I’ve never been super happy with:

    construct.net/en/forum/construct-2/how-do-i-18/creating-top-down-car-traffic-127583

    Best I can tell it involves solving a lot of little problems that together can give the result you’re after.

    * making car follow road. Obeying traffic rules.

    *avoid collisions with obstacles.

    *avoid collisions with other moving cars.

    Pathfinding is too much for this, and it can’t handle moving obsticles. It’s enough to only look ahead a short time in the future. Basically calculate where the cars will be like 10 frames in the future if the stay in the direction they are going, and if they collide then brake or steer now to avoid collision. Seems there are a lot of options here, you could do something arbitrary or come up with something more sophisticated to choose what to do.

    Probably you’d add some events for the cars ai so it can break some of the rules depending on the situation. On example is the pursuing vehicle, it would want to crash into the player car, and maybe wouldn’t mind hiring other cars or walls to do it.

    Speaking of collisions, you’d probably want to use physics instead of the car behavior in this case. The solid behavior isn’t up to snuff for collisions.

    For the Sunday drivers following the road, you can probably just have it decide where to drive as it goes. Mostly just knowing what road section it’s on and what intersection is coming up.

    Out of ordinary stuff would be good to handle too. Like it the car is knocked off the road it may need to backup or whatnot to get back on the road. Or maybe it could need to navigate around cars blocking the road or make excessive maneuvers to avoid reckless drivers. There’s probably a lot of extra finesse you could add.

    Kind of complex overall I think.

    A simplification would be to just think of each car individually responding to its sensors of what’s around it. Could give some interesting divergent behavior.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah... And to figure out a fraction of that would be ridiculously time-consuming on my part right now. I don't think I'm ready for all of that. *sighs*

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