BattletechModders / ModTek

Mod system for HBS's PC game BattleTech.
GNU Lesser General Public License v2.1
121 stars 34 forks source link

Mod Support Wishlist Draft #131

Closed mpstark closed 5 years ago

mpstark commented 5 years ago

BattleTech Mod Support Wishlist

The following is a wishlist collected from the modding community for what we'd love to see from HBS with regards to official mod support -- it is certainly not meant as an exhaustive list of demands and we understand that not every question can be answered or every feature implemented. We love the game and we're excited at the potential prospect of built-in mod support.

ModTek High-Level Summary

Mods are located in the BATTLETECH/Mods folder, each containing a mod.json file that contains mod metadata, dependencies, assembly information, and a content manifest. ModTek generates the load order from dependencies and optional dependencies, but it can also be manually specified -- this load order is very important for JSON merging and assembly dependencies. More documentation on mod.json is here.

For mods that specify an assembly, that assembly is loaded, and the specified entry point is run (if not present, ModTek runs all matching public static methods named Init). The library Harmony is a large part of how most mods and ModTek itself functions; it is described as "a library for patching, replacing and decorating .NET and Mono methods during runtime", and it is provided under the MIT license, and written by Andreas Pardeike (andreas@pardeike.net). An example mod is built here using ModTek and Harmony.

For mods that specify a manifest (or have a mirrored StreamingAssets folder), that content is loaded, merged with the vanilla content if applicable, added to the MetadataDatabase if needed, then either loaded into BattleTechResourceLocator's internal dictionaries after RefreshTypedEntries is called or patched into various places to be called by the game. Some example mods that change game JSONs are built here.

ModTek is provided under the "Unlicense", which is to say that the code is completely free-to-use for any reason with no attribution or licensing stuff required -- this was always meant as an open invitation to HBS to include code from ModTek. If anyone has questions about ModTek, the GitHub or the BATTLETECHGAME Discord are both good places to reach the authors.

Highest Priority

In addition to what ModTek provides, these are the features and changes that we consider most essential.

Mod Installation and Selection

Mods should be able to be installed/updated (from a zip file perhaps?) and toggled on and off by the game or a pre-game launcher. One of the largest support challenges for the modding community has been the seeming lack of user basic knowledge about file system tasks like moving and deleting folders -- providing a centralized system to cleanly install/update/uninstall mods would eliminate those support problems for the most part.

Saves

If modded content is included in a save and then the mod is removed, the save is now broken until the content is restored. "Cleaning" saves by removing content that is missing would be a huge step forward, particularly if user is informed that content has been removed.

More involved solutions for save game dependencies on mods, such as tagging saves with mod dependencies or currently active mods, would be appreciated, but we consider this solution to be the highest-priority with the lowest-effort required.

Enums

Currently several very important enums affect adding mod content to the game since it is impossible (as far as we can tell) to add to the enum at runtime using Harmony, reflection, or other means and the fashion in which enums have been used in the game code is non-generic and hard to override. Currently the ModTekInjector supports adding additional factions to the game at inject time, as this is a direct requirement for adding additional factions into the game.

Example Enums Blocking Mod Content

DLC Content

Currently DLC content is locked away in the asset bundles, preventing handling it like any other content, namely merging on-top of the JSON. If that content could be moved outside of the bundles, perhaps in a folder specifically for the DLC that is only installed with the DLC, that would enable better modding of this content.

Lower Priority

Preview Access to Upcoming Game Builds

Many games have test builds that is accessible to the public through the Steam/GOG beta channels. This is doubly useful for modders, as it allows them to test against upcoming patches as well as provide feedback on the builds themselves.

Adding Models/Prefabs

Currently 'Mech modeling/importing into the game has large blind spots. Providing a 'Mech asset bundle shell complete with script links and a properly populated animation controller to guide the creation of new bundles, would help fill in those spots. Additionally, community efforts to adding vehicles has been hindered by issues with getting the turrets to turn properly without distorting the model, it would be nice to get guidance or an example asset bundle shell for them as well.

Other questions from the model community:

Mod Settings

The ability for mods to store data into game saves (both combat and sim) and user profiles would solve many issues. The current ModTek solution of having user preferences stored in the mod.json file is very problematic, and other mods have to resort to maintaining save state data in their mod folder.

Just having access to the user profile data store would be enough for most mods.

