-
Notifications
You must be signed in to change notification settings - Fork 671
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
SM: 0.4.2 percent goals fix #2183
SM: 0.4.2 percent goals fix #2183
Conversation
…VariaRandomizer's rules, items, locations and accessPoint (as regions)
…se (fills ROM item table) This is dependant on modifications done to sm_randomizer_rom project
- player name inject in ROM and get in client - end game get from ROM in client - send self item to server - add player names table in ROM
…ition of an array of it (required to generation more than one SM world, which is still fails but is better)
… and done some cleaning
…er's" This reverts commit fb3ca18.
- fixed seeded generation - fixed broken logic when more than one SM world - added missing rules for inter-area transitions - added basic patch presence for logic - added DoorManager init call to reflect present patches for logic - moved CollectionState addition out of BaseClasses into SM world - added condition to apply progitempool presorting only if SM world is present - set Bosses item id to None to prevent them going into multidata - now use get_game_players
…VariaRandomizer's rules, items, locations and accessPoint (as regions)
…se (fills ROM item table) This is dependant on modifications done to sm_randomizer_rom project
- player name inject in ROM and get in client - end game get from ROM in client - send self item to server - add player names table in ROM
…ition of an array of it (required to generation more than one SM world, which is still fails but is better)
… and done some cleaning
@@ -164,6 +164,7 @@ def escapeTrigger(self, emptyContainer, graph, maxDiff, escapeTrigger): | |||
availLocsByArea[itemLoc.Location.GraphArea].append(itemLoc.Location.Name) | |||
self.log.debug("escapeTrigger. availLocsByArea="+str(availLocsByArea)) | |||
sm.objectives.setAreaFuncs({area:lambda sm,ap:SMBool(len(container.getLocs(lambda loc: loc.Name in availLocsByArea[area]))==0) for area in availLocsByArea}) | |||
sm.objectives.setPercentFuncs({percent:lambda sm,ap:SMBool(len(container.getUsedLocs(lambda loc: True)) >= percent) for percent in [25, 50, 75, 100]}) |
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.
If I understand this right, it's not actually percent, but that many locations? As in, it's checking for being able to reach 25, 50, 75 and 100 locations respectively?
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.
You're right: thats wrong. Its should really be a percentage of obtainable location checks otherwise things like "Nothing" Items will be counted. I'll fix that.
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.
Was able to play a fun movement/disabled Tourian/collect all items seed without any failures. This should cover the test case where less than 100 locations exist (98 total, 97 functional were present, Space and Grapple were removed).
Haven't reviewed the code, but as far as testing, I encountered weird generation issues blocking 10 of 10 attempts at generating a fairly normal 3-player SM multi on 0.4.2. Checking out this PR branch fixed the issue, yielding multiple successful generations with the same yamls. |
goal = 'collect %d%% items' % pct | ||
self.goals[goal].clearFunc = getPctFunc(pct, totalItemsCount, container) |
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.
goal = 'collect %d%% items' % pct | |
self.goals[goal].clearFunc = getPctFunc(pct, totalItemsCount, container) | |
goal = 'collect %d%% items' % pct | |
self.goals[goal].clearFunc = getPctFunc(pct, totalItemsCount, container) |
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.
Fixed with latest commit.
def setItemPercentFuncs(self, totalItemsCount=None, allUpgradeTypes=None): | ||
def getPctFunc(pct, totalItemsCount): | ||
def setItemPercentFuncs(self, totalItemsCount=None, allUpgradeTypes=None, container=None): | ||
def getPctFunc(pct, totalItemsCount, container): |
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.
def getPctFunc(pct, totalItemsCount, container): | |
def getPctFunc(pct, totalItemsCount, container): | |
total_needed: float = pct * totalItemsCount / 100 |
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.
Fixed with latest commit.
nonlocal pct, totalItemsCount, container | ||
locs_checked = len(container.getUsedLocs(lambda loc: True)) | ||
return SMBool(locs_checked * 100 / totalItemsCount >= pct) |
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.
nonlocal pct, totalItemsCount, container | |
locs_checked = len(container.getUsedLocs(lambda loc: True)) | |
return SMBool(locs_checked * 100 / totalItemsCount >= pct) | |
locs_checked = len(container.getUsedLocs(lambda loc: True)) | |
return SMBool(locs_checked >= total_needed) |
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.
calculating it once ahead of the function should make it a nice bit faster.
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.
Fixed with latest commit.
fixed percent items goals that can fail generation (reported here https://discord.com/channels/731205301247803413/1147318124383850516/1147318124383850516 and here https://discord.com/channels/731205301247803413/1138137515505750108/1138137515505750108)
fixed percent items goals that can fail generation (reported here https://discord.com/channels/731205301247803413/1147318124383850516/1147318124383850516 and here https://discord.com/channels/731205301247803413/1138137515505750108/1138137515505750108)
What is this fixing or adding?
How was this tested?