Skip to content
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

Custom entities persist when quitting scenario #689

Closed
byorgey opened this issue Sep 16, 2022 · 4 comments · Fixed by #1277
Closed

Custom entities persist when quitting scenario #689

byorgey opened this issue Sep 16, 2022 · 4 comments · Fixed by #1277
Labels
Bug The observed behaviour is incorrect or unexpected. C-Low Hanging Fruit Ideal issue for new contributors. G-Game State An issue having to do with the game state record. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Refactoring This issue is about restructuring the code without changing the behaviour to improve code quality.

Comments

@byorgey
Copy link
Member

byorgey commented Sep 16, 2022

This is a placeholder for now to remind me to fix custom entities persisting across games by storing generic entitymap in new runtimestate, rebuilding GameState from scratch every time.


This is a duplicate of #516, but leaving it open since the discussion below about the new RuntimeState is relevant.

@xsebek
Copy link
Member

xsebek commented Sep 17, 2022

Is this #516?

Anyway, recently I added an extra RuntimeState to AppState, do we want to put the persisting parts of GameState there?

@byorgey
Copy link
Member Author

byorgey commented Sep 17, 2022

Oh, yes, this is #516 , I forgot I had already filed it. Anyway, yes, seeing the new RuntimeState is exactly what made me think of this --- it's the perfect way to fix this issue. Any state that should persist across games (such as the EntityMap loaded from entities.yaml) should go in the RuntimeState, and the GameState should be regenerated from scratch every time we load a new scenario.

@byorgey byorgey added Bug The observed behaviour is incorrect or unexpected. C-Low Hanging Fruit Ideal issue for new contributors. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. G-Game State An issue having to do with the game state record. labels Sep 18, 2022
@xsebek xsebek added the Z-Refactoring This issue is about restructuring the code without changing the behaviour to improve code quality. label Oct 1, 2022
@kostmo
Copy link
Member

kostmo commented Nov 14, 2022

Just encountered this bug, so adding my data point. After playing the 2048 challenge, the inventory for a Creative game is full of powers of two:

image

@xsebek
Copy link
Member

xsebek commented Nov 14, 2022

@kostmo interesting, they might be visible in inventory because they are known, I guess? 🤔

This can serve as a manual test case for #516. 👍

@mergify mergify bot closed this as completed in #1277 May 25, 2023
mergify bot pushed a commit that referenced this issue May 25, 2023
All info that needs to be persistent (*e.g.* the set of standard/default entities and recipes) is now stored in the `RuntimeState`.  The `GameState` record is now recreated completely from scratch every time upon starting a new scenario, so custom entities and recipes from the previous scenario do not persist into the next.

Fixes #516.  Fixes #689.

Also a bunch of related refactoring/simplification relating to how we were initializing state for tests and benchmarks.

I also want to refactor the tests so we only load data from disk once, but I have split that out into a separate issue (#1279).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The observed behaviour is incorrect or unexpected. C-Low Hanging Fruit Ideal issue for new contributors. G-Game State An issue having to do with the game state record. S-Nice to have The bug fix or feature would be nice but doesn't currently have much negative impact. Z-Refactoring This issue is about restructuring the code without changing the behaviour to improve code quality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@kostmo @byorgey @xsebek and others