Skip to content

Conversation

@Frost-bit-jpg
Copy link
Contributor

@Frost-bit-jpg Frost-bit-jpg commented Mar 27, 2025

Purpose of changes

This change is intended to be the way to increase the loyalty by doing your job with potential to include deed tracking on a different rep

Describe the solution

Every 10 planets your loyalty will increase, and since i do not know how to increase marines loyalty it should do that as well.

Describe alternatives you've considered

Perhaps making it chance based, or increase the number of planets.
still in testing phase for now

Testing done

Gameplay and bunch of turns

Related links

None

Custom player notes entry

Use the PR title.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 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

  • New Features
    • Introduced a battle counter that tracks cleared enemies and triggers milestone alerts with bonus rewards.
    • Added persistent tracking for enemy clear counts, ensuring progress is saved and loaded across game sessions.
  • Bug Fixes
    • Improved enemy AI logic for determining cleansing events, ensuring more accurate faction control updates.

Walkthrough

In this sacred update, a new resource, scr_battle_count, has been inscribed into the hallowed configuration of the project, augmenting its capabilities for tracking enemy clearance. The modifications within the alarm event now increment the enemies_cleared_count, invoking the newly established battle count function. This function, scr_battle_count, executes specific actions upon the achievement of enemy clearance milestones, selecting random alerts and logging significant events whilst recalibrating faction dispositions within prescribed limits. Furthermore, the cleansing logic within the enemy AI has undergone refinement, ensuring proper comparison mechanics and structured operations through the introduction of an additional variable to capture the original state of the planet's ownership. The global controller now bears the enemies_cleared_count variable, with enhancements to the load and save routines facilitating the preservation of this vital data via an INI file. Thus, the changes serve to expand resource management and enemy tracking functionalities, as decreed by the Machine Spirit’s sacred codex.

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch scr_battle_count
  • Post Copyable Unit Tests in Comment

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
🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests 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.

@github-actions github-actions bot added Type: Feature Adds something new Size: Small labels Mar 27, 2025
Copy link
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: 4

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 046386f and f9e4bc2.

📒 Files selected for processing (5)
  • ChapterMaster.yyp (2 hunks)
  • objects/obj_ncombat/Alarm_5.gml (1 hunks)
  • scripts/scr_battle_count/scr_battle_count.gml (1 hunks)
  • scripts/scr_battle_count/scr_battle_count.yy (1 hunks)
  • scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.gml`: Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. `#macro ARR_body_parts["arm"]` will crash the ga...

**/*.gml: Macro constants require a space between the constant name and value. Without it, the compiler will throw an error. I.e. #macro ARR_body_parts["arm"] will crash the game, because there is no space between the array and the name of the macro.

  • scripts/scr_battle_count/scr_battle_count.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml
`**/*.gml`: Color codes in the code shouldn't have any spaces in their id. I.e., color code `# 80 bf40` will crash the game.