Mod Settings Menu and other UI Woes

Many games with mod support provide a menu system that can be hooked for mods for users to configure settings. BattleTech already includes some generic widgets for use in the difficulty settings. Providing a similar system for mods would be amazing, particularly if it could tie into the mod settings request above.

A potential implementation would be a 'Mods' section in the settings menu that when clicked opened a mod settings menu that had mods listed in the left sidebar and the selected mods settings displayed on the right. Each mod would instantiate a generic prefab for mod settings based on SettingsModule and fill it in with settings, again, much like the SimGameDifficultySettingsModule does with SGDSToggle and SGDSDropdown.

In addition, Unity's UI system is very hard to decode and mod without access to the Unity project or knowledge of the existing prefabs, and some guidance here would be appreciated. Even just a list of already existing generic prefabs that could be repurposed and retooled by a mod at runtime would be a blessing.

Modded Multiplayer

Two players with the same set of mods enabled should be able to play PvP with those mods active. If a discrepancy is found, display an error message to both users if one is missing a mod, or their modded files don't match. Keep the current level of PvP data validation, this allows separate modded AI's to fight each other or one player as they can currently. If all mods were checked, that capability could be lost.

Steam Workshop / Paradox Plaza

While the BattleTech community is split between GOG/Steam/Paradox, it would be friendly to users to provide an install path through Steam Workship/Paradox Plaza. HOWEVER, we do not wish to split the community up by locking users out of mods hosted on a particular site -- it has been mentioned by other mod communities that users can download Steam Workshop mods without the game if Steam is setup with "anonymous game server downloads" allowed.

Less Private/Internal Classes and Methods

While Harmony and reflection provide ways of getting around access modifiers, this is inconvenient and opaque. Making interesting classes, methods, and properties public would make mod code easier to read and maintain.

Wishful Thinking

Terrain/Map Modding and Addition

Currently, adding additional maps is considered impossible, and modding existing maps extremely difficult. Some insight to how to achieve this would be appreciated, or even better, a standalone Unity project and toolchain, even if that requires modders to purchase Unity Asset Store licenses for tools like Gaia. This might be the most difficult (and potentially unrealistic!) of these requests -- but it could have the most long term benefit for the game, as map variety is something that many long-term players have commented on.

CptMoore commented 5 years ago

I also would say to maybe have a mod installer as part of the launcher? Special zip with ending for easy installation? Dont want people to have to use finder/explorer/nautilus to search for a mod folder. Also zips, so there are no left overs if one installs a new version of a mod with fewer files inside.

Amechwarrior commented 5 years ago

Modded PvP Compatibility

Two players with the same set of mods enabled should be able to play PvP with those mods active. If a discrepancy is found, display an error message to both users if one is missing a mod, or their modded files don't match. Keep the current level of PvP data validation, this allows separate modded AI's to fight each other or one player as they can currently. If all mods were checked, that capability could be lost.

Amechwarrior commented 5 years ago

Mod Load Order, with Optional Dependencies

Currently, ModTek allows loading order dependencies for mods that need other mods to function. Both required dependencies, that will load before the mod relying on it, and optional dependencies for mods that can work with, or without others present but need a certain load order to work together.

janxious commented 5 years ago

Currently several very important enums affect adding mod content to the game since it is impossible (as far as we can tell) to add to the enum at runtime using Harmony, reflection, or other means. Currently the ModTekInjector supports adding additional Factions to the game at inject time.

The issue is not the enums per se. It is the way they are used. Since they are used directly (which I understand is partially due to convenience with Unity), editing their call-sites is difficult, and overriding what is happening with those is difficult because the assembly will inline the enum values instead of using named methods.

GentlePayload commented 5 years ago

Would love to see an assetbundle shell complete with script links and properly populated animation controller to guide the creation of new bundles creating new.

bloodydoves commented 5 years ago

I would echo what GP says above: an assetbundle shell that we have more control over the entries for would be fantastic and would allow us more freedom in bringing in new assets. Additionally, I might be interested in seeing if we can make it such that non-weapon itemdefs can call models from the bundles (example: let us call an AMS prefab with an upgradedef and have an AMS model appear in-game).

ghost commented 5 years ago

I also echo both GP and BD, that would be awesome sauce.

JustinKaseToo commented 5 years ago

Could potentially tag game saves with 'active mods'.