[RESOLVED 0.10.19] DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
- Interkarma
- Posts: 7249
- Joined: Sun Mar 22, 2015 1:51 am
[RESOLVED 0.10.19] DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
The space surround stairs is not blocked out on navgrid. Will correct during a future pass on mobile NPCs in 0.5.
- pango
- Posts: 3359
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
This issue still exists in dev build (and probable 0.7.32)
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 48
- Joined: Sun Jan 20, 2019 8:18 pm
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
confirming it happens in 0.7.32
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- LypyL
- Posts: 512
- Joined: Sun Mar 22, 2015 3:48 am
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
They do the same at Castle Wayrest I believe
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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!
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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! )
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! )
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Interkarma
- Posts: 7249
- Joined: Sun Mar 22, 2015 1:51 am
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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!
And congrats on 26 years together!
-
- Posts: 555
- Joined: Fri Oct 23, 2015 8:19 pm
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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.
Edit. Interkarma posted same time as me.
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: DragonBreak #89: Mobile NPCs will path through castle stairs in Sentinel
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.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.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods