Skip to content

Logic Tracker/Viewer#5674

Draft
xxAtrain223 wants to merge 30 commits intoHarbourMasters:developfrom
xxAtrain223:logic-tracker
Draft

Logic Tracker/Viewer#5674
xxAtrain223 wants to merge 30 commits intoHarbourMasters:developfrom
xxAtrain223:logic-tracker

Conversation

@xxAtrain223
Copy link
Contributor

@xxAtrain223 xxAtrain223 commented Jul 13, 2025

Adds a new Logic Tracker window to help show why a Randomizer Check is available or not. It shows and evaluates the Randomizer Check condition expressions and subexpressions. It also shows and evaluates the condition expression and subexpressions of the entrances to the regions that contain the Randomizer Check.

Because the logic is written in C++ which does not have any kind of reflection, so the expressions have to represented as strings and parsed to an Abstract Syntax Tree to be evaluated at runtime. To do this without adding another dependency to the project, I wrote a custom tokenizer, parser, and evaluator. This method does require registering logic variables and functions, so it is prone to runtime errors. There is a project to move the logic to an external source for Archipelago which may replace this custom parser and evaluator when it's done.

For this to work, it needs the Locations, Entrances, and EventAccesses condition strings and enum to string mappings. As such, this touches many files and will cause merge conflicts for open PRs.

Example

Deku Tree GS Basement Vines Check

It's not available because I can't kill a Gold Skulltula with a Bomb Throw (or Boomerang, Din's Fire, Hookshot, Longshot, Bombchus, Slingshot, or Bow).
image

Deku Tree Lobby to Deku Tree Basement Lower Entrance

It is accessible because I can attack.
image

Deku Tree Entryway to Deku Tree Lobby Entrance

It is accessible because the dungeon is vanilla.
image

KF Outside Deku Tree to Deku Tree Entryway Entrance

It is accessible because I as a child.
image

Kokiri Forest to KF Outside Deku Tree Entrance

It is accessible because the Closed Forest is set to Off.
image

Build Artifacts

@serprex
Copy link
Contributor

serprex commented Jul 15, 2025

There's some talk with @Pepper0ni about converting logic to a DSL which we can compile to C++ (or C?) & Python to share code with Archipelago. Could also have that output a datastructure so you wouldn't need to parse C++

How does your tracker handle things it can't parse? how much is it parsing correctly? maybe we can use this to translate most of the existing logic to DSL

@xxAtrain223
Copy link
Contributor Author

@serprex

There's some talk with @Pepper0ni about converting logic to a DSL which we can compile to C++ (or C?) & Python to share code with Archipelago. Could also have that output a datastructure so you wouldn't need to parse C++

This would be the most ideal, I've been trying to keep the Parsing/Evaluating separate from the tracker so that it could be swapped out when that project is ready.

How does your tracker handle things it can't parse? how much is it parsing correctly? maybe we can use this to translate most of the existing logic to DSL

I have another project I used for the parser/evaluator development and I got every location, entrance, and event access condition string parsing, but I probably need to build in a dev option to test every condition string while in SoH. At the moment failing to parse/evaluate an expression would crash the game, I still need to add some error handling for this.

@xxAtrain223
Copy link
Contributor Author

Added some error handling.
image

@serprex serprex mentioned this pull request Jul 19, 2025
@xxAtrain223
Copy link
Contributor Author

Added Show Event Logic
image

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