Action scripts - AngerNodes manipulation
This pack of actions manipulates the hate of the houses towards other houses. This don't replace the game function "make_enemies()" but helps the AI to pick the one with highest value for being the most hated (the main enemy of the house used in the AI trigger tag called "OnlyTargetHouseEnemy").
The hate table values of all Houses increase quickly depending of how much time another house is attacking by another house & decreases very slow in moments of peace.
Curiosity note: this can be used for overriding the known MP bug of allied AI with the human player at the beginning of the games that they start as pacifists until they get attacked by others (because their only hated player is the 1º human player and that one is "ally" so they can't attack him). The same reason explains why initially in the MP battle all AI houses attacks the player.
No official documentation yet but I'll copy here all the details & possible values of each action:
Action 114 - Set House anger value modifier
Affects how much hate applies to a selected house (depends of the script action). This anger value is applied only inside the scriptType of the Team.
Format: 114,n
Possible values: Positive for increase hate and negative values for decreasing hate. Default to 0
Affects actions: 116, 117, 118, 119, 120 & 121
Action 115 - Override OnlyTargetHouseEnemy value
The value of the tag OnlyTargetHouseEnemy in AI Triggers can be modified for the new Attack & Move actions. Only affects the next new attack or move action script. These anger values are applied only in the House owner of the team.
Format: 115,n
Possible values:
-1 ; Use default value specified in OnlyTargetHouseEnemy tag
0 ; force the tag value to FALSE
1 ; force the tag value to TRUE
2 ; force the tag value to TRUE or FALSE randomly.
Action 116 - Modify House hate with index
Modifies a specific House hate using its index value as House array selector. Is applied to the House owner of the team.
Format: 116,n
Possible values:
n >= 0 (keep in mind that a Multiplayer map only has 8 players plus "Neutral & Special" houses) so doesn't have any sense to pick a higer value than the index of the last House. Pobably isn't recommended for all modders if you don't know what index have each player. These anger values are applied only in the House owner of the team.
Action 117 - Modify Hate values from a list of Houses
Picks a list of Houses from the rulesmd.ini section called [AIHousesList] and if any House appear in the scenario then the hate value against those Houses will be modified. These anger values are applied only in the House owner of the team.
Format of the new section:
[AIHousesList]
0=Here_Your_House_ID_1,Here_Your_House_ID_2, ...
1=...
Format: 117,n
Possible values:
>= 0 integer values that is the index of the list in [AIHousesList]
Action 118 - Modify randomly the Hate value of a house specified in a list of Houses
Like action 117 but only picks 1 house randomly from the specified list and then search that selected House in the scenario for midifying the hate value. These anger values are applied only in the House owner of the team.
Format of the new section:
[AIHousesList]
0=Here_Your_House_ID_1,Here_Your_House_ID_2, ...
1=...
Format: 118,n
Possible values:
>= 0 integer values that is the index of the list in [AIHousesList]
Action 119 - Set the most hated House ("<" comparison)
Basicly it increases the owner's anger against an Enemy House converting the selected House as the main enemy of the Team's owner. Depends on the specified argument.
Format: 119,n
Possible values:
-7 ; The House with less house kills is selected
-6 ; The House with less free power (free = production - consumption) is selected
-5 ; The House with less power production is selected
-4 ; The House with less power consumption is selected
-3 ; The nearest enemy Human base is selected
-2 ; The poorest House is selected
-1 ; The enemy House with nearest unit to the Team Leader is selected
>0 ; (using the parameters from the new attack/move script actions) The House with less threat of the checked type (sum of all the units of the same checked type * threat value)
Action 120 - Set the most hated House (">" comparison)
Basicly it increases the owner's anger against an Enemy House converting the selected House as the main enemy of the Team's owner. Depends on the specified argument.
Format: 120,n
Possible values:
-7 ; The House with more house kills is selected
-6 ; The House with more free power (free = production - consumption) is selected
-5 ; The House with more power production is selected
-4 ; The House with more power consumption is selected
-3 ; The farthest enemy Human base is selected
-2 ; The richest House is selected
-1 ; The enemy House with farthest unit to the Team Leader is selected
>0 ; (using the parameters from the new attack/move script actions) The House with more threat of the checked type (sum of all the units of the same checked type * threat value)
Action 121 - Set the most hated House randomly
Basicly it increases the owner's anger against an Enemy House picked randomly.
Format: 121,0
Action 122 - Reset anger against other Houses
Sets to 0 every House hate level. Is applied to the House owner of the team.
Format: 122,0
Action 123 -
The selected house will become the most hated House of the map (the effects are only visible if the other houses are enemy of the selected house)
Format: 123,n
Possible values:
-3 ; All Human players will be hated by everyone.
-2 ; The Team's owner will be the most hated by everyone.
-1 ; Selects a random House. The own House is excluded in the selection of the most hated by everyone.
>= 0 ; Index of the House that will be hated by everyone.
Nightly build for this pull request:
- compiled-dll-e573d75fa15e515656025d98a6c65114e207d7bd.zip This comment is automatic and is meant to allow guests to get latest nightly builds without registering. It is updated on every successful build.
For the testing of the PR I added some new debug lines that will appear in debug.log each time the action is executed successfuly or ObjectInfo is used.
Data will look like this:
Player 0 [Observer] Player 1 [GDICountry2]: 0:0, 2:1, 3:0, 4:0 -> Main Enemy House: 2 Player 2 [AlliesCountry]: 0:1, 1:1, 3:0, 4:0 -> Main Enemy House: 1 Player 3 [Neutral]: 0:0, 1:0, 2:0, 4:0 -> Main Enemy House: -1 Player 4 [Special]: 0:0, 1:0, 2:0, 3:0 -> Main Enemy House: -1
How interpret each House's line?: <HouseClass internal index in the game> [<HouseClass name>]: <enemy index #1:Anger value>, <enemy index #2:Anger value>, ... -> <Index of the House's enemy>
Added the missing documentation & Readme.
Tested out this feature as extensively as I could based off nightly build 02e7afa:
-
Script 114 to set hate seems to be working accordingly as written. I have tested it with both positive and negative values, and seen the hate modifiers seem to grow or weaken over time in-game. This was confirmed with targeting a specific house and then the chosen house be the only one present on the map, such as more hate towards Libya or less hate against Korea.
-
Script 115 I was unsure of how to fully test, consider it to be untested as of this report from my end.
-
Script 116 seems to be working if I understand how it works. This allows for targeting specific players with attacks based on their starting point.
-
Script 117 also seems to be working as described. I created two unique AIHousesList entries, and combined this script with the tests mentioned in Script 114.
-
Script 118 seems to work. I set two houses on the map that were in an AIHousesList entry, and set two additional houses to be control houses. The randomizer would apply 2500 hate to the randomly chosen house, and then the AIs would focus only on one of those two houses. This will apply the hate modifier to all houses of the chosen script, even if the house is no longer a player (noted with using CnCNet client's Observer player option setting my house to Russia and the script target only increasing "Russians" hate level as coded leading to Observers having hate but not main target)
-
Script 119 adapts to changes in player conditions that are tracked by the script pretty well. Can't say I see any large issues here, I did not test every single negative and positive possible condition however.
-
Script 120 adapts to changes in player conditions that are tracked by the script pretty well. Can't say I see any large issues here, I did not test every single negative and positive possible condition however. (copypasta from script 119 as they're similar in function)
-
Script 121 appears to work, the enemy seems to pick new enemy houses every time out of 10 games observed. 121 does not output debug information into debug.log, I used another new action's reporting on hate levels from this PR to double-check the changes in debug.log
-
Script 122 works as intended, the house hate modifiers are constantly reset throughout the game. This is another feature that does not output information to the debug.log file, so I tested by giving a house not present ingame a hate modifier to produce debug.log output to confirm tests were successful.
-
Script 123 did not appear to react to positive values or negative values as the condition, perhaps some more information about the use-case would help in testing to make sure that there's functionality or not. Currently, I'd say that Script 123 is not working.
With about 90% of this feature working (random rough number) as described, I'd say this feature looks good. I'd like someone else to help follow up with Script 115 and 123 to double confirm they work, but help being what it is!
As a small side note, I had a situation where I was a 'Russia' observer via CnCNet client and 'Script 118 - Modify Hate Randomly' script picked "Russians" as the hated house. Hate levels for the observer player were increased too as declared in debug.log, I do not know if this is an intended behavior or could have unintended consequences in performance for picking targets.
Nightly build for this pull request:
- compiled-dll-002874ae5dfd2da677a1aa3dcc744b408be92b61.zip These artifacts will expire in 90 days and will not be available for download after that time.
This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.
[!WARNING]
Rate Limit Exceeded
@FS-21 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 29 minutes and 40 seconds before requesting another review.
How to resolve this issue?
After the wait time has elapsed, a review can be triggered using the
@coderabbitai reviewcommand as a PR comment. Alternatively, push new commits to this PR.We recommend that you space out your commits to avoid hitting the rate limit.
How do rate limits work?
CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information.
Commits
Files that changed from the base of the PR and between eef9bc09a7ddb490667bb65cc777dbe91d592ba3 and 848881be57f9e96e788d62943b12ccdcf4096b0e.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
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>.Generate unit-tests for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit tests for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 generate interesting stats about this repository and render them as a table.@coderabbitai show all the console.log statements in this repository.@coderabbitai read src/utils.ts and generate unit tests.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
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 as PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger a review. This is useful when automatic reviews are disabled for the repository.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai helpto get help.
Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
CodeRabbit Configration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - The JSON schema for the configuration file is available here.
- 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/coderabbit-overrides.v2.json
CodeRabbit Discord Community
Join our Discord Community to get help, request features, and share feedback.