I am trying to evaluate some possibilities how we could make a moddable game. By “moddable”, I mean things like:
User created Levels
User created Models & Textures
User created Scripts and game logic
User created UI elements
Ability to replace existing things (Models, textures, scenes, UI, scripts) in the game with user created stuff.
At the moment, we have most of the game in the “Unity standard way”, by which I mean: We got some FBX files with textures and materials, linked in prefabs. We have tons of .cs files as scripts added to lots of other prefabs and the UI is a prefab/direct scene placement mess (as it used to be without nested prefabs… chrm ;)).
We don’t use AssetBundles (yet).
So, now I try to get my head around how this asset structure need to look like, if you want to support user-created content. Basically, I always end up with "we have to ditch everything and completely
create our own scene file system (creating some XML/JSON/whatever description files and creating scenes from scratch)
create our own prefab system (taking in some XML/… data files and building up GameObjects with Components and properties from scratch within code)
create an asset import pipeline (grabbing some C# import libraries for .obj/.fbx/.png/.animations!!)
implement/use our own scripting language (Can you load MonoBehaviours from Assembly.LoadAssembly anyway?)
create our own UI description language (or use the “our own prefab system” above, since then we could implement nested prefabs in a sane way anyway…)
Really? I mean… REALLY?
Couple of alternatives where I couldn’t find a (negative) answer yet:
Is the AssetBundle binary format documented somewhere, so we could create AssetBundles and then load these? This would at least save us the work to write our own resource loading pipeline
Anyone got the UnityEditor.dll and some binaries extracted from Unity installation package, so some parts of the pipeline could be used? Is that even legal?
What are the most moddable Unity games out there? I talked briefly to the guys from City Skyline (like 5 minutes only ) and it seems, they basically did indeed implement my list above :(. (At least for asset import system. And they used their own scene file format anyway, IIRC)
If everything fails, could it be an option to have the player download and install Unity - then provide some UnityPackage that sets up an AssetBundle creation tooling? Does anyone know anyone who did this before? Would still be very sad. I much prefer an in-game solution.
I’m not suggesting to open source your game. I’m asking – Do you really need free-form programmability in your game?
implementing a level builder and loading .obj files isn’t that complicated, nor is building a set of predefined behaviors that can be attached to items. Is this not good enough?
If not, then I have no real suggestion. Perhaps it would be possible to have the end user use Unity as your level builder, and create some editor helpers to generate asset bundles for them.
Might & Magic X Legacy is very moddable. Here’s a video tutorial:
Exploring their SDK should give you some insights about making a Unity game moddable with Unity itself. Using the Unity editor also lets mods be compressed asset bundles, with optimised data formats for everything. If you make the modding kit good enough, you’ll end up using it yourselves for any further expansions. Hint, hint.
TBH, this answer makes me kindof sad. Because it means, that Unity is indeed not “moddable by default” (i.e. its structures are really mod-unfriendly) and the developer has to do everything by himself.
Unity already has a level builder and already can load obj files and has the ability to script. So yes, of course, I can recreate these by myself. Did this before using Unity for another game. I was just kindof hoping, that I can actually use what I have with Unity instead…
Awesome, thanks for the tip. I watched the video, it seems they implemented their own scripting “language” (based on a simple trigger/list of predefined actions system), but by having the user download Unity editor, at least they can re-use some of the Unity toolchain.
Do you happen to know whether they placed all the game art as raw assets into the mod kit? Because as I see it - without some heavy-weight Unity editor scripting - that would be necessary to state sentences like “You can edit the scene like any other Unity scene”.
I am not sure we can open up all our art as raw resources to the community (also because the download would be awefull big). So does anyone know of a good editor solution, that stores the game assets as compressed AssetBundle but still allows the user to work kindof normal in the editor (means he can use the “normal” Unity editor to create prefabs) ?
Yes, I talked briefly to the dev from skylines. They basically bite the apple and re-implemented Unity (not really, but everything from my list above)
I only just managed to download it again, after hunting for a while for the package (https://static3.cdn.ubi.com/hmmxlegacy/hmmx_legacy_ModdingKit.rar in case you’re interested). It seems the game is sort of abandoned (the devs are making the next HoMM now, considering MMXL fully finished), and the opendev site is gone. Anyway, the archive is a hefty 1.65GB download, uncompressing to 3GB.
A cursory glance at the contents shows a crapton of CSV files, a few custom format asset files, models, textures and shaders for the example map and a bunch of custom assemblies with the meat of the editors + a decal system. I’m not sure how much of the actual game system is in there, but it looks like the editor stuff is its own world, and the CSV serialiser is probably key in the process, defining shops, quests, traps, events, dialog etc. The map editor basically prepares a grid and you try to make the terrain and walls fit around it, and a starting point is set somewhere in the middle of a grid square.
It can be done without exposing internals of the game, in other words, but you might need to adapt the game to use a lot of custom data assets.
Well, that is one way of describing the words “create your own asset management, prefab system, scripting language and resource loading”
But thanks dude for the info and effort. Downloading the kit now too. Also, Hessen is near my sisters place - maybe I go visit her some day and have a ring at Limbic’s door.
Finished the download too. I don’t own the game, so I can’t check whether some models are missing, but at first glance it seems, Limbic really put all their FBX and TGA files in raw format into the modkit…
I guess that’s the reason the modkit is 1.6GB compressed. Not an option for us
Unity is fully moddable, its limitation is your imagination. I have seen entire game engines made within Unity3d, though not as good as Unity itself (obviously) but means a fully moddable game is possible. Even code, you could write a simple language and processor to convert it.
It’s not an easy feat to implement, a big reason that large titles lack support for such a feature.
Overall, if I were you I’d sit down and write a list of moddable features and branch off into how could I achieve this?
Hope this helps out, it’s just my opinion and thoughts.
Yes, I admit that maybe my title was a bit provocative… . I know that - given enough time and effort - you can write anything.
The question is rather: How modding-friendly is Unity? Unity provides a ton of features and tools to import assets, create scripting, create editors and tools, build, compress and load assets and resources etc… but none of these features seem to help in any way to support easier modding. (Except if you go the M&MX legacy way and require the user to use Unity editor… which is the way we will probably go for.)
Yeah, it’s a bit of an undertaking. But apart from basically rewriting the entire foundation of the game, replicating every non-model/shader/sound type asset and creating a whole bunch of editors, it’s easy-peasy
I think you have many long nights ahead of you poring over the problem, but perhaps you can figure out a way that makes it a little more straight-forward to mod things. The more 3rd-party code you rely on for the game, the more annoying it becomes though, and the more you need to abstract like MMXL. Any insights you get from the process would be interesting to read though
For modding at the scope you’ve described, having your mod community use Unity as the authoring tool - probably with a bunch of editor extensions specific to your project - is the intended workflow.
Wow, thanks superpig for the confirmation… I already started to suspect that ;).
Is there any way of direct referencing (like in “drag something into MeshFilter’s mesh property”) to an asset that is placed within a resource asset bundle - but without providing the original resource?
I think what I’d try for this is to use the AssetBundle Variant system to make a ‘placeholder’ variant. Then you give people all the source assets for the placeholder variant bundle and have them reference them. At runtime, you then load their bundles but with the “real” variant of the assets instead of the “placeholder” variant.
yea, thanks superpig… I actually thought about that too, but that would mean, they don’t see the “correct” image/mesh in their editor, right? Also, they have to download the stub meshes again, although they probably already own the original game with all high-quality asset bundles right on their hard drive…
I was hoping for a solution, where we provide a mod kit, and the first thing the modkit does is asking for the installation directory of the real game. From there, it loads the original asset bundles published with the original game and loads meshes from them to show…
hm… Actually. as I write this… could that be possible in the editor with tooling already? Can you use an micro-tiny dummy asset to have a GUID/FileID link set in a prefab, but some editor tool loaded an asset bundle variant which replaces the asset rendering directly in the editor windows?
Oh I see - when you said ‘without providing the original resource’ I thought you meant without them seeing the original assets in Unity at all
You could write editor scripts that load the asset bundles from your game, and use them to ‘generate’ the placeholder bundle inside of Unity - using the exact same textures/meshes as the released game if you like. There has to be something in the Assets folder for them to reference, though, you can’t just directly mount an AssetBundle and have it appear in the object browser, have the contents by drag-droppable, etc. It’d basically be unpacking the bundles into their mod project for them to use (and you don’t have to unpack all of them, it’d work to just unpack the ones containing the assets they want to reference).
I have a question regarding Might and Magic X. I have Unity Personal version downloaded and installed. I’d like to mod Might and Magic X but I’m not sure how to get started. Does anyone have any information on this subject please?