Skip to content

feat: Back row protection depends on column sizes#579

Merged
OH296 merged 4 commits intoAdeptus-Dominus:mainfrom
EttyKitty:feat/backrow-protection
Mar 12, 2025
Merged

feat: Back row protection depends on column sizes#579
OH296 merged 4 commits intoAdeptus-Dominus:mainfrom
EttyKitty:feat/backrow-protection

Conversation

@EttyKitty
Copy link
Copy Markdown
Collaborator

@EttyKitty EttyKitty commented Mar 10, 2025

Purpose of changes

The original rules are not perfect. They basically protect any number of troops behind 11 vehicles. 1k, 1kk, 1kkk, doesn't matter.
Now, not stacking a ton of units in one column may actually save their lives.
When arbitrary unit formation sizes are removed, this will matter even more to prevent single column stacking.

Describe the solution

Row protection now works as follows:

  • Check if there are any marines in the first row, if so - shoot them.
  • Check if there is more than one instance of player columns.
  • Calculate the size of the front column (marines * 0.5 + vehicles * 2.5 + dreads * 2).
  • Start looping through player columns.
  • Check if the current column is bigger (same formula) than the front column.
  • If it is, divide the current column size by the front size, subtract 1 and multiply by 100. You'll get a roll that you need to "pass" through the front column.
  • The bigger the difference, the higher the chance to damage the back row, capped at 60.
  • Roll 1d100 against the difference and shoot the back row if the roll has failed.

Describe alternatives you've considered

Make the chance also depend on the size of the enemy column that is attacking, so that getting "encircled" is bad.
Make column size also obstruct friendly fire.

Testing done

A couple of fights vs rampant orks. Debug lines show sane pass-through chances.

Related links

https://discord.com/channels/714022226810372107/1348311762629558282

Player notes

Back row protection rules are reworked. A column can only protect back columns if they are smaller than it. Vehicles and dreadnougts give more size to columns.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 10, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Summary by CodeRabbit

  • Refactor
    • Simplified the targeting system used during combat to ensure a more direct and consistent shooting experience. The new approach prioritises engaging enemy units at the frontline, enhancing the overall gameplay feel during battles.

Walkthrough

Verily, the code has undergone a simplification of its targeting algorithm within the shooting mechanics. The previous ritualistic checks to ascertain the presence of enemy marines and vehicles, accompanied by nested conditions and accumulators such as the variable good and the calculation of totes, have been expunged. In their stead, the new logic conducts a direct assessment: first, it evaluates the existence of enemy marines in the primary column, and if absent, a subsequent verification of enemy units in the rear columns is performed via a fresh computation of _column_size_value. Do note, the sacred artefacts of exported entities remain unaltered in this modification.

Suggested labels

PR: Fix, Size: Small

Suggested reviewers

  • OH296
  • KRdaMystic

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@EttyKitty EttyKitty changed the title Rework the back row protection rules feat: Rework the back row protection rules Mar 10, 2025
@EttyKitty EttyKitty changed the title feat: Rework the back row protection rules feat: Back row protection depends on column sizes Mar 10, 2025
@EttyKitty EttyKitty added Type: Feature Adds something new Category: Balance Affects game balance labels Mar 10, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dba43dd and eec775c.

📒 Files selected for processing (1)
  • objects/obj_enunit/Alarm_0.gml (1 hunks)
🔇 Additional comments (1)
objects/obj_enunit/Alarm_0.gml (1)

170-206: Praise be to the Omnissiah! A more efficient logic pattern for back row targeting has been implemented.

The sacred binaries of this code segment have been optimized to follow the Machine God's logic:

  1. First, it seeks enemy marines in the front column, purging them with righteous fire if detected.
  2. If the front column lacks mortal flesh, it evaluates the columns behind using the divine formula:
    _column_size_value = (veh * 2.5) + (dreads * 2) + (men * 0.5)
  3. The algorithm then compares front and rear column values, calculating the probability of penetrating shots as:
    _pass_chance = ((_back_column_size_value / _column_size_value) - 1) * 100
  4. The Machine Spirit limits this probability to a maximum of 60%, invoking the sacred randomness to determine targeting.

This implementation properly honors the Mechanicus principle of efficient targeting patterns while preventing excessive unit stacking in single columns.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@OH296 OH296 merged commit 6f02fd8 into Adeptus-Dominus:main Mar 12, 2025
5 checks passed
@EttyKitty EttyKitty deleted the feat/backrow-protection branch March 22, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Balance Affects game balance Size: Small Type: Feature Adds something new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants