Skip to content

Allow the player to toggle a waypoint that directs them towards the world origin - #533

Merged
patowen merged 1 commit into
Ralith:masterfrom
patowen:home-waypoint
Sep 25, 2026
Merged

patowen merged 1 commit into
Ralith:masterfrom
patowen:home-waypoint

Conversation

@patowen

@patowen patowen commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

The button on the keyboard to toggle this is "Home".
image

The waypoint marker will be stopped by the boundaries of the viewport, allowing it to always be visible regardless of which direction the player is looking.

@patowen

patowen commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator Author

Keeping as a draft for now. There's a bug where toggling the waypoint on and off causes the UI to flicker. I think this may be a bug in yakui itself, as there doesn't seem a good way to prevent this bug.

I seem to be able to avoid this bug by always rendering a mesh. It doesn't have to be the same mesh, but it does at least need either the same number of vertices or the same number of indices, or both (I'm not exactly sure what the requirement is).

It may be okay to merge this while the bug is still active. It looks silly, but it's not game-breaking.

@Ralith

Ralith commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Are the validation layers clean? Anything funny in the number of vertices/draws/whatever yakui generates? Probably worth updating yakui to see if that helps, though I'm not sure how churny that will be.

Comment thread common/src/graph.rs Outdated
Comment thread common/src/graph.rs Outdated
Comment thread common/src/graph.rs Outdated
Comment thread common/src/graph.rs Outdated
@Ralith

Ralith commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Very happy to have this feature, btw! This is an overwhelmingly important primitive to make the game playable. Follow-up work is probably to attach the marker to an entity and let the player move the entity around.

@patowen

patowen commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Very happy to have this feature, btw! This is an overwhelmingly important primitive to make the game playable. Follow-up work is probably to attach the marker to an entity and let the player move the entity around.

Just to make sure I understand, is the primitive you are calling important the path_between_nodes function or the ability to render a waypoint (or both)?

I made a mistake in this PR and accidentally included #532 unnecessarily.

@Ralith

Ralith commented Sep 23, 2026

Copy link
Copy Markdown
Owner

The part users will care about is obviously the UI, but finding a path is presumably an inextricable part of that.

@Ralith

Ralith commented Sep 23, 2026

Copy link
Copy Markdown
Owner

I guess not actually necessary when the waypoint is the origin, but it will be for the natural evolution of the feature.

@patowen

patowen commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

Are the validation layers clean? Anything funny in the number of vertices/draws/whatever yakui generates? Probably worth updating yakui to see if that helps, though I'm not sure how churny that will be.

While the validation errors and synchronization hazards are clean, I do now think it's more likely to be a bug in Hypermine than a bug in Vulkan, as I was not easily able to reproduce the issue with similar code in yakui's Vulkan example. It could still go either way, but I would like to double-check Hypermine's logic.

One bug that my be related: It appears that the waypoint is slightly desynced with the rendering of the voxels. Interestingly, it seems to be one frame ahead instead of one frame behind.

@Ralith

Ralith commented Sep 24, 2026

Copy link
Copy Markdown
Owner

Yeah, sounds like some flavor of sync issue all right.

@patowen

patowen commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

Yeah, sounds like some flavor of sync issue all right.

This might be a yakui issue after all. Since Yakui shares a single vertex buffer and a single index buffer between all draw calls, I think the issue might be that if I call YakuiVulkan::paint while the previous frame is still in flight, it will hijack the data being rendered from the previous frame, causing the previous frame to render with the new vertex/index data but the old draw calls.

My guess is that validation layers don't catch this because the memory is HOST_VISIBLE | HOST_COHERENT, which likely means that external synchronization requirements are relaxed.

The function in Yakui YakuiVulkan::build_draw_calls seems like all it does is populate a Vec<DrawCall>, but it also sneakily updates the shared index_buffer and vertex_buffer before returning. This has not changed between v0.3.0 and the current main branch as of 2026-09-23, and I was able to get similar flickering when testing yakui's master branch.

@patowen

patowen commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

@Ralith, I'm not sure if the effort of fixing this bug and/or finding a workaround is worth blocking this PR. I'm going to go ahead and remove the "draft" status from this PR. If this gets merged, I can file an issue for the race condition.

Comment thread client/src/sim.rs Outdated
Comment thread client/src/sim.rs
Comment thread client/src/sim.rs
@patowen
patowen force-pushed the home-waypoint branch 2 times, most recently from d1ab4bf to 3852c22 Compare September 24, 2026 17:39
Comment thread client/src/graphics/gui.rs Outdated
@patowen
patowen merged commit 2df43c1 into Ralith:master Sep 25, 2026
4 checks passed
@patowen
patowen deleted the home-waypoint branch September 25, 2026 03:56
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