Skip to content

Make resource building bonuses visible - #96

Open
daedeloth wants to merge 2 commits into
developfrom
claude/project-thread-37n8iv
Open

daedeloth wants to merge 2 commits into
developfrom
claude/project-thread-37n8iv

Conversation

@daedeloth

Copy link
Copy Markdown
Member

Requested by Thijs · project thread

Display options D1 to D4 from the options write-up (resource-bonuses/01-resource-bonus-options.md in the project files). The income rules are unchanged.

Building window (D1)

Farms, lumber camps and mines show where their hourly production comes from, in a small number table (table.ui-breakdown, added to ui.css and the style guide):

  • base production (level),
  • honour (when not 100%),
  • each kind of bonus tile next to the building, with its tile image ("Forest next to it (3 tiles): +60%"),
  • each technology or spell that changes it ("Improved Agriculture +21").

The rows add up to the real income. Village::procBonusses takes an optional &$steps array to report each technology or effect. Its result does not change. Producing::calculateIncome is now built on calculateIncomeSteps, using the same formula and rounding.

The mill shows its share of the farms (farm levels, mill levels) and what another mill level or another farm level would add through the mills.

While placing (D2, D3)

The Build window passes a placement preview for farms, lumber camps and mines: every tile within the building radius + 1 that raises that resource (Dolumar_Map_Map::getBonusTilesAround, generated fresh: about 30 ms at radius 26, cached per request). It needs engine PR CatLabInteractive/dolumar-engine#33, which marks those tiles, outlines the 3x3 area under the pointer and shows "+40% wood / Forest (2)". With the current engine the extra argument is ignored, so this PR can be merged first. After engine #33 merges, composer.lock needs a bump.

Map tiles are not clickable for an explanation. Instead, the tiles are named and marked while placing and shown with their image in the building window.

Text fixes (D4)

  • New Mill description and a Mill bonus explanation.
  • Descriptions say "every forest tile / haystack / stone rock / iron ore rock / gem rock next to it adds 20%". They used to say "a mine".
  • The mill upgrade preview now counts the extra mill level (level 1 to 2 with 5 farm levels: 291, it used to say 340).
  • The dead income_increase value is removed (it was always 0).
  • English and Dutch. Other languages fall back to English for the new keys.

Screenshots

In the project files under resource-bonuses/: desktop-farm-window.png, mobile-mill-window.png, mobile-lumber-window.png, desktop-placing-lumber.png, mobile-placing-lumber.png.

Tests

  • New tests/Buildings/ResourceBonusTest.php (unit): mill formula, mill upgrade preview, mill breakdown, bonus tiles around a point compared with the generator, bonus keys.
  • New tests/Integration/IncomeBreakdownTest.php: lumber camp on a forest tile; the breakdown adds up to getIncome() and the preview lists the tile.
  • Unit suite: 185 tests OK. phpcs is clean on the changed files.
  • Played locally with a village that has honour 92% and Agriculture, on desktop and mobile. Farm 396 − 32 + 73 + 21 = 458, which matches the real income. A building placed on a marked forest tile lands there.
  • tools/smoke.sh: one failure, /signs/x.php forbidden. That check needs the .htaccess rules, which the local php -S router does not apply, and it fails without this change too.

Generated by Claude Code

Building window of a farm, lumber camp, mine or mill now shows where its
production comes from: base, honour, each kind of bonus tile next to it,
and each technology or spell (procBonusses can report its steps). The rows add
up to the real income. The mill explains its share of the farms and what
another mill or farm level would add.

The Build window passes a placement preview (tiles near the village that raise
the building's resource) to the engine's new Game.map.placementPreview.

Text fixes: Mill description, rock tiles named as rocks, 20% stated. The mill
upgrade preview counts the extra mill level; dead income_increase removed.
Income rules are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpWbfBTo645HCwsC28PTm7
@daedeloth daedeloth self-assigned this Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Preview: https://pr-96.preview.dolumar.com/preview-login.php

Deployed eba0caf. Log in as one of the seeded Tester players, or create a new player to test race selection. The preview and its database are removed when this pull request closes.

Also brings engine #32 (hide 'Load older messages' when there are none).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpWbfBTo645HCwsC28PTm7
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