Skip to content

feat(orks): Refine ork ship/fleet logic - #1636

Draft
EttyKitty wants to merge 7 commits into
Adeptus-Dominus:mainfrom
EttyKitty:feat/orks
Draft

EttyKitty wants to merge 7 commits into
Adeptus-Dominus:mainfrom
EttyKitty:feat/orks

Conversation

@EttyKitty

@EttyKitty EttyKitty commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by cubic

Reworks ork growth and ship building so fleets only spawn from safe, unblockaded planets with enough orks, and now cost ork forces to create or expand. Fixes ork fleet arrival not adding forces to the target planet. Reworks luck rolls to roll twice and keep the better result for player-beneficial outcomes, and the worse for player-detrimental ones.

  • Ship building now requires no enemies or blockades, at least 4 orks on a buildable planet, and consumes orks per fleet and per ship.
  • Adds a fleet cap limiting ork fleets to occupied ork stars plus five; spawning a fleet no longer bypasses the cap check.
  • Landing on a planet now adds orks up to the planet's capacity, leaving the fleet with any remaining forces.

Bug Fixes

  • Fixes ork fleet arrival computing an ork value that was never assigned, so colonized planets gained no orks.
  • Fixes warboss departure and stronghold growth using the wrong luck roll direction.
  • Fixes the neworkfleet cheatcode spawning an empty fleet; it now spawns with ships.
  • Fixes luck rolls for Shitty Luck and Great Luck so the discarded roll is the same as before.

Written for commit a81e715. Summary will update on new commits.

View guided diff

@EttyKitty

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot added Size: Medium Type: Feature Adds something new labels Oct 13, 2026

@lyra-cactus lyra-cactus 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.

Refactor direction is good: hoisted blockade/enemy checks, per-ship and per-fleet ork costs, global fleet cap, var _growth instead of leaking growth, and var i fix in orks_end_turn_growth are all improvements. Requesting changes for one blocker: the fleet-arrival ork deposit is now a discarded expression, so non-warboss arrivals add zero orks (regression vs old p_orks += ...). Also needs a guard so ship-expansion does not run with (noone), and the warboss-boarding check should not reuse a stale fleet handle that may have just been ordered to leave. Otherwise readable and close.

Comment thread scripts/scr_ork_fleet_functions/scr_ork_fleet_functions.gml Outdated
Comment thread scripts/scr_PlanetData/scr_PlanetData.gml Outdated
Comment thread scripts/scr_PlanetData/scr_PlanetData.gml Outdated
@EttyKitty

Copy link
Copy Markdown
Collaborator Author

/review

lyra-cactus[bot]
lyra-cactus Bot previously approved these changes Oct 13, 2026

@lyra-cactus lyra-cactus 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.

LGTM - both incremental fixes resolve the prior blockers: fleet-arrival ork deposit is now assigned (p_orks += max(2, ...)) and ship-expansion is guarded by _ork_fleet != noone, so no more with (noone) or discarded-expression regression. Verified in full file context; remaining warboss-boards-departing-fleet nuance is benign (instance still valid, no crash) and can be a follow-up if desired.

@EttyKitty

Copy link
Copy Markdown
Collaborator Author

/oc Can you check the diff and write a game balance affect report with how things changed in this PR, in terms of various probabilities and game logic (before VS now). Only changes observable by the players.

@lyra-cactus

lyra-cactus Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Ork balance report for #1636 (feat/orks)

Only player-visible changes. Refs are to main paths:

1. New ork fleet creation: harder, costs ground orks, hard-capped

Before: per eligible planet (orks >= 4, buildable type, no PDF/Guard/Traitor/Tau in system), roll 1d150, build if <= 20 after bonuses. No cost, no cap.

Now: same orks >= 4 gate plus explicit !blockaded gate, roll 1d100, build if <= 10 after bonuses, then add_forces(ORK, -2), and blocked entirely by new ork_fleet_cap_reached() (fleets >= ork_owned_stars + 5).

Effects:

  • Base rate (bare rock, no warboss/stronghold, known == 0): 20/150 = 13.3% -> 10/100 = 10% per planet/turn.
  • All creation bonuses nerfed:
    • Warboss: -20 -> -10.
    • Stronghold: -tier*5 -> -tier*3.
    • known[ORK] > 0: -10 -> -5.
    • Forge: -80 -> -50 (bare Forge: 66.7% -> 60%).
    • Hive: -30 -> -20 (bare Hive: 33.3% -> 30%).
    • Temperate: -30 -> -5 (bare Temperate: 33.3% -> 15%, large nerf).
    • Agri: -10 -> -5 (bare Agri: 20% -> 15%).
    • Shrine: 0 -> -5 (13.3% -> 15%, only buff).
  • Example maxed Forge + warboss + tier 2 + known: old threshold 140/150 = 93.3%, new 81/100 = 81%.
  • Cost is the bigger nerf: a 4-ork planet drops to 2 after building one fleet and must regrow (regrowth is only 13%, 26% with warboss, capped at < 5 orks). Sustained Forge/Hive shipyards self-throttle. Before they built for free.
  • New galaxy cap: 0 ork-owned stars = max 5 ork fleets; 10 owned stars = max 15. Before: unlimited. Creation roll is wasted when capped. Expansion of an existing orbiting fleet bypasses the cap.

2. Adding ships to an existing orbiting fleet: same base, much stronger on Forge/Hive/warboss worlds, now costs 1 ork

Before: independent irandom(101) (0..101), add ship if <= 15 after known -10 + planet -20/-10/-5. No warboss/stronghold bonus, no cost.

Now: reuses the same 1d100 build roll, add ship if <= 15 after full bonus stack (warboss/stronghold/known/planet), then add_forces(ORK, -1).

  • Bare unknown rock: 16/102 = 15.7% -> 15/100 = 15% (unchanged).
  • Bare known rock: 25.5% -> 20% (nerf).
  • Forge unknown: 35.3% -> 65%; Forge known: 45.1% -> 70% (large buff).
  • Hive unknown: 25.5% -> 35%; Hive known: 35.3% -> 40% (buff).
  • Agri: 15.7% -> 20% (buff, Agri had no expansion bonus before).
  • Warboss (+10) and stronghold (+tier*3) now apply to expansion; before they only raised capital-ship odds. E.g. Forge + warboss + tier 2 + known: ~45% -> 86%.
  • Ship-type mix unchanged: 70% escort / 30% frigate, then ~9.1% upgrade to capital on Forge/tier>=2/warboss (irandom(10)==0), ~3.2% if stronghold/Hive (irandom(30)==0), forced capital if capital_number <= 0.

Net: fewer new fleets, but existing shipyards on developed worlds snowball faster until they eat their own garrison below 4.

3. Fleet arrival delivers fewer orks (except tiny fleets)

ork_fleet_arrive_target():

  • Before: p_orks += max(2, floor(image_index * 0.8)) where image_index = round(strength).
  • Now: p_orks += max(2, floor(standard_fleet_strength_calc() * 0.5)), still capped at 6 and only if target p_orks < 4.

strength = capitals + frigates/2 + escorts/4. Fresh 1/1/0 fleet is 1.5 strength: both give 2. Larger fleets give ~37% less: strength 5: 4 -> 2; strength 8: 6 -> 4; strength 10: 8 (capped to 6) -> 5. Intermediate branch commit briefly made arrival add 0; final head fixes it to the *0.5 formula.

4. Warboss embarkation slowed and gated

  • Formula unchanged: 1d100+10 < turns_static, so ~9% after 20 static turns, ~39% after 50, 100% after 110.
  • Before: needed only an orbiting ork fleet. exit-on-blockade incidentally blocked it when blockaded, but enemies in system did not block it.
  • Now: explicitly requires _ork_fleet != noone && _has_warboss && !_enemies_present && !_blockaded. Warbosses stuck in contested or player-blockaded systems (player fleet within 50px with action == "") no longer board and leave. Alert odds unchanged (100% if visible, 1/6 if player_hidden).

5. Luck-trait inversion fixed (Great/Shitty Luck only)

roll_dice_chapter(..., "high") means high = good for player. Ship-building and warboss->stronghold (< 30 to spawn) incorrectly used "low".

  • Normal chapters: no change. Stronghold spawn stays 29% (1..29 on 1d100) per warboss planet/turn.
  • Great Luck chapters: previously got more ork ships/strongholds; now get ~half (T<=50 case: P = 0.5*T/100). E.g. base new-fleet 10% -> 5%; stronghold 29% -> 14.5%.
  • Shitty Luck chapters: previously got fewer; now get ~1.5x (P = 1.5*T/100). E.g. base new-fleet 10% -> 15%; stronghold 29% -> 43.5%.

6. Unchanged (despite diff noise)

Ground regrowth 13% (26% with warboss), sabotage block, inter-planet spread (60% attempt gate), population decline, stronghold tier +0.01 (+0.02 with warboss), Dead/Lava buildable-only-with-warboss/stronghold rule, and capital-ship odds are refactors with no player-visible probability change.

@EttyKitty
EttyKitty marked this pull request as draft October 14, 2026 02:15
Comment on lines +524 to 529
if (instance_exists(obj_p_fleet)) {
var ppp = instance_nearest(x, y, obj_p_fleet);
if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) {
_blockaded = true;
}
}

@OH296 OH296 Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (instance_exists(obj_p_fleet)) {
var ppp = instance_nearest(x, y, obj_p_fleet);
if ((point_distance(x, y, ppp.x, ppp.y) < 50) && (ppp.action == "")) {
_blockaded = true;
}
}
_blockaded = system.has_orbiting_player_fleet();

function that was going to ship in my mission rework but i see it can be used here so i've just merged it into main on it's own little pr

@OH296

OH296 commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

i'm fine with pretty uch all this but i would suggest the below be reverted to the previous values, strength 2 orks will almost always get removed by pdf on major worlds and as strength 2 orks never grow this means functionally i think this may end up overcorrecting to making orks very un threatening.

