Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imps try to squeeze through reinforced walls and get stuck #3724

Closed
elemanzer opened this issue Nov 26, 2024 · 11 comments
Closed

Imps try to squeeze through reinforced walls and get stuck #3724

elemanzer opened this issue Nov 26, 2024 · 11 comments

Comments

@elemanzer
Copy link
Contributor

To reproduce on the provided testmap:

  1. Dig an earth tile to open a corner path to the gems
  2. Reinforce the corner tiles.
wall-squeeze.mp4

classic.zip

@Loobinex
Copy link
Member

Loobinex commented Dec 1, 2024

@elemanzer could you test this bug on this prototype and tell me if that fixes it: 12100583709

@walt253
Copy link
Contributor

walt253 commented Dec 2, 2024

@elemanzer could you test this bug on this prototype and tell me if that fixes it: 12100583709

Can you reproduce it? I can't, but maybe I'm doing it wrong 🤔 (bad timing?)...

@elemanzer
Copy link
Contributor Author

@Loobinex

Sorry had my hands full with TK. I'll test the prototype shortly.

@walt253

That's the 2nd time my testmaps haven't worked for you and now I'm wondering if me using the DK editor for testmaps is breaking something on your setup?

@elemanzer
Copy link
Contributor Author

@Loobinex

Still the same on the prototype unfortunately.

@walt253
Copy link
Contributor

walt253 commented Dec 3, 2024

That prototype is outdated I think.

@Loobinex

Sorry had my hands full with TK. I'll test the prototype shortly.

@walt253

That's the 2nd time my testmaps haven't worked for you and now I'm wondering if me using the DK editor for testmaps is breaking something on your setup?

Mh, I don't think you did anything wrong, it sounds more like a me problem. 😅

@Loobinex
Copy link
Member

@elemanzer could you test this bug on this prototype and tell me if that fixes it: 12100583709

Can you reproduce it? I can't, but maybe I'm doing it wrong 🤔 (bad timing?)...

It easily reproduces for me. You dig open a hole on the testmap so you get rounded corners, then get some imps to mine gems. Then use a reinforce wall special and they will get stuck in the previously open corner.

I briefly checked this out:

  • The behavior with the reinforce wall special is the same as when you get imps to manually reinforce the corner
  • Just doing an update_navigation_triangulation at the end of place_and_process_pretty_wall_slab function is not enough to fix this.

@lokrok
Copy link

lokrok commented Dec 24, 2024

I'm working on limited technical knowledge on this project but I faced this very issue in some maps I'm working on so I decided to take a look.

The place_slab_type_on_map calls in make_safe specify a 1 (or 1u) for the keep_blocks_around argument while instf_reinforce calls place_and_process_pretty_wall_slab which uses 0 for the argument. From a check in place_slab_type_on_map_f, this argument is only used to determine if the blocks around the slab should be updated.

if (!keep_blocks_around)
    update_blocks_around_slab(slb_x,slb_y);

Setting this to a 0 in make_safe solves the pathfinding issue except in the rare edge cases where you activate the special right as a creature hits the corner. However, I have no clue why this was set to 1 and if this would cause any problems. From a check with git blame, this function was rewritten (from DK) with keep_blocks_around enabled. I'm guessing this affects the pathfinding somehow.

This was the map layout I tested on. The rooms to the left are a lair and hatchery to test a creature (instead of an imp).
image

@Loobinex
Copy link
Member

Weird, because I tested it against just having imps reinforce and found the same behavior as with the special.

@lokrok
Copy link

lokrok commented Dec 30, 2024

Weird, because I tested it against just having imps reinforce and found the same behavior as with the special.

@Loobinex
Hmm. After some testing, there seems to be TWO issues here. Disabling keep_blocks_around fixes the initial path-finding, but if an imp (or a creature) is already walking along it's path when the walls are reinforced, it'll get stuck again. This is why I observed those edge-cases I mentioned. My test map was small, but enlarging it so it takes longer to walk to and from places made the issue much more obvious.

Worth mentioning that this doesn't happen if you use the cheat menus "Place terrain mode" to place down a full solid slab.

Atleast this one is somewhat tolerable. All you need to do is give them a slap, while with the Make Safe issue, they'll keep thinking that corner is a valid path.

@Loobinex
Copy link
Member

@lokrok I committed your suggestion

@lokrok
Copy link

lokrok commented Jan 10, 2025

@lokrok I committed your suggestion

Thanks! I've made a separate issue for the similar yet different pathfinding issue found here: #3819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants