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

Proposal: API for modded ecl scripts and hypothetical th185 replay mod #90

Open
32th-System opened this issue Aug 24, 2022 · 6 comments
Labels
enhancement New feature or request epic Large stories dividable to smaller ones refactoring Issues related to tidying up code

Comments

@32th-System
Copy link
Member

32th-System commented Aug 24, 2022

What if thprac had some sort of API that could be used by third party mods to create custom practice menus for their custom stages?

zero318 came up with the idea of .prac files that could go either in thXX.dat or could be provided by thcrap, that would tell thprac what the practice menu should look like, and which parts of the ecl file should be modified in what way depending on the menu entry selected. This system could also replace the entire current system for patching stages that thprac has, which would lead to:

  • More convenient and faster way to write and test the practice menus
  • More convenient and faster testing with much less recompiling
  • Less janky system for implementing that menu to begin with
  • Less janky localization system with a far smaller thprac_locale_def.h which leads to shorter compilation times

I think that this change would warrant bumping the version number all the way to 3.0.0.0

@32th-System 32th-System added the enhancement New feature or request label Aug 24, 2022
@Lmocinemod
Copy link
Contributor

(I'm not sure who's invited to participate in this discussion, but I'll throw in my two cents in the hopes that they're welcome. 😅)

I do like the idea. If I'm understanding this correctly, this would eliminate the need for the thprac_th**.cpp files, or at least greatly reduce their sizes? Furthermore, combined with recent work on thtk, this might open the door for people who don't know C++ to contribute to thprac's development.

I imagine the format of the .prac files is still a far-off problem at this stage, but I'd suggest using some kind of object format, such as JSON(5). (Related: #38)

Regarding thprac_locale_def.h in particular, though, is there any particular reason this needs to be a header file? Given its size, it would make more sense (in my opinion) for it to be a source file. (This might also improve compilation speeds, possibly? I'm not sure how many source files #include the header.) With that being said, there's also a strong argument to be made for splitting it into three .json files (or similar), and loading them at runtime instead... 🤔

Lastly, regarding the version number: I don't have any particular objections, but perhaps we could also consider using semantic versioning for thprac?

@32th-System
Copy link
Member Author

thprac_th*.cpp files would still be needed for setting up dear imgui and installing game specific patches, but those files would be a lot smaller.

Regarding the format, I'm actually thinking about it right now and would like it implemented not that far into the future. And yes, I am using JSON for this.

It would make a lot more sense for thprac_locale_def.h to only contain declarations with a separate .cpp file for the actual strings. As for how many source files include it: all of them.

The reason I'm saying that this warrants bumping the version to 3.0.0.0 is because it's a massive change that completely changes everything about the very core of thprac, for the better

@Lmocinemod
Copy link
Contributor

I could have a go at moving the thprac_locale_def strings to a .cpp file, if you'd like? Though I probably won't start on that until the weekend.

I imagine this would require making changes to thprac_utils? Since I'm not familiar with that codebase, I'd appreciate some general guidance, if you're willing to provide it. (I'm fairly certain we're both in the thpatch Discord?)

@32th-System
Copy link
Member Author

I moved an older program called "thprac_multi" into "thprac_devtools". I don't actually know how any of the code that generates thprac_locale_def.h works I just did the minimum to get it to wotk in thprac_devtools

@muter3000
Copy link
Collaborator

muter3000 commented Aug 24, 2022

I’m wondering whether thprac_locale_def.h generation could be somehow omitted by direct json serialisation with the help of library such as https://github.com/nlohmann/json. Didn’t work with json so much in C++ but that seems like a good idea, as this is the strategy for most modern languages.

@32th-System
Copy link
Member Author

@Lmocinemod I've been talking a lot in ZUNcode about this proposal

@32th-System 32th-System added refactoring Issues related to tidying up code epic Large stories dividable to smaller ones labels Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic Large stories dividable to smaller ones refactoring Issues related to tidying up code
Projects
None yet
Development

No branches or pull requests

3 participants