Skip to content

[1/1] Adjust player collisions while walking on bridges#2174

Draft
wjt wants to merge 1 commit into
mainfrom
wjt/adjust-player-collisions-while-walking-on-bridges
Draft

[1/1] Adjust player collisions while walking on bridges#2174
wjt wants to merge 1 commit into
mainfrom
wjt/adjust-player-collisions-while-walking-on-bridges

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented May 10, 2026

Stack:


Adjust player collisions while walking on bridges

Currently adding a bridge is tedious and error-prone, because the player
collides with cliff-edges and water - exactly what the bridge is
supposed to be crossing! So we have alternative tiles for water & bits
of cliff which do not have collisions - and worse, in the case of water,
we have a second alternative which only has a bottom collision so that
we can have a pontoon that ends in the middle of the water.

Add two new named physics layers, bridge and bridge_edge. Adjust the
bridges tileset to have bridge shapes along the walkable area of bridges
(including their ends) and bridge_edge on the bits of bridges that the
player should not be able to walk off.

Add an Area2D to the player which detects when the player's feet are
touching "bridge"; while the player is on a bridge, it adjusts the
player's collision_mask so that the player does not collide with wall
(cliff edges) and non_walkable_floor (water) and instead collides with
bridge_edge.

The void was previously non_walkable_floor, like water, but because it
sits conceptually over the world, the player shouldn't be able to walk
across it while on a bridge. (This is contradicted by the closing
cutscene of quest_001 but is otherwise always the case.) Define yet
another layer, "void", and move void collisions to that. Update the
player's collision_mask accordingly.

In Fray's End, replace the alternative water and cliff tiles with
regular ones.

To do the pontoon, we need an alternative lower end of bridge tile that
has bridge_edge at its bottom and sides so that the player can't walk
off into the water. This needs to be done manually - annoying but at
least it's on the same layer as the rest of the bridge, unlike the
alternative cliff and water tiles.

Teach the guard to walk across bridges.

Add a new bridge gym scene for testing.

Thanks to Lilith Duncan for helping me think through better approaches
to elevation and bridges!

@wjt wjt requested a review from a team as a code owner May 10, 2026 10:10
@wjt wjt force-pushed the wjt/adjust-player-collisions-while-walking-on-bridges branch from a0bd360 to 99b83ad Compare May 10, 2026 10:13
@github-actions
Copy link
Copy Markdown

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/adjust-player-collisions-while-walking-on-bridges/.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt wjt marked this pull request as draft May 10, 2026 11:28
@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 10, 2026

Hmm, this will break grappling across a bridge, because both the grappling logic and this bridge logic adjust the "collide with water" bit. I guess it will need a little more thought about where the player's physics layers should be controlled.

@manuq
Copy link
Copy Markdown
Collaborator

manuq commented May 11, 2026

@wjt nice! I think a better approach to the "hidden alternative tiles" will be very much welcome.

Besides, grapping, I was able to walk back into the void:

image

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

Working on making it interact better with grappling I realised I can't make it depend on Player because NPCs also need to be able to walk across bridges!

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

npc_bridge.webm

OK that wasn't so har.

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

Another problematic case: bridge perpendicular to water. When your feet are on the start of the bridge, you gain the ability to walk on water.

Screencast.From.2026-05-11.16-51-26.mp4

In this case there is a level design problem: no cliff beneath the path.

image

But because we also disable cliff collisions, adding the cliff doesn't fix it!

@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

Maybe this can be fixed by making the "is a bridge" box a bit smaller, rather than having it be right up against the edge of the tile…

@wjt wjt force-pushed the wjt/adjust-player-collisions-while-walking-on-bridges branch from 99b83ad to bb987c0 Compare May 11, 2026 17:36
@wjt wjt changed the title Adjust player collisions while walking on bridges [1/1] Adjust player collisions while walking on bridges May 11, 2026
@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

I started building a gym with all the (literal) edge cases and found still more with bridges at corners. Need to finish adding all the combinations of these, tomorrow...

What's hard is that cliff edges protrude into the visually-walkable area of the clifftop.

Currently adding a bridge is tedious and error-prone, because the player
collides with cliff-edges and water - exactly what the bridge is
supposed to be crossing! So we have alternative tiles for water & bits
of cliff which do not have collisions - and worse, in the case of water,
we have a second alternative which only has a bottom collision so that
we can have a pontoon that ends in the middle of the water.

Add two new named physics layers, bridge and bridge_edge. Adjust the
bridges tileset to have bridge shapes along the walkable area of bridges
(including their ends) and bridge_edge on the bits of bridges that the
player should not be able to walk off.

Add an Area2D to the player which detects when the player's feet are
touching "bridge"; while the player is on a bridge, it adjusts the
player's collision_mask so that the player does not collide with wall
(cliff edges) and non_walkable_floor (water) and instead collides with
bridge_edge.

The void was previously non_walkable_floor, like water, but because it
sits conceptually over the world, the player shouldn't be able to walk
across it while on a bridge. (This is contradicted by the closing
cutscene of quest_001 but is otherwise always the case.) Define yet
another layer, "void", and move void collisions to that. Update the
player's collision_mask accordingly.

In Fray's End, replace the alternative water and cliff tiles with
regular ones.

To do the pontoon, we need an alternative lower end of bridge tile that
has bridge_edge at its bottom and sides so that the player can't walk
off into the water. This needs to be done manually - annoying but at
least it's on the same layer as the rest of the bridge, unlike the
alternative cliff and water tiles.

Teach the guard to walk across bridges.

Add a new bridge gym scene for testing.

Thanks to Lilith Duncan for helping me think through better approaches
to elevation and bridges!
@wjt wjt force-pushed the wjt/adjust-player-collisions-while-walking-on-bridges branch from bb987c0 to d8b1ea2 Compare May 11, 2026 17:38
@wjt
Copy link
Copy Markdown
Member Author

wjt commented May 11, 2026

image

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

Successfully merging this pull request may close these issues.

2 participants