Skip to content

Warship veterancy#4433

Open
bijx wants to merge 12 commits into
mainfrom
warship-veterancy
Open

Warship veterancy#4433
bijx wants to merge 12 commits into
mainfrom
warship-veterancy

Conversation

@bijx

@bijx bijx commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Description:

Warship veterancy! This is an idea inspired by the unit veterancy feature of games like C&C: Red Alert 2 in which unit eliminations increases the level of individual units. I've been trying to build this mechanic for months with different ideas, and I finally landed on this being one of the more balanced implementation.

Warships can earn up to three levels, represented by the gold bar insignia in the bottom right of their warship sprite.

image

A veterancy bar grants 20% health from the base amount, and a 20% increase in shell damage applied after the random damage roll. For example, a level 3 warship will apply a 60% damage boost on top of the random shell damage value (something between 200-325. If the random value is 250, the final damage output will be 250 * 1.60 = 400.

There are three ways to achieve a veteran level:

  1. Eliminate another warship: any time a warship neutralizes another warship, it immediately get's a veterancy increase.
Recording.2026-06-27.224836.mp4
  1. Eliminate transport boats: Destroying 10 transport boats will level a warship to the next veterancy bar.
Screen.Recording.2026-06-27.224956.mp4
  1. Steal trade ships: If the warship captures 25 trade ships, it will earn a veterancy bar.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

bijx

bijx added 6 commits June 27, 2026 22:27
…alculations. Updated UnitState and UnitView to support veterancy data, ensuring proper rendering and health bonus calculations for veteran warships.
…cy levels, health bonuses, and requirements for warships in Config, Game, and GameUpdates. Updated interfaces to support veterancy tracking and calculations.
…rancy levels, health bonuses, and kill records for warships. Updated ShellExecution and WarshipExecution to incorporate veterancy mechanics, enhancing gameplay dynamics. Adjusted UnitImpl to manage veterancy state and calculations effectively.
… to 0 in makeUnitUpdate for improved warship management.
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aac62c49-443d-4111-8b9a-9b829911dd8c

📥 Commits

Reviewing files that changed from the base of the PR and between 2280d57 and 02854dc.

📒 Files selected for processing (2)
  • src/core/game/UnitImpl.ts
  • tests/WarshipVeterancy.test.ts

Walkthrough

Adds warship veterancy state, combat scaling, client propagation, and bar rendering. Warships gain veterancy from kills and captures, use it for health and shell damage bonuses, and show the level as gold pips in the bar renderer.

Changes

Warship Veterancy System

Layer / File(s) Summary
Core contracts and config
src/core/configuration/Config.ts, src/core/game/Game.ts, src/core/game/GameUpdates.ts, src/client/render/types/Renderer.ts, src/client/render/gl/RenderSettings.ts, src/client/render/gl/render-settings.json
Unit, UnitUpdate, and UnitState gain veterancy fields and methods; Config adds warship veterancy tuning constants; render settings add veterancy pip geometry, offsets, and color fields.
UnitImpl veterancy state and progression
src/core/game/UnitImpl.ts
Adds warship veterancy fields, dynamic max health, health clamping against the dynamic max, serialization of veterancy, and progression from kills and captures.
Combat and capture hooks
src/core/execution/ShellExecution.ts, src/core/execution/WarshipExecution.ts
Shell impact handling records veterancy kills and scales damage by veterancy; warship execution uses the dynamic healed-state check and records trade captures on both capture paths.
Client propagation and bar rendering
src/client/view/UnitView.ts, src/client/render/gl/passes/BarPass.ts
UnitView copies veterancy from updates and uses it in max-health calculation; BarPass adds veterancy instance data, shader uniforms, pip generation, and a third instanced draw path.
Tests and fixtures
tests/WarshipVeterancy.test.ts, tests/client/render/frame/..., tests/util/viewStubs.ts
Adds veterancy coverage for kills, captures, health scaling, shell damage scaling, and shell kills, plus fixture updates for the required veterancy field.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

Feature, Backend, UI/UX

Suggested reviewers

  • evanpelle
  • Celant

Poem

⚓ A warship gains a golden spark,
From battles won and trade ship marks.
Its shells strike harder, pips shine bright,
A veteran banner in the night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and directly matches the main change: adding warship veterancy.
Description check ✅ Passed The description clearly explains the warship veterancy feature and matches the implemented changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/core/configuration/Config.ts`:
- Around line 945-952: The veterancy bonus getters in Config are returning
fractional values, which pushes floating-point math into core simulation logic.
Update warshipVeterancyHealthBonus and warshipVeterancyShellDamageBonus to store
integer-based values (for example percent or basis points), then adjust the
consumers such as UnitImpl.maxHealth and the shell damage calculation to keep
the src/core math integer-only. If any UI or rendering code needs a fraction,
convert there instead of in core.

In `@src/core/execution/ShellExecution.ts`:
- Around line 86-90: The veterancy damage calculation in ShellExecution is using
floating-point math via warshipVeterancyShellDamageBonus(), which violates the
deterministic integer-only rule in src/core and can affect whether recordKill()
triggers. Update the ShellExecution damage scaling to use an integer-based bonus
from config (for example percent or basis points) and apply integer
rounding/truncation in the damage computation, keeping the logic inside the
veterancy block deterministic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1902976c-d060-420c-a713-4c321e3a6c8e

📥 Commits

Reviewing files that changed from the base of the PR and between c622e85 and ec9f546.

⛔ Files ignored due to path filters (2)
  • src/client/render/gl/shaders/bar/bar.frag.glsl is excluded by !**/*.glsl
  • src/client/render/gl/shaders/bar/bar.vert.glsl is excluded by !**/*.glsl
📒 Files selected for processing (16)
  • src/client/render/gl/RenderSettings.ts
  • src/client/render/gl/passes/BarPass.ts
  • src/client/render/gl/render-settings.json
  • src/client/render/types/Renderer.ts
  • src/client/view/UnitView.ts
  • src/core/configuration/Config.ts
  • src/core/execution/ShellExecution.ts
  • src/core/execution/WarshipExecution.ts
  • src/core/game/Game.ts
  • src/core/game/GameUpdates.ts
  • src/core/game/UnitImpl.ts
  • tests/WarshipVeterancy.test.ts
  • tests/client/render/frame/TrailManager.test.ts
  • tests/client/render/frame/derive/nuke-telegraphs.test.ts
  • tests/client/render/frame/derive/player-status.test.ts
  • tests/util/viewStubs.ts

Comment thread src/core/configuration/Config.ts Outdated
Comment thread src/core/execution/ShellExecution.ts Outdated
@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Jun 28, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 28, 2026
@Katokoda

Copy link
Copy Markdown
Contributor

How does this influence a simple 1v1 novice-waeship encounter?
Usually in current mode, without any ports near it, both warships either dye or survive. Is that preserved by your implementation or does the upgrade give a chance to the first-killee to survive the last incoming shells?

@Katokoda

Copy link
Copy Markdown
Contributor

Also, for the numbers : 1 kill, 10 transports, 25 pirated tradeships, are they considered individually or mixed?
(i.e. Does shooting 5 transports and pirating 13 tradeships trigger a level-up?)

If individually, does the experience obtained during the previous level stay within the current one?
(i.e. a warship having shot down 9 transports and pirated 24 tradeships is still level 1. Then, for a new tradeship it goes level 2. If it then shoots down a single transport, does it go level three?)

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 28, 2026
@bijx

bijx commented Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

How does this influence a simple 1v1 novice-waeship encounter? Usually in current mode, without any ports near it, both warships either dye or survive. Is that preserved by your implementation or does the upgrade give a chance to the first-killee to survive the last incoming shells?

Great questions! So even number match ups should still result in the same-ish outcome. Since current behaviour is that warships will have random shell damage of 200-325, it's still possible for one side to come out on top by pure RNG against an even number of enemies.

1v1 encounter
Screen.Recording.2026-06-28.033540.mp4
2v2 encounter
Screen.Recording.2026-06-28.034031.mp4

Also, for the numbers : 1 kill, 10 transports, 25 pirated tradeships, are they considered individually or mixed? (i.e. Does shooting 5 transports and pirating 13 tradeships trigger a level-up?)

If individually, does the experience obtained during the previous level stay within the current one? (i.e. a warship having shot down 9 transports and pirated 24 tradeships is still level 1. Then, for a new tradeship it goes level 2. If it then shoots down a single transport, does it go level three?)

Yes, currently your warship tracks each stat individually. The only correction is that warships don't start at level 1, they technically start at level 0, but otherwise you are correct. We can, of course, change this behaviour to make it that achieving a level instantly resets the progress for the rest of the conditions, that can be a good change to balance this feature more!

@bijx bijx added this to the v33 milestone Jun 28, 2026
…trade captures into a shared progress meter. Update related tests to reflect new behavior and ensure proper functionality of veterancy level progression.
@bijx

bijx commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

Changed advancement logic such that eliminating a warship resets progress from other sources, and that killing transports and capturing trade ships together contribute to the next level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development

Development

Successfully merging this pull request may close these issues.

2 participants