BlueGit

timfa questward

text tweaks

timfa Tim Falken · pushed by timfa

Authored 2026-08-26 · 2 months ago

Hash
beb6a1458e903edaf85f81e951a962fd44755ea2
Parent
ca9cfb7e
3 files changed +53 −19
client/src/play/market.js +6 −6
@@ -181,7 +181,7 @@ export function initMarket ({
181 181 {
182 182 buyFee.textContent = selectedBuyItemId == null
183 183 ? ""
184 : `Escrow ${formatQuantity(escrow)} + listing fee ${formatQuantity(fee)} (3%, non-refundable)`;
184 : `Escrow ${formatQuantity(escrow)} + listing fee ${formatQuantity(fee)}.`;
185 185 }
186 186 }
187 187
@@ -194,7 +194,7 @@ export function initMarket ({
194 194 {
195 195 sellFee.textContent = selectedSellSlot == null
196 196 ? ""
197 : `Listing fee ${formatQuantity(fee)} (3% of min value, non-refundable)`;
197 : `Listing fee ${formatQuantity(fee)}.`;
198 198 }
199 199 }
200 200
@@ -222,7 +222,7 @@ export function initMarket ({
222 222 sellSuggest.hidden = false;
223 223 sellSuggest.dataset.price = String(price);
224 224 sellSuggest.textContent = `Market ~${formatQuantity(price)}`;
225 sellSuggest.title = "Use shopkeeper market price (seed + last-sale lerp) as min price";
225 sellSuggest.title = "Suggested price based on market value.";
226 226 }
227 227
228 228 function renderOrders ()
@@ -314,7 +314,7 @@ export function initMarket ({
314 314 if (sellSelected)
315 315 {
316 316 sellSelected.textContent = listing.isCheque
317 ? `Selling cheque for ${listing.quantity}× ${listing.displayName} (quantity locked)`
317 ? `Selling cheque for ${listing.quantity}× ${listing.displayName}.`
318 318 : `Selling ${itemDisplayName(slot)}`;
319 319 }
320 320 updateSellSuggest(listing.itemId);
@@ -377,7 +377,7 @@ export function initMarket ({
377 377 {
378 378 coinsEl.textContent = funds === loose
379 379 ? `Funds: ${formatQuantity(funds)}`
380 : `Funds: ${formatQuantity(funds)} (coins + coin cheques)`;
380 : `Funds: ${formatQuantity(funds)} (coins + cheques)`;
381 381 }
382 382 if (activeTab === "sell")
383 383 { renderSellables(); }
@@ -411,7 +411,7 @@ export function initMarket ({
411 411 { title.textContent = payload.displayName || "Central Exchange"; }
412 412 if (hintEl)
413 413 {
414 hintEl.textContent = "Placing an order costs a 3% listing fee (non-refundable). Matches are private; unfilled orders expire after one month.";
414 hintEl.textContent = "Placing an order costs a 3% listing fee.";
415 415 }
416 416 if (backdrop)
417 417 { backdrop.hidden = false; }
@@ -181,7 +181,7 @@ export function initMarket ({
181 {
181 {
182 buyFee.textContent = selectedBuyItemId == null
182 buyFee.textContent = selectedBuyItemId == null
183 ? ""
183 ? ""
184 : `Escrow ${formatQuantity(escrow)} + listing fee ${formatQuantity(fee)} (3%, non-refundable)`;
184 : `Escrow ${formatQuantity(escrow)} + listing fee ${formatQuantity(fee)}.`;
185 }
185 }
186 }
186 }
187
187
@@ -194,7 +194,7 @@ export function initMarket ({
194 {
194 {
195 sellFee.textContent = selectedSellSlot == null
195 sellFee.textContent = selectedSellSlot == null
196 ? ""
196 ? ""
197 : `Listing fee ${formatQuantity(fee)} (3% of min value, non-refundable)`;
197 : `Listing fee ${formatQuantity(fee)}.`;
198 }
198 }
199 }
199 }
200
200
@@ -222,7 +222,7 @@ export function initMarket ({
222 sellSuggest.hidden = false;
222 sellSuggest.hidden = false;
223 sellSuggest.dataset.price = String(price);
223 sellSuggest.dataset.price = String(price);
224 sellSuggest.textContent = `Market ~${formatQuantity(price)}`;
224 sellSuggest.textContent = `Market ~${formatQuantity(price)}`;
225 sellSuggest.title = "Use shopkeeper market price (seed + last-sale lerp) as min price";
225 sellSuggest.title = "Suggested price based on market value.";
226 }
226 }
227
227
228 function renderOrders ()
228 function renderOrders ()
@@ -314,7 +314,7 @@ export function initMarket ({
314 if (sellSelected)
314 if (sellSelected)
315 {
315 {
316 sellSelected.textContent = listing.isCheque
316 sellSelected.textContent = listing.isCheque
317 ? `Selling cheque for ${listing.quantity}× ${listing.displayName} (quantity locked)`
317 ? `Selling cheque for ${listing.quantity}× ${listing.displayName}.`
318 : `Selling ${itemDisplayName(slot)}`;
318 : `Selling ${itemDisplayName(slot)}`;
319 }
319 }
320 updateSellSuggest(listing.itemId);
320 updateSellSuggest(listing.itemId);
@@ -377,7 +377,7 @@ export function initMarket ({
377 {
377 {
378 coinsEl.textContent = funds === loose
378 coinsEl.textContent = funds === loose
379 ? `Funds: ${formatQuantity(funds)}`
379 ? `Funds: ${formatQuantity(funds)}`
380 : `Funds: ${formatQuantity(funds)} (coins + coin cheques)`;
380 : `Funds: ${formatQuantity(funds)} (coins + cheques)`;
381 }
381 }
382 if (activeTab === "sell")
382 if (activeTab === "sell")
383 { renderSellables(); }
383 { renderSellables(); }
@@ -411,7 +411,7 @@ export function initMarket ({
411 { title.textContent = payload.displayName || "Central Exchange"; }
411 { title.textContent = payload.displayName || "Central Exchange"; }
412 if (hintEl)
412 if (hintEl)
413 {
413 {
414 hintEl.textContent = "Placing an order costs a 3% listing fee (non-refundable). Matches are private; unfilled orders expire after one month.";
414 hintEl.textContent = "Placing an order costs a 3% listing fee.";
415 }
415 }
416 if (backdrop)
416 if (backdrop)
417 { backdrop.hidden = false; }
417 { backdrop.hidden = false; }
client/src/render/worldView.js +46 −12
@@ -28,6 +28,8 @@ const WALK_TILT_DEG = 6;
28 28 const RUN_TILT_DEG = 8;
29 29 const SHOVE_TILE_FRACTION = 0.25;
30 30 const SHOVE_MS = 280;
31 /** Soft reflow when stack circle targets change (join/leave a shared tile). */
32 const STACK_SPREAD_LERP_MS = 280;
31 33 /** Hold gather-tool equip overlay slightly past swing interval so it stays visible between swings. */
32 34 const GATHER_TOOL_HOLD_MS = 1100;
33 35 const DAMAGE_FLASH_MS = 180;
@@ -657,7 +659,7 @@ export class WorldView
657 659 {
658 660 const now = performance.now();
659 661 const size = this.tileSize();
660 this.#refreshStackOffsets();
662 this.#refreshStackTargets();
661 663 for (const entity of this.entities.values())
662 664 {
663 665 const target = entity.targetX != null && entity.targetY != null
@@ -676,6 +678,7 @@ export class WorldView
676 678 entity.visualX = target.x;
677 679 entity.visualY = target.y;
678 680 }
681 this.#updateStackOffset(entity, now);
679 682 this.#updateShove(entity, now, size);
680 683 this.#expireGatherToolOverlay(entity, now);
681 684 this.#placeEntity(entity, now);
@@ -690,18 +693,18 @@ export class WorldView
690 693 }
691 694
692 695 /**
693 * Evenly space stacked entities on a circle around the tile centre.
696 * Desired circle offsets for stacked entities (applied via {@link #updateStackOffset}).
694 697 * Stable assignment by entityId; free-flight entities stay unshifted.
695 698 */
696 #refreshStackOffsets ()
699 #refreshStackTargets ()
697 700 {
698 701 const byTile = new Map();
699 702 for (const entity of this.entities.values())
700 703 {
701 704 if (entity.freeFlight)
702 705 {
703 entity.stackOffsetX = 0;
704 entity.stackOffsetY = 0;
706 entity.stackTargetX = 0;
707 entity.stackTargetY = 0;
705 708 continue;
706 709 }
707 710 const key = `${entity.tileX},${entity.tileY}`;
@@ -720,8 +723,8 @@ export class WorldView
720 723 {
721 724 for (const entity of list)
722 725 {
723 entity.stackOffsetX = 0;
724 entity.stackOffsetY = 0;
726 entity.stackTargetX = 0;
727 entity.stackTargetY = 0;
725 728 }
726 729 continue;
727 730 }
@@ -730,12 +733,43 @@ export class WorldView
730 733 for (let i = 0; i < n; i++)
731 734 {
732 735 const angle = -Math.PI / 2 + (Math.PI * 2 * i) / n;
733 list[i].stackOffsetX = Math.cos(angle) * radius;
734 list[i].stackOffsetY = Math.sin(angle) * radius;
736 list[i].stackTargetX = Math.cos(angle) * radius;
737 list[i].stackTargetY = Math.sin(angle) * radius;
735 738 }
736 739 }
737 740 }
738 741
742 #updateStackOffset (entity, now)
743 {
744 const tx = entity.stackTargetX ?? 0;
745 const ty = entity.stackTargetY ?? 0;
746 const cx = entity.stackOffsetX ?? 0;
747 const cy = entity.stackOffsetY ?? 0;
748 if (entity.stackLerpToX !== tx || entity.stackLerpToY !== ty)
749 {
750 entity.stackFromX = cx;
751 entity.stackFromY = cy;
752 entity.stackLerpToX = tx;
753 entity.stackLerpToY = ty;
754 entity.stackLerpStarted = now;
755 }
756 if (entity.stackLerpStarted == null)
757 {
758 entity.stackOffsetX = tx;
759 entity.stackOffsetY = ty;
760 return;
761 }
762 const t = Math.min(1, (now - entity.stackLerpStarted) / STACK_SPREAD_LERP_MS);
763 entity.stackOffsetX = entity.stackFromX + (tx - entity.stackFromX) * t;
764 entity.stackOffsetY = entity.stackFromY + (ty - entity.stackFromY) * t;
765 if (t >= 1)
766 {
767 entity.stackOffsetX = tx;
768 entity.stackOffsetY = ty;
769 entity.stackLerpStarted = null;
770 }
771 }
772
739 773 #updateShove (entity, now, tileSize)
740 774 {
741 775 if (!entity.shove)
@@ -1312,11 +1346,11 @@ export class WorldView
1312 1346
1313 1347 entity.object.transform.rotation = walkTilt;
1314 1348 this.#syncLitSprite(entity.object, tileShade, flashStrength, wade);
1315 this.#placePivoted(entity.object, pivotX, pivotY, entity.visualY, SORT_ENTITY, entity.visualScale ?? 1);
1349 this.#placePivoted(entity.object, pivotX, pivotY, pivotY, SORT_ENTITY, entity.visualScale ?? 1);
1316 1350 for (let index = 0; index < (entity.overlays ?? []).length; index++)
1317 1351 {
1318 1352 const overlay = entity.overlays[index];
1319 const overlaySortY = entity.visualY + 0.5 * (index + 1);
1353 const overlaySortY = pivotY + 0.5 * (index + 1);
1320 1354 overlay.transform.rotation = walkTilt;
1321 1355 this.#syncLitSprite(overlay, tileShade, flashStrength, wade, entity.overlayTints?.[index] ?? null);
1322 1356 this.#placePivoted(overlay, pivotX, pivotY, overlaySortY, SORT_ENTITY, entity.visualScale ?? 1);
@@ -1328,7 +1362,7 @@ export class WorldView
1328 1362 { continue; }
1329 1363 overlay.transform.rotation = walkTilt;
1330 1364 this.#syncLitSprite(overlay, tileShade, flashStrength, wade);
1331 this.#placePivoted(overlay, pivotX, pivotY, entity.visualY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
1365 this.#placePivoted(overlay, pivotX, pivotY, pivotY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
1332 1366 }
1333 1367 this.#placeHpBar(entity, pivotX, pivotY);
1334 1368 }
@@ -28,6 +28,8 @@ const WALK_TILT_DEG = 6;
28const RUN_TILT_DEG = 8;
28const RUN_TILT_DEG = 8;
29const SHOVE_TILE_FRACTION = 0.25;
29const SHOVE_TILE_FRACTION = 0.25;
30const SHOVE_MS = 280;
30const SHOVE_MS = 280;
31/** Soft reflow when stack circle targets change (join/leave a shared tile). */
32const STACK_SPREAD_LERP_MS = 280;
31/** Hold gather-tool equip overlay slightly past swing interval so it stays visible between swings. */
33/** Hold gather-tool equip overlay slightly past swing interval so it stays visible between swings. */
32const GATHER_TOOL_HOLD_MS = 1100;
34const GATHER_TOOL_HOLD_MS = 1100;
33const DAMAGE_FLASH_MS = 180;
35const DAMAGE_FLASH_MS = 180;
@@ -657,7 +659,7 @@ export class WorldView
657 {
659 {
658 const now = performance.now();
660 const now = performance.now();
659 const size = this.tileSize();
661 const size = this.tileSize();
660 this.#refreshStackOffsets();
662 this.#refreshStackTargets();
661 for (const entity of this.entities.values())
663 for (const entity of this.entities.values())
662 {
664 {
663 const target = entity.targetX != null && entity.targetY != null
665 const target = entity.targetX != null && entity.targetY != null
@@ -676,6 +678,7 @@ export class WorldView
676 entity.visualX = target.x;
678 entity.visualX = target.x;
677 entity.visualY = target.y;
679 entity.visualY = target.y;
678 }
680 }
681 this.#updateStackOffset(entity, now);
679 this.#updateShove(entity, now, size);
682 this.#updateShove(entity, now, size);
680 this.#expireGatherToolOverlay(entity, now);
683 this.#expireGatherToolOverlay(entity, now);
681 this.#placeEntity(entity, now);
684 this.#placeEntity(entity, now);
@@ -690,18 +693,18 @@ export class WorldView
690 }
693 }
691
694
692 /**
695 /**
693 * Evenly space stacked entities on a circle around the tile centre.
696 * Desired circle offsets for stacked entities (applied via {@link #updateStackOffset}).
694 * Stable assignment by entityId; free-flight entities stay unshifted.
697 * Stable assignment by entityId; free-flight entities stay unshifted.
695 */
698 */
696 #refreshStackOffsets ()
699 #refreshStackTargets ()
697 {
700 {
698 const byTile = new Map();
701 const byTile = new Map();
699 for (const entity of this.entities.values())
702 for (const entity of this.entities.values())
700 {
703 {
701 if (entity.freeFlight)
704 if (entity.freeFlight)
702 {
705 {
703 entity.stackOffsetX = 0;
706 entity.stackTargetX = 0;
704 entity.stackOffsetY = 0;
707 entity.stackTargetY = 0;
705 continue;
708 continue;
706 }
709 }
707 const key = `${entity.tileX},${entity.tileY}`;
710 const key = `${entity.tileX},${entity.tileY}`;
@@ -720,8 +723,8 @@ export class WorldView
720 {
723 {
721 for (const entity of list)
724 for (const entity of list)
722 {
725 {
723 entity.stackOffsetX = 0;
726 entity.stackTargetX = 0;
724 entity.stackOffsetY = 0;
727 entity.stackTargetY = 0;
725 }
728 }
726 continue;
729 continue;
727 }
730 }
@@ -730,12 +733,43 @@ export class WorldView
730 for (let i = 0; i < n; i++)
733 for (let i = 0; i < n; i++)
731 {
734 {
732 const angle = -Math.PI / 2 + (Math.PI * 2 * i) / n;
735 const angle = -Math.PI / 2 + (Math.PI * 2 * i) / n;
733 list[i].stackOffsetX = Math.cos(angle) * radius;
736 list[i].stackTargetX = Math.cos(angle) * radius;
734 list[i].stackOffsetY = Math.sin(angle) * radius;
737 list[i].stackTargetY = Math.sin(angle) * radius;
735 }
738 }
736 }
739 }
737 }
740 }
738
741
742 #updateStackOffset (entity, now)
743 {
744 const tx = entity.stackTargetX ?? 0;
745 const ty = entity.stackTargetY ?? 0;
746 const cx = entity.stackOffsetX ?? 0;
747 const cy = entity.stackOffsetY ?? 0;
748 if (entity.stackLerpToX !== tx || entity.stackLerpToY !== ty)
749 {
750 entity.stackFromX = cx;
751 entity.stackFromY = cy;
752 entity.stackLerpToX = tx;
753 entity.stackLerpToY = ty;
754 entity.stackLerpStarted = now;
755 }
756 if (entity.stackLerpStarted == null)
757 {
758 entity.stackOffsetX = tx;
759 entity.stackOffsetY = ty;
760 return;
761 }
762 const t = Math.min(1, (now - entity.stackLerpStarted) / STACK_SPREAD_LERP_MS);
763 entity.stackOffsetX = entity.stackFromX + (tx - entity.stackFromX) * t;
764 entity.stackOffsetY = entity.stackFromY + (ty - entity.stackFromY) * t;
765 if (t >= 1)
766 {
767 entity.stackOffsetX = tx;
768 entity.stackOffsetY = ty;
769 entity.stackLerpStarted = null;
770 }
771 }
772
739 #updateShove (entity, now, tileSize)
773 #updateShove (entity, now, tileSize)
740 {
774 {
741 if (!entity.shove)
775 if (!entity.shove)
@@ -1312,11 +1346,11 @@ export class WorldView
1312
1346
1313 entity.object.transform.rotation = walkTilt;
1347 entity.object.transform.rotation = walkTilt;
1314 this.#syncLitSprite(entity.object, tileShade, flashStrength, wade);
1348 this.#syncLitSprite(entity.object, tileShade, flashStrength, wade);
1315 this.#placePivoted(entity.object, pivotX, pivotY, entity.visualY, SORT_ENTITY, entity.visualScale ?? 1);
1349 this.#placePivoted(entity.object, pivotX, pivotY, pivotY, SORT_ENTITY, entity.visualScale ?? 1);
1316 for (let index = 0; index < (entity.overlays ?? []).length; index++)
1350 for (let index = 0; index < (entity.overlays ?? []).length; index++)
1317 {
1351 {
1318 const overlay = entity.overlays[index];
1352 const overlay = entity.overlays[index];
1319 const overlaySortY = entity.visualY + 0.5 * (index + 1);
1353 const overlaySortY = pivotY + 0.5 * (index + 1);
1320 overlay.transform.rotation = walkTilt;
1354 overlay.transform.rotation = walkTilt;
1321 this.#syncLitSprite(overlay, tileShade, flashStrength, wade, entity.overlayTints?.[index] ?? null);
1355 this.#syncLitSprite(overlay, tileShade, flashStrength, wade, entity.overlayTints?.[index] ?? null);
1322 this.#placePivoted(overlay, pivotX, pivotY, overlaySortY, SORT_ENTITY, entity.visualScale ?? 1);
1356 this.#placePivoted(overlay, pivotX, pivotY, overlaySortY, SORT_ENTITY, entity.visualScale ?? 1);
@@ -1328,7 +1362,7 @@ export class WorldView
1328 { continue; }
1362 { continue; }
1329 overlay.transform.rotation = walkTilt;
1363 overlay.transform.rotation = walkTilt;
1330 this.#syncLitSprite(overlay, tileShade, flashStrength, wade);
1364 this.#syncLitSprite(overlay, tileShade, flashStrength, wade);
1331 this.#placePivoted(overlay, pivotX, pivotY, entity.visualY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
1365 this.#placePivoted(overlay, pivotX, pivotY, pivotY + 0.002, SORT_ENTITY, entity.visualScale ?? 1);
1332 }
1366 }
1333 this.#placeHpBar(entity, pivotX, pivotY);
1367 this.#placeHpBar(entity, pivotX, pivotY);
1334 }
1368 }
docs/FEATURES.md +1 −1
@@ -112,7 +112,7 @@ Each entry is a short note on behaviour and where the code lives. Update this fi
112 112 ## Click-to-move and A\* pathfinding
113 113
114 114 **Status:** full
115 **Spec:** `MOVE_TO` runs A\* over the visible 3×3 using block passability and open-chunk bounds. Entities do **not** block each other’s movement (players and mobs pass through). Occupied tiles are still preferred-away for mob wander goals and required to be clear for melee attack stance. Client spreads stacked entities evenly on a circle (`ENTITY_STACK_SPREAD_DIAMETER_PX`, centred on the tile); within-tile y-sort still uses each sprite’s visual Y. Server commits integer tiles on the movement cadence. Neighbour expansion prefers steps that most reduce Manhattan distance to the goal; remaining ties break by axis — **players prefer vertical**, **mobs prefer horizontal** — so mutual approaches are less likely to oscillate sideways.
115 **Spec:** `MOVE_TO` runs A\* over the visible 3×3 using block passability and open-chunk bounds. Entities do **not** block each other’s movement (players and mobs pass through). Occupied tiles are still preferred-away for mob wander goals and required to be clear for melee attack stance. Client spreads stacked entities evenly on a circle (`ENTITY_STACK_SPREAD_DIAMETER_PX`, centred on the tile) with a short lerp into place; within-tile y-sort still uses each sprite’s visual Y. Server commits integer tiles on the movement cadence. Neighbour expansion prefers steps that most reduce Manhattan distance to the goal; remaining ties break by axis — **players prefer vertical**, **mobs prefer horizontal** — so mutual approaches are less likely to oscillate sideways.
116 116 **Code:** `server/src/navigation/astar.js`, `server/src/simulation/workerWorld.js` (`#moveTo`, `#stepMovement`, `walkableFor`, `isClearStanding`)
117 117
118 118 ## Global walk/run cadence
@@ -112,7 +112,7 @@ Each entry is a short note on behaviour and where the code lives. Update this fi
112## Click-to-move and A\* pathfinding
112## Click-to-move and A\* pathfinding
113
113
114**Status:** full
114**Status:** full
115**Spec:** `MOVE_TO` runs A\* over the visible 3×3 using block passability and open-chunk bounds. Entities do **not** block each other’s movement (players and mobs pass through). Occupied tiles are still preferred-away for mob wander goals and required to be clear for melee attack stance. Client spreads stacked entities evenly on a circle (`ENTITY_STACK_SPREAD_DIAMETER_PX`, centred on the tile); within-tile y-sort still uses each sprite’s visual Y. Server commits integer tiles on the movement cadence. Neighbour expansion prefers steps that most reduce Manhattan distance to the goal; remaining ties break by axis — **players prefer vertical**, **mobs prefer horizontal** — so mutual approaches are less likely to oscillate sideways.
115**Spec:** `MOVE_TO` runs A\* over the visible 3×3 using block passability and open-chunk bounds. Entities do **not** block each other’s movement (players and mobs pass through). Occupied tiles are still preferred-away for mob wander goals and required to be clear for melee attack stance. Client spreads stacked entities evenly on a circle (`ENTITY_STACK_SPREAD_DIAMETER_PX`, centred on the tile) with a short lerp into place; within-tile y-sort still uses each sprite’s visual Y. Server commits integer tiles on the movement cadence. Neighbour expansion prefers steps that most reduce Manhattan distance to the goal; remaining ties break by axis — **players prefer vertical**, **mobs prefer horizontal** — so mutual approaches are less likely to oscillate sideways.
116**Code:** `server/src/navigation/astar.js`, `server/src/simulation/workerWorld.js` (`#moveTo`, `#stepMovement`, `walkableFor`, `isClearStanding`)
116**Code:** `server/src/navigation/astar.js`, `server/src/simulation/workerWorld.js` (`#moveTo`, `#stepMovement`, `walkableFor`, `isClearStanding`)
117
117
118## Global walk/run cadence
118## Global walk/run cadence