bugfix(partition): Fix inconsistent mine collision behaviour#2208
Merged
xezon merged 3 commits intoTheSuperHackers:mainfrom Feb 27, 2026
Merged
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/Common/GameDefines.h | Added RETAIL_COMPATIBLE_CIRCLE_FILL_ALGORITHM preprocessor directive to control algorithm selection |
| Generals/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp | Implemented precise circle-cell overlap detection using standard AABB algorithm; conditionally enabled via preprocessor directive |
| GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp | Implemented precise circle-cell overlap detection (Zero Hour version) |
Last reviewed commit: 10ec115
|
I did not look at the code yet but the PRESENTATION and DILIGENCE is WORLD CLASS! Massive APPLAUSE 👏👏👏 |
xezon
approved these changes
Feb 26, 2026
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp
Outdated
Show resolved
Hide resolved
d9274de to
dc18156
Compare
CookieLandProjects
pushed a commit
to CookieLandProjects/CLP_AI
that referenced
this pull request
Feb 28, 2026
Okladnoj
pushed a commit
to Okladnoj/GeneralsGameCode
that referenced
this pull request
Mar 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #24 from the patch repository
This change fixes inconsistent mine collision detection by replacing the partition manager's circle fill algorithm with a more precise algorithm. The new logic is placed behind a new
RETAIL_COMPATIBLE_CIRCLE_FILL_ALGORITHMpreprocessor directive to help isolate the change as it is potentially slightly less performant.The retail circle fill logic - an implementation of the midpoint circle algorithm - does not accurately cover the cells occupied by spherical or cylindrical geometry. This leads to various collision inaccuracies throughout the game, one of which is the infamous mine behaviour described in #24. Various collision logic is only processed within partition cells that are considered occupied - the partition cells act as a 'broad phase' to determine which geometry then needs to be checked for overlaps.
It's particularly important to note that objects with a geometry radius >= 20 and < 40 (the most common range) only cover a single partition cell, for example Tunnel Networks (radius: 25) and Stinger Sites (radius: 30). This can be seen in the video below. A blue/green square indicates an occupied cell.
SINGLE_CELL.mp4
Mines happen to fit right within this range with a radius of 30, and therefore only end up covering a single cell. This is a problem as most units happen to be smaller than a single partition cell, and can end up bypassing adjacent occupied cells altogether. Below is an example of this happening.
DODGER.mp4
Below is a demonstration of the difference in cell coverage in retail (left, blue) vs this change (right, yellow) at different radii. It should be apparent that retail cell coverage becomes more inaccurate as geometry radii increases towards each multiple of the partition cell size (40, 80, 120, etc.), whereas the new algorithm is always perfectly accurate. Note that radii < 20 uses a separate dedicated 'small geometry' algorithm which is 100% accurate.
GRID_COMP.mp4
And below is a direct comparison between retail mine cell coverage and the new mine cell coverage.
Before
Mine cell coverage using the retail algorithm
After
Mine cell coverage using the new algorithm
And some real gameplay demonstrations for good measure.
Before
The Technical skips over several mines, allowing the terrorists to destroy the War Factory
BAD_MINES.mp4
After
The Technical and terrorists explode on the mines as expected
GOOD_MINES.mp4