(Rando) Add Check Tracker#1117
(Rando) Add Check Tracker#1117ajanhallinta wants to merge 22 commits intoHarbourMasters:rando-nextfrom
Conversation
| { RC_ZR_OPEN_GROTTO_GOSSIP_STONE, RR_ZR } | ||
| }; | ||
|
|
||
| std::unordered_map<RandomizerCheck, std::string> CheckEnumToName = { |
There was a problem hiding this comment.
i think instead of using this it might make sense to move SpoilerfileCheckNameToEnum from randomizer.cpp
randomizer.cpp and here
There was a problem hiding this comment.
come to think of it, it probably makes sense to just make a public GetCheckName function in randomizer.cpp that takes in a RandomizerCheck and gets the string from the existing map
There was a problem hiding this comment.
Would it make more sense to go in randomizer.cpp or maybe randomizerItemTracker.cpp? Or maybe even a completely new file to start the process of breaking randomizer.cpp up a bit? The latter might be better saved for later, relocation is probably relatively easy.
There was a problem hiding this comment.
i was thinking going into randomizer.cpp makes sense because that's where SpoilerfileCheckNameToEnum is. and yeah, splitting up the behemoth that is randomizer.cpp is definitely something we should do, but it can be it's own thing
There was a problem hiding this comment.
Surely we can find a way to re-use the already existing list of checks, locations, names, etc from within 3drano right? A lot of this has been done just with a different purpose, can we repurpose it?
There was a problem hiding this comment.
Actually I suppose you could just have the GetCheckName function you suggested iterate over the SpoilerfileCheckNameToEnum map until it finds a specific value, but that seems a bit inefficient considering how often it will be done as compared to my suggestion of iterating over the map once on startup and constructing a new array. What do you think @briaguya-ai ?
There was a problem hiding this comment.
yeah, not sure exactly how bad using find would be from a performance stand point in that scenario, it's not like it'd be doing string comparisons so it might not be too bad.
but the map isn't big enough to be a memory problem on the systems we're targeting, so generating a new array (or a new unordered_map with the keys/values reversed) based on the map in the randomizer constructor would probably be a good plan
There was a problem hiding this comment.
find wouldn't work would it? find matches on the key, if they're going to use our existing map they would be searching for a specific value right?
Array would be best I think since the keys in this case are just integers and nothing will be getting added after compile time.
There was a problem hiding this comment.
find matches on the key
yeah, my bad, good point
Array would be best I think
yeah, array sounds good, i'd still like to expose it via a get method in randomizer.cpp but storing it as an array seems like a solid plan
There was a problem hiding this comment.
I concur on the Get Method, that's still a solid plan.
| { RC_ZR_OPEN_GROTTO_GOSSIP_STONE, "ZR Open Grotto Gossip Stone" } | ||
| }; | ||
|
|
||
| std::unordered_map<RandomizerGet, std::string> GetEnumToName = { |
There was a problem hiding this comment.
same idea as the checks here
|
If you're looking to implement automatic item checks, it looks like randomizer.cpp has a function to check where an item was found. Perhaps you don't even need to check that the item was added to the inventory because the spoiler log will tell you what the item was anyways. It seems like they still need to implement stuff like shopsanity/scrubsanity locations, but it may be a possible addition to the tracker that you could make. (It looks like this function is called whenever a custom message needs to be shown, in other words, any time an item is found. I suspect you could add code prior to the return statement for each location that checks off that location on the tracker and the respective item obtained from the spoiler log.) |
The function you linked is only part of the picture. This only covers checks obtained from actors. That is a large majority of the checks in the game but not all of them. For example, the Song of Time check is not given by a particular actor, so we call a different function and pass in the RandomizerCheck value for those instances. It's also called more often than just when the player receives the check. Chests, for example, call this function every frame that link is in range to open the chest. Skulltulas and Freestanding Items have to call this function to determine what model to render, which is obviously called before Link receives the item. |
commit b420ad8 Merge: 35f69f6 d74220d Author: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Wed Aug 10 12:07:58 2022 -0400 Merge pull request HarbourMasters#1136 from briaguya-ai/make-array-big-enough-for-all-the-checks make array big enough for all the checks commit d74220d Author: briaguya <briaguya@alice> Date: Wed Aug 10 11:55:47 2022 -0400 don't give link's pocket garbage commit f5d7955 Author: briaguya <briaguya@alice> Date: Wed Aug 10 11:39:10 2022 -0400 ensure itemlocations is big enough for every check commit d535d0b Author: briaguya <briaguya@alice> Date: Wed Aug 10 11:21:10 2022 -0400 make array big enough for all the checks
…right into check-tracker
|
@leggettc18 Oh okay, I saw it and I thought it was only used in instances of getting a custom message like in Shipwright/soh/soh/OTRGlobals.cpp Line 1495 in 15fba97 CustomMessage_RetrieveIfExists function here be made to update the tracker for any items from actors at least, or would this cause the same issue?
|
Probably the best way to handle auto tracking is mapping every check to it's respected flag within the game, part of this work has already been done in |
|
@JakeEdvenson The custom messages are only used for get-item messages that don't exist in Vanilla, hint text, "Mysterious Item" text from scrubs, and other such text. The items that already have text for Link receiving the item in vanilla just use the existing message retrieval code that n64 was always using. What you're seeing in Currently whether or not an item has been collected is not stored in any centralized location, we just set the same flags as vanilla for each check in most cases. @briaguya-ai can correct me on this if I'm wrong but I believe the long-term plan is to expand |
|
@leggettc18 OK, that makes more sense, thank you! I didn't realize that the N64 vanilla messages were accessed elsewhere. I just started looking into this project today to see where I can help since I'm very familiar with the game and I enjoy coding, so this is helping me understand the layout a lot! Thanks! |
Adds a Check Tracker menu to Rando, similar to Item Tracker.
It has Regions for different parts of the world and the Tracker will automatically show available checks and their count in the area you are in. You can also view checks from other / all Regions. Tracker data can be saved and loaded to/from .json file.
You can also view spoiler log for each Check by using "Show Spoilers" toggle. For invidual Checks the spoiler log will be shown automatically after checking the checkbox.
Code probably needs some optimization (I'm not a pro C++ coder), some scenes have quirks with having correct region (Dampe/Windmill, Bazaar) and this would need some more testing.
For future I would like to have auto-tracking feature (I have no clue how to implement that), filtering checks by given text and maybe item search from checks.
Would appreciate any feedback, ideas and thoughts!
Older video:
https://user-images.githubusercontent.com/26453696/183619660-dbfe15df-047b-4195-ac6a-9fbd7d4e1ab6.mp4
Newer screenshot:
