How friendly is Unity with allowing game plugins?

We’ve finished conceptualising a game that relies heavily on being able to modify it in different ways.

  • Textures, sounds, models and other files.: Needs to be loaded from a folder-structure, which path can be changed at runtime. (kind of like resource packs in Minecraft)
  • Code changes: They need to be able to overwrite, negate or add code, to change core game mechanics.

The first one, I assume should be fairly easy to overcome. I know there’s a runtime model importer, textures, sounds and other files should be fairly easy to import as well.

However what I don’t know if Unity can handle well is changing how the game works. Some things are easier than others and can be accomplished by a simple event system. E.g. a God-Mod shouldn’t be harder than listening for the “onPlayerTakesDamage” event, and either cancel it or make it do something else. But what if a player wanted to make a new mob to the game with it’s own mechanics. Or change the main menu, or change the path-finding of an existing mob?

Does Unity allow for this kind of detailed modding? How difficult would it be to accomplish? And what about multi-platform? Obviously mods can’t be made on every platform, but it’s important that they can run on the supported platforms. PC, Mac, iOS, XBOX, etc. etc. These use different programming languages, e.g. A common suggestion is to use .dll files? But .dll files won’t work on a Mac for example?

We’re currently trying to find the best suitable engine or base, to create this game on.

The Mods has to be written as additional files, even if it changes the core mechanics. The source code itself shouldn’t have to be changed. It’s also important that the potential modder isn’t forced to use the Unity engine itself to mod the game.

Does something like this, need to be written from scratch in e.g. Java (and loose some platform abilities) or is it possible to use an already made engine like Unity 5 or UE4.

Thanks for your time.

It is something you would have to build. Modding is so much about the engine and more about you set things up. You could leverage Unity’s assetpackages, at least for content. But really, its all about structure, and structuring in a way that allows modification (modularity, etc). Sure it can be done in Unity (or any engine really), but it is dependent on the developer as to how it will ultimately work.

1 Like

Thanks for the reply. I havn’t looked much into it yet. But isn’t the Unity assetpackages for pro licenses only? Of course we’ll have one. But potential modders should not have to pay to mod the game. And in general I don’t like the idea of modding a game like ours with Unity. - It’s a really simple game, and modding shouldn’t require anything besides a texteditor.

So modularity, we’ve talked a bit about how to best go about it, and it’s entirely possible to make almost every aspect modular. However, how does Unity handle “scripts”?

After we compile the game. There won’t be any .cs files with our C# code. So how can we allow anyone to add “scripts” to the game after it’s been compiled?

can an already compiled unity game run C# scripts from a simple path?

I saw another mention of Lua Scripting. While that’s probably a great tool. Lua isn’t exactly “efficient” enough when it needs to be able to change core game mechanics, including e.g. how the world is loaded.

Thanks for your time!

In Unity 5 everyone have the same features so no problem with asset bundles. Lua is very powerful and the efficiency or flexibility of it depends more on what you implement it to support. Same goes for the C# code that you need to design the way you want to support scripts. You can see short overview how Cities Skylines does it

http://www.skylineswiki.com/Modding_API

1 Like

Modding is primarily focused on storing data and settings for your game in a format that can be altered outside of the compiled executable. So you would need to load in external files into your game during the start-up process and parse them for data.

Unity can actually be fairly good for this if you know what you’re doing. A component architecture can allow for some fairly robust and flexible gameplay based on simple settings. I wouldn’t expect to allow your modders to perform advanced logic though. That sort of thing usually involves providing the source code of your game for re-compiling. In the case of Unity, it would require providing the source project.

1 Like

Perfect! Just what I was looking for.

Didn’t know you could “simply” ship a C# compiler with the game, and compile it.

Can this be done in runtime? Meaning, before the asset is needed. E.g. can I find and compile these files after showing the “MainMenu” scene. But before showing the actual “Game” scene? When I won’t be using those assets until the Game scene loads. Or would we have to compile it before the game can launch at all?

Thanks!

Thanks for your reply! :slight_smile:

I don’t mind providing the source code. It’ll be a free game anyway, and they’ll need to see exactly how things are done to change those core mechanics. But giving them a unity project feels off. Unity is made for making games. Not modding them. Modding tiny games shouldn’t take a game engine. Just small script files.

Yes, in cities skylines you can include c# files in mods and the game will compile them at runtime. So there is no reason why you couldn’t do the same

1 Like