-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Merge world config screen into preview screen #1726
Conversation
Looking forward to playing with this in the weekend! I'm not too worried about changing a few world-bearing modules, that's not a big deal :-) However, at least in the case of WorldConfigurator.java, couldn't we just take advantage of Java 8 and provide a default interface method? We could even replace WorldConfiguratorAdapter that way entirely if I'm not mistaken? Which I may well be - taking a while to get used to the new stuff :D There are some other (unrelated) places we can do that too, I believe. |
ResolutionResult result = resolver.resolve(moduleName); | ||
if (result.isSuccess()) { | ||
environment = moduleManager.loadEnvironment(result.getModules(), false); | ||
CoreRegistry.put(WorldGeneratorPluginLibrary.class, new TempWorldGeneratorPluginLibrary(environment)); | ||
CoreRegistry.get(AssetManager.class).setEnvironment(environment); |
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.
I am currently trying to remove CoreRegistry usage. The AssetManager can also be obtained via depenendcy injection. e.g. by adding a private AssetManager field with an @in annotation.
The registration can be done after #1721 is merged by obtaining a Context instance via dependency injection. It offers a put method like CoreRegistry. Although I find a bit strange of a location for registering objects.
@msteiger I tried it out, it's a cool feature. Do you plan to make it recalculate automatically at every value change? That would be even cooler 8) Also a randomize button next to the seen value would be qutie useful. Maybe we could call it "Next" to keep it simpler Changing the high map caused some exceptions to be logged, but game didn't crash: |
Thanks for the review. I will wait until #1721 is resolved and update this PR accordingly. Functional changes/improvements will be in the next PR :-) @Cervator I don't know what's best here, so I tend to stick with well-approved approaches. Also there are some issues with default methods to keep in mind. |
Merge of #1721 is complete, update away :-) Thanks for the article link, interesting content and good things to watch out for. I think we're pretty safe here, as long as we don't go crazy. Want to try throwing away the old adapter class? Also take a look at PolyWorld with the PR just merged, there was a broken (as in, fail to compile) unit test in there after the merge, IIRC (you saw it earlier, unsure if there's a fix already waiting) |
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
I've updated the code and rebased it on top of It still uses |
Looked at this some more. A few of the module worlds are easy fixes (just remove the seed parameter from createWorld right?) but a few others are more tricky. Cities, LightAndShadow, and Pathfinding have their world gens extend AbstractBaseWorldGenerator, which now means they require getConfigurator. Yet if I add that and just return null it would seem badness can happen in PreviewWorldScreen.configureProperties, and a few other places in that class have NPE warnings in IntelliJ Is that class just obsolete now or something? Seemingly used in CreateGameScreen, which also has NPE warnings. WoodAndStoneWorldGenerator extends PluggableWorldGenerator and has a getConfigurator, but that now a wrong return type. That was the main place I saw I could just return null but that would probably lead to NPEs @msteiger want to add some more NPE hardening and/or merge this then apply fixes to the modules directly next? Two trivial fixes in AnotherWorld + TutorialWorldGeneration, same fix in Pathfinding but it also needs more. I couldn't replicate the same errors @flo reported in the HeightMap world, although I did crash on shutdown:
Seemed to happen again even after resetting saves + config. Reverted to plain develop and it went away. As for @flo's earlier comment about updating the preview for every change I think that's how it worked at one point, but it would stall the UI while regenerating which got annoying if you wanted to change multiple settings, thus the apply button :-) Unsure if that would be an issue still. +1 for a "Random!" button shuffling seed + all config :D |
I could replicate the error @flo reported, but it's not related to this PR. It doesn't reload the asset properly, since it doesn't get notified on parameter changes. We'll need a notification system first. I'll just deactivate it until this is in place. I'll also prepare a few PRs in the affected modules, so we can merge them at the same time. I cannot imagine how this PR could affect chunk generation and sunlight computation in particular. Does it happen after you start the game or in the preview screen? |
It happened on exiting the game from inside a height map world. Nothing special done or set up, just default everything, new game in heightmap, exit game, boom. I don't imagine it relates to sunlight so much as some hidden issue leaving the game in an unstable state at the time of exit. I'll try it again tonight in case there was something wrong with my system last night. If the tiny PR modules are a hassle you can just self-merge this then push the fixes directly to modules after :-) |
Okay, now I can't replicate the crash. Weird. @msteiger please merge this at your convenience then tweak the affected modules :-) |
@msteiger about the Context: You can use the available Context instance everywhere were you use the CoreRegistry as the former is just forwarding the calls to the context. About the deletion: I suggest we go for no deletion but create a issue for it. The issue doesn't need to be addressed in this pull request. |
Conflicts: engine/src/main/java/org/terasology/engine/modes/loadProcesses/CreateWorldEntity.java engine/src/main/java/org/terasology/rendering/nui/layers/mainMenu/ConfigWorldGenScreen.java engine/src/main/java/org/terasology/rendering/nui/layers/mainMenu/PreviewWorldScreen.java engine/src/main/java/org/terasology/world/generator/plugin/TempWorldGeneratorPluginLibrary.java
Refer to this link for build results (access rights to CI server needed): |
Refer to this link for build results (access rights to CI server needed): |
Afaict, all issues are resolved now. I'm merging this now so we can move on with follow-up changes without getting straight into merge conflict hell. |
Merge world config screen into preview screen
All affected modules have been updated. |
This PR merges the Config and the Preview screen into one, allowing for interactive changes:
It also contains a few related fixes and features:
TempWorldGeneratorPluginLibrary
(issue Crash on "preview" or "config" buttons on create world screen, TTA active #1524) - TtA still crashes, but for a different reason and will be fixed in a follow-up.However, it
WorldConfigurator
interfaceWorldBuilder
classThis requires fixes in all modules with world generators 😢