feature(headless): Add ParticleSystemManagerDummy for headless mode#2247
Open
bobtista wants to merge 11 commits intoTheSuperHackers:mainfrom
Open
feature(headless): Add ParticleSystemManagerDummy for headless mode#2247bobtista wants to merge 11 commits intoTheSuperHackers:mainfrom
bobtista wants to merge 11 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Include/GameClient/ParticleSys.h | Adds ParticleSystemManagerDummy that correctly overrides all pure-virtual and serialization methods as no-ops; base-class init/reset/update remain active so particle logic still runs (only rendering is suppressed), which is the right design for headless mode. |
| Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h | Adds ParticleSys.h include and updates createParticleSystemManager to accept a Bool dummy flag, returning the appropriate implementation via a ternary; the long one-liner ternary would benefit from an if/else split for debugger breakpoint support per project style. |
| GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h | Mirrors the Generals version — same ParticleSys.h include and same createParticleSystemManager(Bool dummy) ternary; same style note about if/else applies here too. |
| Generals/Code/GameEngine/Include/Common/GameEngine.h | Pure-virtual signature updated from createParticleSystemManager() to createParticleSystemManager(Bool dummy); straightforward interface change with no issues. |
| GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h | Identical update to the Zero Hour counterpart of GameEngine.h — no issues. |
| Generals/Code/GameEngine/Source/Common/GameEngine.cpp | Passes TheGlobalData->m_headless to createParticleSystemManager; correct call-site update, no issues. |
| GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp | Identical call-site update as the Generals version; correct and consistent. |
Sequence Diagram
sequenceDiagram
participant GE as GameEngine::init()
participant GD as TheGlobalData
participant WGE as Win32GameEngine
participant PSM as ParticleSystemManager (real)
participant PSMD as ParticleSystemManagerDummy
GE->>GD: read m_headless
GE->>WGE: createParticleSystemManager(m_headless)
alt dummy == false (normal mode)
WGE->>PSM: NEW W3DParticleSystemManager
PSM-->>GE: full manager instance
Note over PSM: doParticles(), queueParticleRender(),<br/>crc/xfer/loadPostProcess all active
else dummy == true (headless mode)
WGE->>PSMD: NEW ParticleSystemManagerDummy
PSMD-->>GE: dummy manager instance
Note over PSMD: doParticles() → no-op<br/>queueParticleRender() → no-op<br/>crc/xfer/loadPostProcess → no-op<br/>init/reset/update → base class (runs normally)
end
GE->>GE: initSubsystem(TheParticleSystemManager, ...)
Prompt To Fix All With AI
This is a comment left during a code review.
Path: Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
Line: 97
Comment:
**Ternary on single line reduces debuggability**
Rule 16b9b669 asks for condition and body to be on separate lines so that precise debugger breakpoints can be set. Although a ternary operator is not technically an `if` statement, using it here produces the same problem: it is impossible to break on just one branch. The identical pattern appears in `GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h:97` as well.
Consider replacing the one-liner ternary with a proper `if`/`else`:
```cpp
inline ParticleSystemManager* Win32GameEngine::createParticleSystemManager(Bool dummy)
{
if (dummy)
return NEW ParticleSystemManagerDummy;
return NEW W3DParticleSystemManager;
}
```
This makes it straightforward to break on either branch and keeps the style consistent with the rest of the codebase.
**Rule Used:** Always place if/else/for/while statement bodies on... ([source](https://app.greptile.com/review/custom-context?memory=16b9b669-b823-49be-ba5b-2bd30ff3ba6d))
**Learnt From**
[TheSuperHackers/GeneralsGameCode#2067](https://github.com/TheSuperHackers/GeneralsGameCode/pull/2067#discussion_r2706274626)
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 1fb5d2a
xezon
reviewed
Mar 10, 2026
Use override keyword on dummy methods and move headless instantiation into createParticleSystemManager factory like other subsystem dummies.
00769c6 to
79c29e3
Compare
xezon
reviewed
Mar 11, 2026
Generals/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
Outdated
Show resolved
Hide resolved
…hange to Generals
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.
Summary
Related
Split from #2139 per @xezon's suggestion to review each dummy class separately.