Skip to content
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

Add autotracking support #123

Open
wants to merge 34 commits into
base: ootr
Choose a base branch
from
Open

Add autotracking support #123

wants to merge 34 commits into from

Conversation

coavins
Copy link

@coavins coavins commented Oct 20, 2021

(See setup guide)

Hi, I use your tracker with OOT because I think it's the best out there, but after playing LTTP with codemann8's autotracker, I found it difficult to return to OOT where I had to check everything off manually.

I wrote these scripts to add autotracking to my preferred tracker so I can enjoy that convenience again. Please review my PR below and let me know what it would take to merge these changes.

Try it yourself:

The zip file located here is based on the latest stable release with the autotracker functionality included. Just right-click the robot and choose "SNES", then "Lua", and make sure the connector.lua that is included with EmoTracker is running in Bizhawk.

You should configure all of your settings before turning on the autotracker.

This branch was developed and tested against the following:

  • EmoTracker 2.3.8.14
  • Hamsda commit 9b3285e
  • BizHawk 2.3.0 (x64) commit af9d1db
  • The bizhawk connector.lua included with aforementioned EmoTracker
  • Archipelago 0.1.9

The autotracking has worked great in testing, with only some rare errors related to failed raw byte reads, requiring a restart of EmoTracker and BizHawk. It works simultaneously with Archipelago's Z5 client, and should probably work with TestRunnerSRL/bizhawk-co-op although that hasn't been tested.

PR checklist:

  • To enable autotracking within EmoTracker for this pack, the platform was changed to "snes" in the manifest. This should probably be fixed within EmoTracker to allow the robot icon to appear for packs targeting n64.
  • A proof-of-concept "race mode" toggle was added which disables autotracking when active. The appearance and placement of this setting should be reviewed.
  • A proof-of-concept big poe counter was added to allow the player to identify how many poes are required for turn-in. The check is marked off automatically when the goal is met. The appearance and placement of this setting should be reviewed.
  • The forward slash in the "Deku Scrubs / Sticks" location seems to prevent it being found via FindObjectForCode. The new name this location was given should be reviewed; I'm also not sure if I changed it everywhere that it needs to be changed.
  • The visibility rules for Malon at Hyrule Castle were changed to better facilitate automatic progression of the trade sequence, and should be reviewed. Her check now hides automatically when the egg is received, matching the behavior of other checks in this sequence. This only applies when egg shuffle is not turned on. I'm also not sure if I changed this everywhere that it needs to be changed.
  • The changes to the accessibility rules for Deku Theater Skull Mask in commit b219b81 should be reviewed.
  • The title was changed to differentiate from the original pack. This should probably be reverted.

Original commit message copied below:

This commit adds autotracking to Hamsda's ZOOTR map and item tracker.
This work is based on codemann8's LTTP autotracking.lua script and takes
advantage of the Bizhawk connector.lua that is included with Emotracker.

This branch is tested and known to work great with the following:

  • EmoTracker 2.3.8.14
  • Hamsda commit 9b3285e
  • BizHawk 2.3.0 (x64) commit af9d1db
  • The bizhawk connector.lua included with aforementioned EmoTracker

Also works simultaneously with Archipelago! (ootMulti.lua 2021-09-11)

To enable autotracking, right-click the robot icon in the lower right
corner and select "SNES", then "Lua". You will also need to find the
connector.lua included with Emotracker and run it in Bizhawk.

It's always best to reset the tracker and ensure all of your settings
are configured correctly prior to activating the autotracker. It can
also be reactivated after you load your save file in EmoTracker.

Things that are currently autotracked:

  • Inventory and quest items received
  • Locations checked
  • Dungeon bosses defeated
  • Trade sequences progressed
  • Keys received (for keysanity variants)

Things that are NOT autotracked:

  • Master Quest dungeon checks
  • Which prize is awarded by each dungeon
  • Scarecrow's song state
  • Captures for spawn and entrance randomizer
  • At which song location each song was received

I couldn't have done this without this amazing list of offsets:

Thank you RiptideSage!

I also heavily referenced the following resources:

Things that should be reviewed prior to merging:

To enable autotracking within EmoTracker for this pack, the platform was
changed to "snes" in the manifest. I couldn't get the option to show up
without making this change, and I don't know if it has any side effects.

A proof-of-concept "race mode" toggle was added to demonstrate how users
might be encouraged to stay honest and obey community racing rules.
Autotracking is disabled while race mode is enabled.

A proof-of-concept big poe counter was also added to the settings to
allow the user to indicate how many are required. This was necessary in
order to automate the big poe turn-in check.

I renamed the 'Deku Scrubs / Sticks' location to remove the forward
slash because it was preventing lookup.

I also changed HC Malon's visibility rules to make her disappear
when the egg is placed into the inventory. This solved some issues
relating to the advancement of the trade sequence.

Wishlist for things I don't feel like working on:

  • fix many location codes for entrance rando variants
  • test composer grave song check when Song Locations is used
  • figure out how to add MQ dungeon checks and status
  • change the interface in an obvious way when not in race mode
  • don't allow race mode to be restored after it was turned off
  • track dungeon prizes when that information is known to the player
  • track scarecrow song without giving away info player doesn't have yet
  • rescue epona (no location for this on the tracker?)
  • stop reading a scene if all checks in that scene are completed

This commit adds autotracking to Hamsda's ZOOTR map and item tracker.
This work is based on codemann8's LTTP autotracking.lua script and takes
advantage of the Bizhawk connector.lua that is included with Emotracker.

This branch is tested and known to work great with the following:
* EmoTracker 2.3.8.14
* Hamsda commit 9b3285e
* BizHawk 2.3.0 (x64) commit af9d1db
* The bizhawk connector.lua included with aforementioned EmoTracker

Also works simultaneously with Archipelago! (ootMulti.lua 2021-09-11)

To enable autotracking, right-click the robot icon in the lower right
corner and select "SNES", then "Lua". You will also need to find the
connector.lua included with Emotracker and run it in Bizhawk.

It's always best to reset the tracker and ensure all of your settings
are configured correctly prior to activating the autotracker. It can
also be reactivated after you load your save file in EmoTracker.

Things that are currently autotracked:
* Inventory and quest items received
* Locations checked
* Dungeon bosses defeated
* Trade sequences progressed
* Keys received (for keysanity variants)

Things that are NOT autotracked:
* Master Quest dungeon checks
* Which prize is awarded by each dungeon
* Scarecrow's song state
* Captures for spawn and entrance randomizer
* At which song location each song was received

I couldn't have done this without this amazing list of offsets:
* https://github.com/RiptideSage/OoT-CompletedChecks

Thank you RiptideSage!

I also heavily referenced the following resources:
* https://docs.google.com
  /spreadsheets/d/1lh8JcUcuXg7GR4DTWMhmfk42Y0H6nJvUg-zRn8-8bPk
* https://tcrf.net
  /Proto:The_Legend_of_Zelda:_Ocarina_of_Time_Master_Quest/Event_Editor
* https://wiki.cloudmodding.com/oot/Save_Format
* https://wiki.cloudmodding.com/oot/Scene_Table/NTSC_1.0
* https://github.com/aliblong/zootr-autotracker
* https://cloudmodding.com/zelda/oot
* https://wiki.ootrandomizer.com/index.php?title=Editing_RAM

Things that should be reviewed prior to merging:

To enable autotracking within EmoTracker for this pack, the platform was
changed to "snes" in the manifest. I couldn't get the option to show up
without making this change, and I don't know if it has any side effects.

A proof-of-concept "race mode" toggle was added to demonstrate how users
might be encouraged to stay honest and obey community racing rules.
Autotracking is disabled while race mode is enabled.

A proof-of-concept big poe counter was also added to the settings to
allow the user to indicate how many are required. This was necessary in
order to automate the big poe turn-in check.

I renamed the 'Deku Scrubs / Sticks' location to remove the forward
slash because it was preventing lookup.

I also changed HC Malon's visibility rules to make her disappear
when the egg is placed into the inventory. This solved some issues
relating to the advancement of the trade sequence.

Wishlist for things I don't feel like working on:
* fix many location codes for entrance rando variants
* test composer grave song check when Song Locations is used
* figure out how to add MQ dungeon checks and status
* change the interface in an obvious way when not in race mode
* don't allow race mode to be restored after it was turned off
* track dungeon prizes when that information is known to the player
* track scarecrow song without giving away info player doesn't have yet
* rescue epona (no location for this on the tracker?)
* stop reading a scene if all checks in that scene are completed
The Deku Theater Skull Mask check will now appear accessible even after
you traded to a different mask, since you can go back and get the right
one. This change means that the item in this slot should be indicative
of the furthest trade progress you've made, not the item you're actually
holding, which is how the autotracker handles this slot.
@coavins coavins force-pushed the autotracker-pr branch 2 times, most recently from a6b1c57 to e05b046 Compare October 21, 2021 04:25
Slight changes were made here to the autotracker scripts in order to
better facilitate unit testing.
This commit adds tests for the unit testing framework "busted" to the
project under the "tests" folder. The intent here is to add unit tests
to cover the more troublesome elements of the autotracker, notably the
child trade sequence handler, but more tests can be added to cover any
part of the project.

The following command can be used to execute all tests from the top
directory, next to the .busted file:

  $ busted .

The .busted file is used to define the parameters that should be used
when the tests are run this way.
This bug surfaced after the unit tests were written. The child trade
slot needs to show no item when the player does not have any item and
the happy mask shop is not open yet.
This commit touches a lot of the autotracker files in order to make
the indentation style match what is used in the rest of the project.
This commit adds some simple tests for the "planted bean" tracking
function in auto_checks.lua. This function is responsible for setting
the correct number of beans in the tracker inventory both with and
without the "Bean Planting" option enabled.
Mostly just renaming some checks
This commit moves the assert statements out of a helper function and
back into the test bodies to ensure the error messages caused by a test
failure are as clear as possible.

Part of the function was retained to keep the asserts simple.
This commit fixes an issue where the advancement of the trade sequence
would not take place when the guard is shown the letter while kak is
closed. This is because updates to the trade sequence took place only
during the inventory callback, which does not trigger on this event
since the inventory does not change.

The handling of the child trade sequence was refactored to allow it to
be triggered from the events callback, where an update of the guard's
state was added. This ensures the trade sequence is progressed
immediately after the guard is shown the letter, similarly to the way
Talon's wake up check is handled.

This commit also adds two unit tests to cover these two cases.
@Hamsda
Copy link
Owner

Hamsda commented Nov 20, 2021

Sorry for not responding for a while. First off, thanks for putting in the work to make this function!

I wasn't quite sure what to do with this PR. You may be aware that autotrackers are (sadly) not legal for racing in OoTR. So, at least until that stance changes, I can't really merge it, since the racing aspect definitely is a focus of mine.

If you want to maintain the autotracker though, I am pretty sure there are people who would love to use it.

This commit takes the racemode setting out of the logic settings area
and moves it into a more prominent position in the item grid.
@coavins
Copy link
Author

coavins commented Nov 20, 2021

I understand, I've since been informed of the awkward situation with the community rules. I'm happy to keep this pr branch up to date in the meantime, and isolated from my other divergent changes so that it will be ready to merge whenever they figure out the rules on their end.

There's no need for this toggle since community race rules don't
allow the use of trackers that have autotracking functionality,
even if the autotracker is turned off.

This commit removes the option to turn on race mode, in order to avoid
misleading the user into thinking it allows them to use the tracker
for races. The casual mode indicator is retained to help indicate that
this tracker is capable of autotracking.
This commit moves the "race mode" toggle into the master branch
in order to minimize conflicting changes with the upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants