Police, Wanted Levels, Dynamic Respawning and Pursuit Systems

By now if you need an intro, I’m the madman who is constantly implementing new systems and is essentially going wild with his ideas :stuck_out_tongue:

Anyway, I was debating on what I want to add next, and… I figured integrating a Police System, something to pursue you and try to punish you for your crimes, would be a fun thing to do

For the most part, I think it’s almost ready before we even start, since I already have a ‘RespawnManager.cs’, an ‘AggroGroup.cs’ script and other very well respected scripts, but I wanted something that is in the style of ‘Grand Theft Auto’, essentially a system that’ll pursue you when you’ve done a little too many crimes, and the number of respawned cops increases with time, the higher your wanted level is

So for now I’m not asking for help with code, I’m just asking for ideas on how we can go around developing a police system like “Grand Theft Auto”, mixed in a medieval world, where we dynamically instantiate guards (or cops, in this case) in the game world with the sole target of trying to take the player down?

Or if you have any better ideas, please throw them my way. I’m all open with my ears for this one, as long as we can make the game more exciting and alive to play


I think the first step I want to take, is to figure a way to create a Dynamic Spawner, something to get characters, like the police models in this example, to instantiate dynamically into the game when needed, and permanently get deleted on death. It might also have an ‘AggroGroup.cs’ script attached to it

Unlike my other in-game characters, these ones will probably consume A LOT of resources if left on death, so the idea I have is to simply delete their AggroGroup Grandparent, their RespawnManager Parent and the character itself on their death, so there’s probably going to be an even-fourth parent for that to work, especially for the cases of having stuff that spawns for a few moments and then vanishes

You already have guards and a way to turn aggression on and off. Just add a numberOfCrimesCommited variable and an event that triggers when a crime is committed. Then when the number is high enough, turn on aggro. The tricky part will be defining crime in the code. Self defense vs murder? It will probably need a bunch of if statements in the action related classes. For instance, when you gather an ingredient you will need to check for ownership to decide if the crime event triggers.

OK this might be a little too complex, but it’s all good for thought

The big problem I have is, I need to instantiate and permanently delete these guards and all their data from a distance that the player can’t usually see from, as these cops can’t stay in the scene otherwise they’ll mess performance up over the long term, and we also have to make sure that it’s on a NavMesh. It’s the first problem I’m thinking of

I’ll start prototyping with this as soon as Malbers helps me with saving the “Stored Mount” (A way for the game to remember what the last animal the player was driving, so that it’s easier for returning players to find something to drive. Because MalberS uses his own unique SOs, and the script of interest is, literally, 1900+ lines of code long, this is quite hard to decode)

The first problem I have right now, which I can’t figure out yet, is that Malbers’ Script won’t detect the ‘IJsonSaveable’ interface for some reason…! (it won’t recognize the ‘GameDevTV.Saving’ library at all for some reason!)

I’ll get back to this topic soon, currently still fixing a couple of bugs and adding a few “minor” systems (they’re not minor at all, but on a relatively large scale, they’re kinda small)

Still pending on this one…

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms