Page 1 of 2

[RESOLVED 0.10.19] DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Tue Oct 24, 2017 12:03 pm
by Interkarma
The space surround stairs is not blocked out on navgrid. Will correct during a future pass on mobile NPCs in 0.5.

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Sun Jan 27, 2019 3:01 am
by pango
This issue still exists in dev build (and probable 0.7.32)

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Mon Jan 28, 2019 7:47 pm
by hello
confirming it happens in 0.7.32 ;)

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Mon Jan 28, 2019 8:00 pm
by Hazelnut
I may fail, but going to give this a try since I learned a bit about this area of code when doing my optimisation work recently.

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Mon Jan 28, 2019 10:37 pm
by LypyL
They do the same at Castle Wayrest I believe

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Mon Jan 28, 2019 10:58 pm
by Hazelnut
So turns out the reason is that the staircases are not shown in the map data. The easiest fix would be to alter the source DF datafile to add them, but we can't do that. For now I'm going to try a special case for these stairs. Definitely wishing there was a command to find the name of the block player is in... just took me an hour to find the blockname for the Sentinel palace!

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Mon Jan 28, 2019 11:40 pm
by Hazelnut
Thanks for the info about Wayrest. Wonder if there are any others?

What I plan to do is have a mapping of blockname -> array of Rect's. Each Rect defines a rectangular area where NPCs are forbidden in x,y coords within the block. In future this could be contributed to by mods, but for now it will simply forbid rectangles containing these stairs.

Anyone think this is not the way to fix this, please say before wednesday as that's when I will implement this. I prototyped it tonight and seems to work okay with a hardcoded conditional for Sentinel palace stairs.

(won't be doing it tomorrow evening because going out for a fancy meal with other half to celebrate 26 years together so a higher priority! :D )

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Tue Jan 29, 2019 1:51 am
by Interkarma
When I got around to this, I was just going to add a simple rayast to prevent mobile NPCs from bumping into stuff. It would help them avoid any geometry not blocked out by navgrid. It won't be expensive at all, the mobile only needs to check when seeking next grid position. I'm happy to look at other solutions too.

And congrats on 26 years together! :D

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Tue Jan 29, 2019 1:54 am
by BansheeXYZ
What about a more broad solution involving collision checks? If moving sprite hits a solid wall, then turn it around.

Edit. Interkarma posted same time as me.

Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel

Posted: Tue Jan 29, 2019 9:01 am
by Hazelnut
Interkarma wrote: Tue Jan 29, 2019 1:51 am When I got around to this, I was just going to add a simple rayast to prevent mobile NPCs from bumping into stuff. It would help them avoid any geometry not blocked out by navgrid. It won't be expensive at all, the mobile only needs to check when seeking next grid position. I'm happy to look at other solutions too.
You can do that if you'd prefer. I was looking at it from the point of view of altering the nav grid since that's the current way npc navigation works. A raycast would be a more general solution to the issue, so I'll leave this unless you ask me to do my way due to unexpected complications or something. :)