- 
                Notifications
    You must be signed in to change notification settings 
- Fork 1.2k
Core: create the per world random object in the world constructor #2083
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
Core: create the per world random object in the world constructor #2083
Conversation
| Can confirm, Lufia II item links with  | 
# Conflicts: # BaseClasses.py # test/general/TestFill.py
| This is now reliant on #2290 | 
# Conflicts: # BaseClasses.py # Utils.py # worlds/AutoWorld.py
# Conflicts: # test/general/test_fill.py
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.
Looks good to me. I also wouldn't mind keeping the random assignment in set_seed and just assigning directly to world randoms instead of going via the dict but I don't really have a strong preference
| 
 I think having random available asap is a good thing, otherwise people may try to hack their way around it. The only downside i see is that you can not create a world before  
 Tests are failing. | 
| 
 Done. | 
| What do we label "waiting-on: other PR" as? | 
| Regarding testing (once 2290 is merged) I would actually expect all the relevant code paths to be hit by automated tests here; since the change relates to multiworld instantiation even untested/poorly tested worlds should be ok because they won't be instantiating multiworld instances, or other worlds | 
# Conflicts: # worlds/AutoWorld.py
| def setup_solo_multiworld( | ||
| world_type: Type[World], steps: Tuple[str, ...] = gen_steps, seed: Optional[int] = None | ||
| ) -> MultiWorld: | 
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.
Did you forget to use seed in set_seed() below?
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.
no i just really hate the way dlcq and sdv do their tests
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'm fairly certain this is gonna break tests of worlds that have not been merged (or PR'd) yet, but I don't see a way to make this more back compatible, without adding duplicate world.random init, so we should just merge this.
…chipelagoMW#2083) * Core: create the per world random object in the world constructor * remove the check that multiworld exists * add a deprecation warning to per_slot_randoms * move random import and fix conflicts * assert worlds don't exist before setting the multiworld seed * fix the dlcq and sdv tests * actually use the seed
…chipelagoMW#2083) * Core: create the per world random object in the world constructor * remove the check that multiworld exists * add a deprecation warning to per_slot_randoms * move random import and fix conflicts * assert worlds don't exist before setting the multiworld seed * fix the dlcq and sdv tests * actually use the seed
What is this fixing or adding?
Honestly was stupid to not just do this in the first place when implementing random as an attr on the world itself. This does make seeds generated before this change different, but plan was to eventually drop
per_slot_randomscompletely anyways, so this just moves forward that particular breakage.Main reason for doing this is because item link worlds don't have a random object associated so trying to use their random object during filler creation causes a crash. That in particular only affects the messenger and lufia2 but is easy to miss so could affect more on the future. @el-u so you're aware that Lufia currently crashes with item links without this change.
How was this tested?
Unit tests. More practical testing couldn't hurt, but this is relatively low impact.