-
Notifications
You must be signed in to change notification settings - Fork 72
[ZH] Implement Headless Mode #651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…th logging enabled (if you define RELEASE_DEBUG_LOGGING in Debug.h)
…in GameLogic::startNewGame to improve CRC Logging
…e with -SaveDebugCRCPerFrame. Also remove Bool dumped (wasn't really used and was in the way for this new code)
…d and not intended because it spams the crclogging with mostly useless data.
…ewGame instead of GameLogic::prepareNewGame so it works when loading a game.
# Conflicts: # GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
Outdated
Show resolved
Hide resolved
# Conflicts: # cmake/config.cmake
…::winGetUserData always returns NULL
Alright, I just pushed another update. I tested headless mode with about 1400 various replays and they all work as expected now. I had to fix a few more issues:
I also added MouseDummy to eliminate some more NULL-checks. All issues should be solved now. Thanks again to @jaapdeheer for helping me fix some of them :) |
@@ -655,13 +658,17 @@ Bool W3DTerrainVisual::load( AsciiString filename ) | |||
it = NULL; | |||
} | |||
// add our terrain render object to the scene | |||
W3DDisplay::m_3DScene->Add_Render_Object( m_terrainRenderObject ); | |||
if (W3DDisplay::m_3DScene != NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the final PR with the replay simulation, I won't call GameClient::update at all, so don't worry :) I just wanted to make this PR testable and added some checks in the rendering to make it work. I can remove those checks in the next PR.
How will this look? Which null tests will be gone?
I just pushed an update where I commented the checks that will be gone in the Replay Simulation PR |
Do you need help replicating this to Generals? |
I got the diff with: But there are quite a few conflicts with Generals. (Doesn't surprise me) |
But I can give it a try and will call for help when I get stuck |
I can help you with it. |
I think the "Merge main" commits make this really hard to replicate to Generals with that method. I will do it by hand tomorrow. |
I can do it, I just want to wait until this is approved because I don't want to sync two PRs if more changes are requested. The merge commits are not the problem, it's that there are differences between Gen and ZH where this PR does changes. You can get the diff with the merge base with:
or use the git command I posted above. |
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp
Outdated
Show resolved
Hide resolved
Finally merged, thanks everyone! PR for the changes in Generals is here: #899 |
This PR adds a commandline option -headless which runs the game without any graphics.
This is necessary to implement a silent replay checker (see issue #565). Note that I have that replay checker already implemented, but I will push that in another PR. This is just preparation for that.
Note that right now, if you pass in -headless, the game just runs the Shellmap. Since it's headless, you won't be able to see or do anything. But if you run it in Debug, you can enjoy looking at the log file getting bigger.
Headless mode is implemented here by essentially only running GameLogic, and not the GameClient. Unfortunately, GameLogic depends on the GameClient in some small hacky ways, which makes this a non-trivial task. See also this comment I added:
As it is now, this PR sets all the client components as listed above to NULL and adds all the appropriate NULL-checks (which are sadly quite a few).
For TheRadar I added a dummy implementation to avoid the NULL-checks in the many callers (this doesn't make much sense in the other components though).
If we decide to fix these separation issues properly in the future, we will be able to revert many of the changes in this PR in the future.
Alternatively, we can also decide to just hide the window in headless mode and initialize DX without using it. Then almost all the changes in this PR become obsolete as well. The question is then whether this will still run in CI.
I would prefer to keep the changes in this PR and to clean up these separation issues properly long-term. Having logic and client properly separated can help in the future when we decide to increase the framerate of the client, or if we want to implement a headless server. It's also nice to automatically test that the logic works without the client.
TODO