**/*.gml: Color codes in the code shouldn't have any spaces in their id. I.e., color code # 80 bf40 will crash the game.

  • scripts/scr_battle_count/scr_battle_count.gml
  • objects/obj_ncombat/Alarm_5.gml
  • scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml
🔇 Additional comments (10)
scripts/scr_battle_count/scr_battle_count.yy (2)

10-11: Resource Type and Version Adherence
The sacred attributes "resourceType":"GMScript" and "resourceVersion":"2.0" are clearly set. These declarations honour the canonical format required by the engine and are blessed by the Omnissiah.


12-12: Object Closure Sanctity
The closing brace finalises the object as required by the rites of our JSON-like lore. All is in order to please the Machine Spirit.

ChapterMaster.yyp (1)

789-789: Addition of new script resource is logically sound and properly formatted.

Praise be to the Omnissiah! This binary alteration introduces the sacred script scr_battle_count to the project's holy registry. The machine spirit shall now correctly recognize and execute this new component when invoked. This addition serves the divine purpose outlined in the sacred PR - the implementation of imperial recognition and disposition rewards for the faithful who purge enemies of mankind every fourth planetary cleansing. The format adheres to the correct syntactical patterns observed throughout the configuration file. The Mechanicus approves this integration with the project's logical structure.

objects/obj_ncombat/Alarm_5.gml (1)

378-379: Praise be to the implementation of the imperial recognition mechanism!

This implementation properly tracks the count of vanquished enemies and initiates the rewards protocol. The Emperor's servants shall be pleased with the systematic elimination of xenos filth.

scripts/scr_battle_count/scr_battle_count.gml (4)

1-6: Function initialization and safety protocols acceptable.

The binary initiation logic properly validates the existence of the global variable before proceeding. This defensive programming ritual appeases the Machine Spirit.


8-12: Logical assessment of cleansing milestones.

The function correctly evaluates if the enemies_cleared_count is both positive and divisible by 4, ensuring the reward protocol activates at appropriate intervals. Excellent application of the sacred modulo operator.


13-55: Random selection algorithm pleases the Omnissiah.

The implementation of five different message variants introduces appropriate variance in imperial communications. The switch statement is a logical and efficient structure for this purpose.


59-67: Disposition adjustment values follow appropriate imperial protocol.

The loyalty increments to relevant imperial factions are properly weighted according to their position in the hierarchy of the Imperium. The error logging for missing controller is a prudent safeguard.

scripts/scr_enemy_ai_a/scr_enemy_ai_a.gml (2)

829-830: Proper implementation of imperial recognition mechanism.

These lines correctly increment the global enemy clearance counter and activate the reward function in accordance with the sacred rituals of the Administratum.


831-832: Event logging and notification protocols follow imperial standards.

The implementation properly records the cleansing of heretical entities in the event log and dispatches appropriate notifications. The disposition threshold check for planetary allegiance shift is logically sound.

@OH296 OH296 marked this pull request as draft March 27, 2025 03:28
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 27, 2025
@Frost-bit-jpg Frost-bit-jpg marked this pull request as ready for review March 27, 2025 04:55
@Frost-bit-jpg Frost-bit-jpg requested a review from OH296 March 27, 2025 04:55
Copy link
Collaborator

@Blogaugis Blogaugis left a comment

Choose a reason for hiding this comment

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

Would be funny to see disposition increase even when renegade, but we'll tackle that later.

@Frost-bit-jpg
Copy link
Contributor Author

May I instead propose to change this logic to:

Have a point tracker, that accumulates "deed" points on some actions, separate per faction. I.e.

deeds_tracker = {
  "mechanicus: 0",
  "imperium: 0",
  "etc"
}

When the player accumulated enough points, they get 1 disposition. Different actions award different amounts of deed points. Just call a function that both awards and checks if enough points accumulated. If needed, you can award a lot of deed points, so that the player immediately gets more than 1 disposition, if needed.

This way there is more control over the dispo gain speed, and it's just a more future-proof system imo.

TLDR: just me reinventing decimal numbers.

Yes but then this will create a problem. where all your deeds will only be imperium and there will be no inquisition deeds because they do not control anything directly and it doesn't make sense for you to preform deeds only for inquisition to somehow feel anything other than you doing your job.

@Frost-bit-jpg
Copy link
Contributor Author

Frost-bit-jpg commented Mar 30, 2025

However in my case i assume that these actions do not directly target any specific faction deed instead it will be general impression from you just making everything better. if we were to apply that logic to deeds it would make the function probably multi-layered.

Either that or make the function itself call another to calculate X amount of deeds for inquisition to take notice and then we will have to apply that logic to mechanicus and others because their control is very limited unlike the imperium.

@Frost-bit-jpg
Copy link
Contributor Author

For now the game code will only check if the threat in the planet is cleared not the fact it was extreme or otherwise. which is another problem if we gonna make the system complex.

@EttyKitty
Copy link
Collaborator

Yes but then this will create a problem. where all your deeds will only be imperium and there will be no inquisition deeds because they do not control anything directly and it doesn't make sense for you to preform deeds only for inquisition to somehow feel anything other than you doing your job.

Well, it's not really a problem. You just award the inq deed points on other actions.
Again, my proposal only implies having decimal disposition values and awards. That's all there is to it. No logic change implied, you just don't directly give dispo.

@Blogaugis
Copy link
Collaborator

By the way, perhaps battling hostile forces can also be made to award loyalty, in addition to disposition?

Copy link
Collaborator

@EttyKitty EttyKitty left a comment

Choose a reason for hiding this comment

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

Generally, I think the idea is okay, but requires refinement, as otherwise it's very cheesy atm.

I already feel like my req points reward for battles is pushing the cheesiness of battle rewards, same with the exp rewards.

Comment on lines +877 to +879
} else if (p_first[_run] == eFACTION.Mechanicus || p_type[_run] == "Forge") { // If originally Mechanicus or a Forge World
who_return = "the Adeptus Mechanicus";
obj_controller.disposition[eFACTION.Mechanicus] += 5; // FACTION disposition bonus
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't it possible to cheese all of these dispo/planet dispo rewards, by leaving a squad on the planet and waiting for a lvl 1 enemy to pop up?
I think there should be some kind of relation to the enemy power fought.

Also, population % from max should matter, perhaps.

Copy link
Collaborator

Choose a reason for hiding this comment

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

True, if you combine with SR rework, this would indeed become comedic as you take out a squad of orks, and imperials start to like you...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to game logic, those squad of orks if left unchecked will more than likely cause supply disruption and lots of problems in the local system otherwise they wouldn't be able at all to penetrate the defensive fleet yes? orks multiply very fast and if left unchecked will very quickly become a serious problem. Typically imperium response is so slow but to the plantery governor you are preserving otherwise very needed resources.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Based on experience - if there is some PDF left around, they generally should be capable to handle the ork invasion when it's strength is reduced. Say, SR 1 orks versus ~10'000 PDF troops. Bonus if they do get some fortifications, and your marine garrisons helping out.

But if PDF is 0, yeah, the player basically has no option but to wipe the invaders off the surface. The next turn, imperial control is restored and they rebuild the PDF.
And Imperial Guard fleets tend to be rare in terms of their rescue capabilities.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't it possible to cheese all of these dispo/planet dispo rewards, by leaving a squad on the planet and waiting for a lvl 1 enemy to pop up? I think there should be some kind of relation to the enemy power fought.

Also, population % from max should matter, perhaps.

I'm trying to think of a way to avoid this i guess cooldown after cleaning the planet will suffice. my old method of making whatever you save somehow your responsibility is kinda bad.

function scr_battle_count(){

// Check if the count is positive and a multiple of 6
if (obj_controller.enemies_cleared_count > 0 && (obj_controller.enemies_cleared_count % 6 == 0)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here. If it doesn't take into account what power was fought, the reward for clearing 6 worlds with 1000 people and 1lvl enemy will give the same reward as clearing 6 worlds with 1 billion of people and 6lvl enemies.
Maybe no one even asked you to help them, and the world has 1 billion defenders. Why do they care?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, there is a mechanic where governors ask for help, isn't there? I haven't seen the code for it, so not sure how it works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

efficiency, the sooner the enemy is gone the better for everyone, besides extensive cleaning takes time while low priority for Astrates they are often far more effective at doing that. Disposition doesn't just mean governor but also to extend the population willing to cooperate. Your presence doing cleaning job is more than enough to reinforce the image of "His Angels".

Copy link
Contributor Author

@Frost-bit-jpg Frost-bit-jpg Apr 12, 2025

Choose a reason for hiding this comment

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

Tho i generally agree that it's better to be done through deed system. But in that case it's hard to avoid abusing since enemies grow all the time so the cycle of letting enemy get to high threat then killing them might happen.

Idk if i want to apply turn tracking system or you get the deed only through completely cleaning the planet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I mean, if we limit the deed system to require 100 deed points to get 1 faction disposition point, then we can set certain deed point acquisitions per specific actions.

Like, 1 deed point per SR level of enemies destroyed, but you get 10 deed points for planet's control (amount can be tweaked further by planet type) being restored to imperium.

Copy link
Contributor Author

@Frost-bit-jpg Frost-bit-jpg Apr 12, 2025

Choose a reason for hiding this comment

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

100 per 1 dispo is bad ratio it means you can clean most of the game and barely get over 5, the biggest problem is tracking logic. How do you intent to make the game know that you cleared an actual enemy instead of artificial enemy by making them grow and abusing the system? that's why i was considering universal deed point based on different factions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

How do you intent to make the game know that you cleared an actual enemy instead of artificial enemy by making them grow and abusing the system?

Make liberating planets reward much more points than simply destroying enemies.
Personally, I want to leave an inefficient farming capability for player.
So let's raise it to 1000 deed point limit then. Make liberating planets reward ~100 points.
While SR fighting rewards 1 deed point per SR level.
Do you still think it is bad?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You could make deed point limits variable.
For example if your disposition is low (let's say 15), the limit could be lower - 160 deed points.
If disposition is high (let's say 50), the limit is higher - 510 points.

Which also addresses the farming issue to some extent.

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 6, 2025
Frost-bit-jpg and others added 2 commits April 12, 2025 18:45
Co-authored-by: EttyKitty <20323032+EttyKitty@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 12, 2025
@Blogaugis
Copy link
Collaborator

TL;DR from discord discussion - we now going to tie deed points or disposition earnings with "governor requests help" events.

@Frost-bit-jpg Frost-bit-jpg marked this pull request as draft May 16, 2025 21:24
This system will now increase loyalty until i figure out the deed system
@Frost-bit-jpg Frost-bit-jpg changed the title feat: Imperial recognition and disposition reward feat: Imperial Loyalty May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants