r2modmanPlus icon indicating copy to clipboard operation
r2modmanPlus copied to clipboard

[FEATURE REQUEST] - GDWeave support

Open NotNite opened this issue 2 years ago • 5 comments

GDWeave is a mod loader for Godot games. It supports Godot 3.5.2 for the game WEBFISHING. More support for other Godot versions may be added in the future. (It was developed for the WEBFISHING community but has the potential to branch out to other games, essentially.)

Disclosure: I am the developer of GDWeave.

File format info

game.exe
winmm.dll                           # Rust loader
GDWeave/
  GDWeave.log                       # does not contain game logs, only loader logs
  core/
    GDWeave.dll                     # C# core
    <other dependencies of GDWeave>
  mods/
    <mod id>/                       # folder name is not enforced but encouraged
      manifest.json                 # not a Thunderstore manifest
      <other mod files>
  configs/
    <mod id>.json                   # unstructured JSON object

winmm.dll must be present in the game directory (like BepInEx using Unity Doorstop). GDWeave will expect the GDWeave folder to exist next to the running executable, this will break profiles. I am willing to add a GDWEAVE_FOLDER_OVERRIDE environment variable or such.

The GDWeave mod manifest is not important to the mod manager - it contains an ID and list of dependencies to load after.

Technical info

GDWeave is written in C# and contains a Rust DLL for serving as an entrypoint. Users are required to install .NET 8 to use GDWeave. GDWeave will automatically prompt the user to install .NET 8 upon launch if it is missing, so r2modman does not need to handle this for the user.

GDWeave uses Reloaded hooking libraries and may set off Thunderstore anti-spam filters.

State on Thunderstore

GDWeave mods live on Thunderstore (WEBFISHING), but GDWeave itself is not on Thunderstore yet. I need to get GDWeave uploaded as a package, then other mods must depend on GDWeave.

GDWeave will likely need to live in "cross-community limbo" like r2modman itself and BepInExPack. I will need to talk to Thunderstore moderators more about this.

The only community currently using GDWeave on Thunderstore is WEBFISHING.

Current mod ecosystem

We are still in progress of migrating mods to Thunderstore from a custom mod index. The community currently uses Hook, Line, & Sinker for mod management (which will/does support the Thunderstore API).

NotNite avatar Oct 30 '24 13:10 NotNite

GDWeave has been published on Thunderstore with the mentioned environment variable for profiles implemented.

NotNite avatar Oct 30 '24 14:10 NotNite

@NotNite

  1. It would probably be better if the profile location would be set via game's launch parameters everytime the game is launched (e.g. GodotML). Is this something GDWeave could implement?

  2. About the mod "folder name is not enforced but encouraged": letting mod authors decide the folder name (or config file name) isn't optimal. First there are the accidental conflicts when two authors pick the same folder, and then there's the possibility of intentional mischief by picking folder names used by other mods in order to overwrite them. Ideally it would be up to the mod manager to decide how to copy the files into the profile (basically using [teamname-modname] as the <mod id>).

    To make this easier for the mod manager, the actual content of the mods should be in a fixed place in each mod zip. I think usually the root of the zip is used, but as that would cause manifest.json files to clash, some folder with a predetermined name could be used as well. This would obviously require changes to existing mods - do you think the community would be up to that? Alternatively the mod manager can try to deal with the current mod structure, but that might be error prone.

  3. By the way, did the community come to a conclusion whether you want to keep the manifest.json files separate or not? From mod manager's perspective either works, it's just that having two files with the same name might be confusing for new mod authors?

  4. So installing/uninstalling mods would be handled by the mod manager copying/deleting the [teamname-modname] mod folder and config file. R2MM also supports disabling/enabling mods and currently this is done by appending the related file names in the profile with .old suffix so they don't get processed. Would this approach work with GDWeave? There's plans to support mod loader specific way of disabling mods but this hasn't been used anywhere yet, so using the .old method would be faster to implement.

(@ethangreen-dev did I forget or mess something up?)

anttimaki avatar Nov 01 '24 07:11 anttimaki

  1. I don't know if I have access to game launch parameters, but I can look into it later today.
  2. We could establish a "GDWeave/mod" standard but it would indeed break existing mods. Mods are all over the place with format anyways, so this isn't a huge deal, since I suspect no matter what format is picked at least one mod will break.
  3. Separate is probably the better idea but I think the name clash is unfortunate. Probably too late to rename it now from the mod loader side.
  4. GDWeave will skip loading a mod if the manifest is renamed like that, but I'm not sure how it'll work if other folders/files get renamed.

NotNite avatar Nov 01 '24 10:11 NotNite

@NotNite you should have access to the game's launch arguments via std::env::args.

To make this easier for the mod manager, the actual content of the mods should be in a fixed place in each mod zip. I think usually the root of the zip is used, but as that would cause manifest.json files to clash, some folder with a predetermined name could be used as well. This would obviously require changes to existing mods - do you think the community would be up to that? Alternatively the mod manager can try to deal with the current mod structure, but that might be error prone.

The easiest would be to require mod contents (everything that would be installed into GDWeave/mods/modname) to be contained within mod.zip/mod/*. The general structure would be like so:

mod.zip
- manifest.json (Thunderstore)
- ...
- mod/
- - manifest.json (GDWeave)
- - ...

A worse - but still plausible - solution would be to maintain the current package format. We can implement a very simple package traverse which navigates down GDWeave/mods and selects the first directory found. That directory will be renamed when it is moved into r2modman, so documentation must be put in place that directs authors to not rely on that name being constant.

Package installation will be simple to implement - we take the contents of the package and copy them into the profile directory %appdata%/r2modmanPlus-local/WEBFISHING/profiles/profile-name/GDWeave/mods/modname-namespace.

At launch we would pass the game some argument (maybe --mod-dir?) with the path of the r2modman profile directory. %appdata%/r2modmanPlus-local/WEBFISHING/profiles/profile-name. Preferably GDWeave should be able to have everything but the winnm bootstrap dll installed outside of the game directory.

ethangreen-dev avatar Nov 01 '24 13:11 ethangreen-dev

you should have access to the game's launch arguments via std::env::args.

Yeah, I'm aware, I just don't really want to implement my own argument parser that sits on top of Godot's. An environment variable is the best option IMO but I understand not wanting to use it. If you can set GDWEAVE_FOLDER_OVERRIDE to ${profileDir}/GDWeave things will work right now, but I can add my own argument stuff if I must.

A worse - but still plausible - solution would be to maintain the current package format. We can implement a very simple package traverse which navigates down GDWeave/mods and selects the first directory found.

This is what the current mod manager for our community does, but I think it's a little janky. It is the ideal solution for backwards compatibility. I don't really have any preference on the mod package format - you are free to brainstorm what seems best and I will go with it and tell the community.

NotNite avatar Nov 01 '24 13:11 NotNite