Roblox Pursuit AI: autonomous & self-driving cop car chases

I’m actually working on my own autonomous vehicle system, and you’re my top inspiration for this project. Though… mine is a bit more “general purpose” (i.e. non-pursuit) and essentially a framework with functionality to follow a given path with rudimentary collision avoidance logic. I plan on eventually releasing it once improved, and I hope you check it out when I do.

P.S. Do I have your permission to add pursuit functionality to the open version, because that might be plagiarism.

P.P.S. Your clip is awesome! I’ve bookmarked this post for any updates!

Really cool that you are using this project for inspiration! I am curious to see what you’ll create! :eyes:

Yes, when I will open-source it, I’ll probably release it under the MIT License, allowing anyone to use, redistribute and modify the code :upside_down_face:

Haha, it was very unexpected and it was an improvisation of the officers :see_no_evil:
Nice to see that the cops can sometimes make really clever decisions (and sometimes get stuck between two hills :roll_eyes:)

1 Like

So far, it’s just a proof-of-concept build. But, during my testing on randomly generated terrain, it’s able to path across the entire map of 2048x2048 studs provided it doesn’t get stuck on any riverbeds. I plan to improve the AI a lot more before release.

EDIT:

I actually published a test place for my own AI cars! I wonder if it’s as good as yours… (probably not.)
https://www.roblox.com/games/7103387447/Autonomous-Vehicle-Showcase?refPageId=6bc3f4a6-dc19-4a06-adab-f297bce24bfe

1 Like

Honestly, it’s not very bad at all! Does it generate pathing automatically or manually? I saw that it is driving with a curve to the destination, but maybe you put invisible nodes there?

Not at all! It’s using Roblox internal pathfinding, and I fire an event with a single argument: an array containing nodes for a path, which the car drives to. I handle pathing separately independently from driving logic, so I could use literally any array of Vector3s, not just pathfinding paths.

P.S. I’ll send you my AI system in a private message if you want. It uses the same math as you did.

1 Like

Last days I’ve really been busy on making chases more challenging when police officers are near, and a rare occasion happened during testing, they performed a perfect PIT maneuver, I just love it :heart_eyes:

5 Likes

This has some serious Beam.NG vibes.

2 Likes

That’s impressive! In the real world, usually people is a bicycle control model along with an RRT* pathfinder. This allows handling all sorts of dynamics such as drifting, acceleration, rotational acceleration, and of course vehicle curves. You could also use an Ackerman steering model for increased precision.

I’m working on a pathfinder that allows that kind of precision, would you be interested in joining the community and giving your input? Discord

2 Likes

Thanks a lot for your kind words! I haven’t heard of RRT* before, but watching a YouTube video about it helped me understanding its principle, and it sounds really interesting!

I’ve joined your Discord server and I’m excited to implement your pathfinder in order to improve the vehicle navigation, however all chat channels seems to be locked (I can’t chat in any :see_no_evil:)

With RRT*, would I still be able to keep the pursuit tactics or should I raycast towards the suspect each Heartbeat to determine whether to use the RRT* pathfinder or use the natural behavior?

This is just impressive.

Please stop making this so good. I feel inferior.

1 Like

So the pursuit tactics are only used without obstacles and when close enough? You could continue to do that, or you can have RRT* use the prediction as the target.

I worked at a place where we used an Extended Kalman filter to predict where an object following bicycle dynamics would be. You can also use neural networks for this purpose as I think @ScriptOn did. One is more of a engineering based approach (linearized dynamical systems) and the other computer science-y.

1 Like

Oh, and another possibility, which I am not sure anyone mentioned here, is using vector fields for avoidance. It is much more efficient than running a pathfinder, although it doesn’t provide guarantees and you need to tune a ton of parameters to make it work for each obstacle. It does make for some nice paths though.

Hahaha I just love to work on it :see_no_evil:

Yes, when the police car is close enough, they will blindly ram the suspects’ vehicle until they’re outside the “circle”.

I don’t really want to go with neural networks since it’s a black box, you can’t debug their decisions and their performance is pretty random in most cases. Currently I am using steering behaviors because of its simplicity:

image

I believe that would be a bit too complex for the current stage of the project, because of its preparation requirements. Definitely going to read a few papers about it though, it might come useful :+1:

Did you apply for the minimum 500,000 USD game fund? This is going to become a hit game!

Getting alot of GTA vibes from these clips. This is some amazing AI here.

Do you think you could also make a mode or a new game where your the police, and you chase the suspects as they try to flee you and sometimes shoot at you?
And there will be other AI cops to help you chase down the suspect.

LSPDFR car chase vibes

Just an idea, but definitely apply for that game fund. These are the kind of games Roblox is looking for. Ones that will attract a new player base.

Many advised me to do so, I’ll look into it. It requires having whole milestone schedules and an investor pitch deck ready, so maybe I’ll write one up when I’ve got time, it’s always possible to give it a shot :sweat_smile:

I love LSPDFR haha

Fleeing and AI backup is a more complicated topic, because the other cars have to take your unit into account (since we obviously don’t want units to crash eachother like in vanilla LSPDFR). If there’s a lot of demand, we’ll probably consider it though, I am personally very interested into making such game possible, but it’s very complex :see_no_evil:

We’ll see what the future brings us… :drum:

1 Like

This is pretty cool, One of the best things overall I’ve seen this year. I don’t know if anyone’s said it yet but I hope this leads to a Roblox version of NFS:MW (2005) or HP. The racing genre (even street racing) has not been explored enough on Roblox IMHO. (On a side note, respect to the voice actors for MW, over 2 hours recorded for variations of lines which the game cuts up and picks based on in-game situations. Same with the soundtrack.)

Also, I can see potential even further beyond the police aspect, this being an example.

Good luck!

1 Like

I’m not really experienced with ‘police chase’-based racing games, but it looks interesting!

In case anyone here created a racing game and wishes to integrate police chases, I’m happy to assist!

For those waiting on an open-sourced version, I’m currently working hard on my own game, and that’s a very fine-tuned model (the whole map is fine-tuned to enhance the driving & improvising the static collision avoidance). I still plan on providing a public version of it though!

@SpeedySanikJr I made a small, low-intelligence demonstration for chasing suspects, I don’t plan on doing anything with it for now, but might consider working on it later:
https://www.roblox.com/games/7275252503

4 Likes

Woah its been a minute. Have you ever decided on open sourcing this projected? I would love to tinker around with this!

Hey! Thanks for your interest in the project!

I’m currently not planning to go open-source on this. I’m still working a lot on it and constantly find new optimizations and add additional features. And, we would like to keep it exclusive to our game, CrimeLogic.

We’ve got cool things to showcase soon though!

2 Likes

This feels better than the small map (Crimelogic) But it’s probably because opened space :sweat_smile:
But still though, There still performing well, but… Not really in terms of dodging obstacles. Good Luck on Crimelogic V2

1 Like