3. Fleet arrival delivers fewer orks (except tiny fleets)
ork_fleet_arrive_target():

Before: p_orks += max(2, floor(image_index * 0.8)) where image_index = round(strength).
Now: p_orks += max(2, floor(standard_fleet_strength_calc() * 0.5)), still capped at 6 and only if target p_orks < 4.
strength = capitals + frigates/2 + escorts/4. Fresh 1/1/0 fleet is 1.5 strength: both give 2. Larger fleets give ~37% less: strength 5: 4 -> 2; strength 8: 6 -> 4; strength 10: 8 (capped to 6) -> 5. Intermediate branch commit briefly made arrival add 0; final head fixes it to the *0.5 formula.

@EttyKitty

EttyKitty commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator Author

i'm fine with pretty uch all this but i would suggest the below be reverted to the previous values, strength 2 orks will almost always get removed by pdf on major worlds and as strength 2 orks never grow this means functionally i think this may end up overcorrecting to making orks very un threatening.

The problem iirc was (in my head), that max(2,floor(image*0.8)) together with launched fleet size always >=5 meant that all launched fleets are instant 4+ power on land. And 4+ means instant new fleet building on that planet, without any growth period. Result: each system makes colony ship every few turns forever, each new colony becomes another factory instantly. Perpetual motion.

Together with the rest of the changes tho, it may no longer be such a problem. I may in fact revert it, because this change was done before everything else.

I've marked it as draft, because I basically went to rewrite a lot of the said method anyway.


if (_alert_triggered) {
if (!_fleet_persists) {
if (!instance_exists(_ork_fleet)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the instance does not get destroyed till the end of the event nor does it get deactivated. This will always treat the ork fleet as existing unless you explicitly deactivate it or use the flag, imo why not just keep the separate flag

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

doesn't it get destroyed at line 182?

@EttyKitty

Copy link
Copy Markdown
Collaborator Author

/review

@lyra-cactus lyra-cactus 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.

Incremental look at the three new commits (ork rework iterations + luck re-roll change).

Both previously blockers are resolved: the fleet-arrival ork deposit is now assigned through edit_forces, ship expansion is guarded by _ork_fleet != noone, and the arrival alert checks instance_exists(_ork_fleet).

The level/men model (level n = 2^(n-1) men, bit_length as inverse) is used consistently in arrival, spread and spores; boarding/embark ordering keeps is_garrison_force initialized (ai_b runs before ai_c).

Luck changes are consistent: always roll twice and keep min/max, with player_benefit_at direction correctly applied for "high" and "low" callers everywhere incl. roll_dice_unit.

No functional blockers found, but the spore seeding and per-level production thresholds are significant balance decisions (spores ignore ownership/enemies/blockade, ships effectively require 5+ orks without discounts), so leaving this to the maintainers.

}

function fleet_power_value(_fleet) {
if (_fleet == noone || !instance_exists(_fleet)) {

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.

Per the repo's minimal-defensive-code rule: both callers (ork_fleet_arrive_target, ork_planet_turn via scr_orbiting_fleet) pass either noone or a live instance handle, so !instance_exists(_fleet) is not reachable. The noone check alone covers the only real case, and the arrival call site guarantees a valid fleet either way. Suggest dropping the instance_exists guard or the whole guard if callers are expected to validate.

return 0;
}
var _result = 1;
for (var i = 1; i < _index; i++) {

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.

Minor: the doc already states this equals 2^(_index - 1), so the loop can be return power(2, _index - 1);. Saves the O(n) loop and a local. bit_length likewise mirrors log2 for powers of two, though the careful loop version there is fine.

var _spores_roll = roll_dice_chapter(1, 100, "low");
var _spores_theshold = 100 - (10 * planet_forces[eFACTION.ORK]);

if (_spores_roll >= _spores_theshold) {

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.

Design question: free spores now run with no checks at all on source owner, planet enemies, or system blockade (the old code required the source planet to be ork-owned and enemy-free). An infestation on a garrisoned imperial planet can now silently seed 1 ork per turn onto every zero-ork planet in the system, including player-held worlds, bypassing _system_blockaded. If that is the intended lore/balance (spores everywhere), fine, but please confirm it is deliberate and not just a missing !_planet_has_enemies condition like the other blocks. Nit: _spores_theshold -> _spores_threshold.


if (!_planet_has_enemies && _can_build && planet_forces[eFACTION.ORK] >= 4) {
var _production_roll = roll_dice_chapter(1, 100, "low");
var _production_threshold = 80 + ((6 - planet_forces[eFACTION.ORK]) * 10);

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.

Confirm the intent: with no discounts, a 4-ork planet gets a threshold of 100, so vanilla 4-ork planets can essentially never build a fleet (roll >= 100); only Hive/Forge/stronghold/warboss discounts make it reachable. If the requirement is really "at least 4 orks", the base may want to be lower (e.g. 60 + (6 - orks) * 10); as-is the summary's claim of 4 orks is only technically true.

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

Labels

Size: Big Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants