Is there a way to have my pathfinding ignore heroes?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Is there a way to have my pathfinding ignore heroes?

Post by sheamkennedy »

I would like to know if there is an easy way that I can have both my pathfind NPC to() and NPC chases NPC() set up in such a way that they ignore my hero? I know I can have the pathfinding ignore NPCs but I would prefer if the pathfinding accounted for NPCs but ignored my hero.

The reason I would like this is because I'm testing out some stealth gameplay and it's really working great. The only problem is when I use the command "NPC chase NPC" to return my guards to their patrol position they will always take a path which avoids my hero (because I assume my hero is being counted as an NPC to avoid) making hiding from guards in this scenario incredibly easy (so long as I don't walk into their line of sight. It would be preferred if my hero was ignored, this way if my hero is standing along the shortest path back to the guards patrol position then the player will be discovered making gameplay much more realistic and harder.

If this is not an easy thing for me to somehow code into my game I would like to recommend it as a new map option for pathfinding.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

Sounds like this does need to be a new pathfinding feature
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

Bob the Hamster wrote:Sounds like this does need to be a new pathfinding feature
Awesome! How soon would a feature like this be available? I'm really looking forward to this!
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

I don't want to make any promises, this has been a busy season for me, but I took a quick look at the code, and I think it will be relatively easy.

There is already built-in support for ignoring heroes in the pathfinding code, it is just not exposed in the NPC pathfinding yet.

I expect it will be a matter of adding a new bitset to NPC data, making the NPC pathfinding code use it to switch on the option it already has, and then writing a few test cases to make sure it works as expected :)
User avatar
sheamkennedy
Liquid Metal Slime
Posts: 1110
Joined: Mon Sep 16, 2013 9:29 pm
Location: Tama-shi, Tokyo, Japan
Contact:

Post by sheamkennedy »

Awesome! No rush. I do look forward to this.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
� C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Post Reply