fix(world): make new world generation deterministic#647
Merged
BenjaminAmos merged 2 commits intoMovingBlocks:developfrom Oct 16, 2022
Merged
fix(world): make new world generation deterministic#647BenjaminAmos merged 2 commits intoMovingBlocks:developfrom
BenjaminAmos merged 2 commits intoMovingBlocks:developfrom
Conversation
This change updates WorldConfig to contain the system generators and feature generators that were used to generate the system. The world configuration was changed to be held centrally in SolGame and is now used as the authoritive source of truth for world generation. Also updated some occurences of publicly-facing ArrayList<T> methods to the more generic List<T>.
50cbf8c to
acdfeae
Compare
Contributor
Author
|
@IsaiahBlanks, would you be interested in verifying this change? I'm not very familiar with the new world generation, so I might have made some mistakes somewhere. |
Merged
Contributor
Author
|
These changes appear to work and are an improvement over the previous behaviour, so I see no issues in merging this right away. |
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.
Description
When #607 was merged, it broke the determinism of world generation. This means that continuing an existing save would often end-up generating a completely different system than the one that was present when the game was saved. The precise reason for this issue is because the ordering of types returned by
ModuleEnvionment::getSubtypesOfis undefined. I often found that the exact ordering of types in the returned list changed every time the game was run. The galaxy generation code is very sensitive to the ordering of these lists.A simple solution to this problem would be to sort the lists by type name. This would not help though if additional feature generators were added later-on, since they could change the list ordering and size again. Because of this, I decided to save the generators used with the world configuration instead. This does mean that you will have to start a new game to see any new system/feature generators in use though.
I also updated some occurences of publicly-facing
ArrayList<T>methods to the more genericList<T>inGalaxyBuilder, since I was modifying that code anyway.It appears that some world generation tests were commented-out in #622. This pull request also restores those stubbed tests with working implementations again.
Testing
Notes