0 votes
by (170 points)
What the title says. By moddable, I basically mean plugins (I'm not talking about making the game open-source). Twine 2, newest version of Harlowe. I'm more looking for how to do this for downloaded games.

 

I.e., a published game where I can have anything in the Mods subfolder of my game's folder, where all of the contents (including subfolders within Mods) override the normal "vanilla" Twine game. Manually or automatically - I don't care at the moment.

1 Answer

0 votes
by (159k points)
The answer greatly depends on things like: the level of JavaScript support of the story format you are using; what parts of the game you want to modify; how meta data driven your game is; etc...

For most games the simple answer would be: No.

If howevery your game is: heavily meta data driven: based on a story format with an extensive documented JavaScript API; designed from the start to be modified; and you don't want to add new Passages to the game; then in theory you could try the following.

1. Add a known externally stored JavaScript file to your game whose contents is processed early in your game's startup sequence.

2. Structure your Mod so that it has it's own startup JavaScript file, which is responsible for loading and appending the mod's meta data to the main game's meta data.

3. Create a utility that knows how to manually inject the name and location of the Mod's startup JS file (from point 2) into the known external JS file of the game (from point 1), this should allow the known external JS file to process the mod's JS file during the game's startup sequence.
by (63.1k points)
As above, you can theoretically make anything moddable, but Twine and its formats, and the browsers they run in, are not really made for runtime modification; you'd need to build it all yourself, and you'd need to figure out how to handle browser security in the process.
...