squid-man / MegaMan2Randomizer2

Mega Man 2 Randomizer
8 stars 5 forks source link

Major Redesign of the Options System #188

Open TheRealQuantam opened 1 month ago

TheRealQuantam commented 1 month ago

The current implementation of the options system is a monument to bad system design. It recently took me 134 lines of changes across 10 different files just to add a single check box option, not counting the code to actually do what the option does. This is unnecessarily laborious and absurdly error-prone.

Definition: "Simple option": A check box or dropdown box option that requires no special GUI (i.e. not the player sprite selection)

This post-tournament task is to redesign the system to be far more data-driven, so at most 3 changes (and maybe 5-15 lines) are required to add a new option:

  1. (Code) A list of option names as they will be used elsewhere. This is not strictly necessary but will allow for autocompletion rather than having to type in the names manually.
  2. (Code or data file) A single table of options in the library enumerating what options it accepts, with values and basic semantic information sufficient to allow everything but the actual function to be specified in a single entry for simple options. And for simple options this will even specify what action to take (i.e. "call function X" or "apply IPS patch X").
  3. (Code or data file) A single table of options in the host that specifies GUI-specific things like order of options in the host. From this the GUI portion for simple options will be AUTOGENERATED, allowing only a line or two for each option rather than manually adding them to the axaml. This could potentially be merged into table 2, but that would violate the separation between library and host.

Finally, 4. (Data file) Tournament modes, which options they override and their values. Tournament modes should be converted to a dropdown so new modes can easily be added to.

Further discussion with brainstorming and specifics to come in this issue. @squid-man @CharlieboyX

I might try this myself.