Skip to content

Allow disable an over-optimization in targeting#2078

Open
TaranDahl wants to merge 1 commit intoPhobos-developers:developfrom
TaranDahl:DisableStupidTargetScanningOptimization
Open

Allow disable an over-optimization in targeting#2078
TaranDahl wants to merge 1 commit intoPhobos-developers:developfrom
TaranDahl:DisableStupidTargetScanningOptimization

Conversation

@TaranDahl
Copy link
Contributor

Allow disable an over-optimization in targeting

  • In vanilla, there is an optimization in targeting: if a unit finds a valid target within the 1/4 or 1/2 range, it will stop looking for other targets. Now you can disable it.
    • This optimization has a negligible effect on average performance, as most targeting calls fail to find a valid target.
    • At the same time, it can affect the gaming experience, as it will make units attack nearby targets while ignoring more threatening targets that are farther away.

In rulesmd.ini:

[General]
DisableOveroptimizationInTargeting=false  ; boolean

@TaranDahl TaranDahl added Needs testing ⚙️T1 T1 maintainer review is sufficient ❓Unhardcoding / Customization Make something more tweakable Needs benchmarking This PR needs to be tested for performance. labels Feb 3, 2026
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

Nightly build for this pull request:

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.

@TaranDahl
Copy link
Contributor Author

TaranDahl commented Feb 3, 2026

If possible, it would be best to conduct a benchmark, that is, to see to what extent the performance would be affected if this optimization is disabled.
However, I think this is optional.

@TaranDahl TaranDahl removed the Needs benchmarking This PR needs to be tested for performance. label Feb 3, 2026
@Coronia
Copy link
Contributor

Coronia commented Feb 3, 2026

instead of disabling, what if we can modify the range of this? Now it's forced to 1/2 and 1/4, could make it a customizable ratio or even a fixed range, so it can be further adjusted if someone want better performance or better experience

@TaranDahl
Copy link
Contributor Author

instead of disabling, what if we can modify the range of this? Now it's forced to 1/2 and 1/4, could make it a customizable ratio or even a fixed range, so it can be further adjusted if someone want better performance or better experience

I doubt whether this "optimization" needs further improvement.
I believe that no performance optimization should come at the cost of significantly affecting the gaming experience. This optimization has made the units dumber.
In fact, I wanted to directly disable it without leaving a switch, treating it as a bug fix. However, I'm not sure if this would significantly reduce the game performance, so I didn't do it.

@TaranDahl
Copy link
Contributor Author

Confirm that this fix can correctly restore the enemy detection priority check.

@TaranDahl
Copy link
Contributor Author

TaranDahl commented Feb 5, 2026

Bounty: 10 CNY for the 1st reviewer who gives valid review
image

@TaranDahl TaranDahl force-pushed the DisableStupidTargetScanningOptimization branch from f772ea3 to 89164f3 Compare February 5, 2026 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bounty available ⚙️T1 T1 maintainer review is sufficient Tested ❓Unhardcoding / Customization Make something more tweakable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments