Is it possible to create a game with Unity that is modable?

I’ve often wondered for a long time if Unity could be used to make a highly-modable game. Like the old Freelancer game with all its .ini files holding the declarations of the weapons and ships and so on that you could add or take thing from. Is this possible?

yes, anything is possible

–

Complete modability, so being able to change absolutely everything, basically means writing Unity 3d in Unity 3d. Or let your game ship with your project folder :)

–

3 Answers

3

If you’re making a game from scratch, you often write data files in plaintext, making them easy to open and modify. Likewise you have a folder full of FBXs, and so forth, which are easy to swap out. You can still find games like now, where you open the folder and can see the assets right there.

I believe Unity smashes up all the assets and data for you. Suppose you have public WeaponDataType[] Weapons; filled in using the Inspector. The finished game is going to have that compressed in with everything else. I think if you look at a build, the jpegs are all tossed together in a resources file. A pain to modify.

But, Mod means modify. It means there being any means to change the skins, stats, maps … by the end user. Just allow people to download your raw Unity project. Can’t get much more modder-friendly than that.

I don’t see why not. I’m not familiar with Freelancer mods, but if the type of modding you wish to accomplish would include the ability to load new, user defined assets on the fly after your application has been built with Unity, there are several things you could do to accomplish that.

You can use AssetBundles, but I believe that requires Unity Pro - so your users would have to have Unity Pro to build assets, probably not what you intend.

If you would like your users to be able to build assets without Unity, just with 3DS Max or Maya, etc., you’d then need to use some Unity utility script that could load models/textures/animations on the fly and populate your GameObjects that way. I believe there are some tools available on the Asset Store that can do this type of thing.

Yes, I have been able to do this with some projects of mine. The most fun and flexible way to do this is to do a few things:

  1. Embed Iron Python for the scripting language and hook into all the Unity libraries so that users can write code like “gameObject.DoCoolStuff()”

1.5) You obviously will need to read the custom scripts through the iron python interpreter and possibly strip / limit functionality

  1. Write an .obj file importer and add a mesh collider to it if it needs collision. This way you can dynamically load in peoples models, textures, materials, etc.

  2. Write an editor or .unity scene file (if serializing to text) parse/reader. I personally would go the rout of building out a custom editor as you can focus the controls a bit more and have less to worry/deal with. Obviously the custom editor is also a bit of work and you will need serialization of your own but meh, it’s fun!

Optional:
4) If you wish to have it so that users can download and upload their custom mods on your own personal server you will need to write some-kind of download / upload client that the users can browse through (or just make a website and have em download and go through steps [meh])