-
Notifications
You must be signed in to change notification settings - Fork 1
feat(#115): add free-cam exploration to the world map #864
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0c42624
feat(#115): drive the isometric camera with locked-rotation free-cam
zgeoff 27a474e
fix(test): install app-web's zustand reset before its store imports
zgeoff 5ac7af9
feat(#115): drive the reveal query cache from the free-cam viewport
zgeoff 91648be
fix(#115): fix camera remount reset and avatar-switch region gap
zgeoff 449820d
fix(#115): assert the reveal cell cap against the chunk-aligned viewport
zgeoff f3f9802
fix(#115): address free-cam review findings
zgeoff 3d52551
fix(#115): skip viewport tracking while the camera faces off-ground
zgeoff 84f4ea9
feat(#115): raise drag truck speed from playtesting
zgeoff 93b3077
test(#115): drop library-derived camera expectations and a cast
zgeoff cf9cc2a
test(#115): align the free-cam test suites with the testing skill
zgeoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| [test] | ||
| preload = ["@zgeoff/bun-test-extended", "./test-setup.ts"] | ||
| preload = ["@zgeoff/bun-test-extended", "./register-zustand-reset-early.ts", "./test-setup.ts"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import { registerZustandReset } from '@vers/client-test-utils'; | ||
|
|
||
| // its own preload entry, ahead of `test-setup.ts`: that file's local `register-*-mock` imports | ||
| // (`registerWorldmapSceneMock` among them) transitively import zustand-backed stores, and | ||
| // `registerZustandReset` must wrap zustand's `create` before any of those imports run or the | ||
| // stores they create are never tracked for reset — a same-file call after those imports is too | ||
| // late, since ES module imports are hoisted and evaluate before the importing module's own body | ||
| registerZustandReset(); | ||
29 changes: 29 additions & 0 deletions
29
apps/web/src/lib/activity/build-revealed-nodes-query-options.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { expect, test } from 'bun:test'; | ||
| import { buildRevealedNodesQueryOptions } from './build-revealed-nodes-query-options'; | ||
|
|
||
| test('it keys the query by avatar id and viewport, with a sensible staleTime', () => { | ||
| const viewport = { maxCX: 16, maxCY: 16, minCX: 0, minCY: 0 }; | ||
| const options = buildRevealedNodesQueryOptions('avatar_1', viewport); | ||
|
|
||
| expect(options.queryKey).toMatchInlineSnapshot(` | ||
| [ | ||
| [ | ||
| "getRevealedNodes", | ||
| ], | ||
| { | ||
| "input": { | ||
| "avatarID": "avatar_1", | ||
| "viewport": { | ||
| "maxCX": 16, | ||
| "maxCY": 16, | ||
| "minCX": 0, | ||
| "minCY": 0, | ||
| }, | ||
| }, | ||
| "type": "query", | ||
| }, | ||
| ] | ||
| `); | ||
|
|
||
| expect(options.staleTime).toBe(30_000); | ||
| }); |
23 changes: 23 additions & 0 deletions
23
apps/web/src/lib/activity/build-revealed-nodes-query-options.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import type { Viewport } from '@vers/worldmap-core'; | ||
| import { orpc } from '../rpc/orpc'; | ||
|
|
||
| /** | ||
| * Reveal state changes only when the avatar earns a new first-clear grant, far less often than the | ||
| * player pans — long enough that a re-mount or window refocus doesn't re-fetch a viewport nothing | ||
| * has changed for. | ||
| */ | ||
| const REVEALED_NODES_STALE_TIME_MS = 30_000; | ||
|
|
||
| /** | ||
| * Query options for an avatar's revealed world-map cells inside a viewport. The query key carries | ||
| * both inputs: the avatar id, so no avatar ever reads another's cached reveal data, and the | ||
| * viewport. Callers pass an already chunk-aligned viewport, so for a given avatar the key changes | ||
| * only when the player pans across a chunk boundary rather than on every frame's cell-granular | ||
| * move. | ||
| */ | ||
|
zgeoff marked this conversation as resolved.
|
||
| export function buildRevealedNodesQueryOptions(avatarID: string, viewport: Viewport) { | ||
| return orpc.activity.getRevealedNodes.queryOptions({ | ||
| input: { avatarID, viewport }, | ||
| staleTime: REVEALED_NODES_STALE_TIME_MS, | ||
| }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.