-
Notifications
You must be signed in to change notification settings - Fork 52
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
Option to start the game paused #2076
Comments
I tried to initialize the game while paused and was surprised it did not do anything. Apparently, other game state initialization functions use the scenario description. I wonder if the first game state is used outside of tests. |
@byorgey to test this, I set the scenario code to always start paused: diff --git a/src/swarm-engine/Swarm/Game/State/Initialize.hs b/src/swarm-engine/Swarm/Game/State/Initialize.hs
index 5e716353..86715151 100644
--- a/src/swarm-engine/Swarm/Game/State/Initialize.hs
+++ b/src/swarm-engine/Swarm/Game/State/Initialize.hs
@@ -88,6 +88,7 @@ pureScenarioToGameState scenario theSeed now toRun gsc =
gs = initGameState gsc
preliminaryGameState =
gs
+ & temporal . runStatus .~ ManualPause
& robotInfo %~ setRobotInfo baseID robotList'
& creativeMode .~ scenario ^. scenarioOperation . scenarioCreative
& winCondition .~ theWinCondition This gets to a really strange state where the side panels are empty, and the goal is not yet shown, but REPL works: After one step with |
Not quite the same as pausing, but sometimes for debugging I have started the game at a very slow speed, e.g.:
|
Thanks for the tip @kostmo ! I will try that out, though I would expect speed 0 to mean 0 ticks per second. |
Speed n means 2^n ticks per second. We should improve the help text to make that clearer. Right now it says "Initial game speed multiplier" which seems ambiguous at best. |
@xsebek, This is because the Inventory and Info panels update on Frame events, which causes this strange behavior. I had to deal with this when I was integrating Swarm with Termite, because I forgot to spawn a thread which sends Frame events. |
Thanks for the info, @noahyor; I will file a separate Issue to update the panels at the start. 👍 |
Is your feature request related to a problem? Please describe.
Sometimes (#2064), I need to debug the first tick of the game.
That is hard because the game starts in a running state.
Describe the solution you'd like
Add command line option
--paused
to initialize the game state with therunState == ManualPaused
.Describe alternatives you've considered
I would not mind writing
--debug=startPaused
from #1324.Starting with the game paused could be useful for competitive play, but probably not a good default.
The text was updated successfully, but these errors were encountered: