User-generated content (UGC) systems in Unity

Hi all-

Has anyone built a UGC system around a multiplayer Unity game (i.e., allowing people to script their own game modes) and able to share advice on how they did it, challenges faced, etc.? Or else can point to resources to architect & execute such a system?

We’re trying to build a scripting system on our existing multiplayer game for people to make their own game modes using the mechanics in our game (we have strong conviction that people will be excited about this), and I’m afraid we’re out of our depths given the complexity of this.

Thanks!

take a look at onejs on the asset store, thats a nice way to make moddable stuff. Otherwise you could integrate some sort of LUA solution. Theres also miniscript which I believe is by @JoeStrout

Its important to know that anything like this that is basically compiling and running at runtime will always be slower than stuff you authored at edit-time and therefore there will be restrictions on what it can and cannot do (modding yes, making an altogether new game using user scripting less likely)

You can load assets dynamically at runtime using TriLib or what its built on, assimp.

I suggest looking into how to get any form of runtime scripting working (onejs would be my go to here), and once you have that working you can tackle the bigger problems of how this fits into your architecture etc.

We are tackling the same issue on our project but we have opted to create our own visual scripting tool as we aim at users that are of a wide age range (so we can have very young users make content if they want). For advanced users, we are providing onejs as a scripting solution.

You can also load assets dynamically from assetbundles at runtime, which is another option (you can have each bundle represent a pack of content or however works for you).

Good luck :slight_smile:

PS if you are not experienced developers this is a serious amount of complexity to add to your project, and even if you are, if you have not built this project from the beginning with these systems intergrated, you will be rewriting massive portions of your project in order to get this working. So I suggest weighing up how important this is for release vs adding as an update after release if it proves successful. Adding a system like modding very late into development can tank the entire project if you are not careful.

2 Likes

There’s Anyland, project Neos and VRChat that do that in VR.

VRChat created their own framework, called UDon, ANyland uses its own mini-language, and I forgot what Neos used.

Usually you’d want a heavily restricted and heavily sandboxes language for this so your users wouldn’t be able to write viruses. At the same time you’d want a possibility of visual scriptin for those people who won’t ever learn to code.

Aside from already mentioned lua, there’s wren (not sure if there are bindings for it, though) and probably many other languages.

You can let them use C# with Roslyn C# - Runtime Compiler.

1 Like

C# is both user-unfriendly and dangerous.

The asset you linked doesn’t say anything about sandboxing. That implies that there’s none, in which case game scripts will have free reign over user’s system.

I also had experience using C# as a scripting language in space engineers. It was an awful experience. This language requires IDE, and if built-in game has nothing on the level of IDE, the coding experience is quite miserable. And if you code scripts in external IDE, then it no longer feels like a game, but like work.

That’s why the #1 suggestion would be lua, wren or something similar.

1 Like

Page 14 of the user guide briefly mentions script and app domains. I’m not familiar with the terms so I don’t know if that qualifies as sandboxing.

https://trivialinteractive.co.uk/products/documentation/roslyncsharp/UserGuide.pdf

I don’t have the asset so I can’t verify.

Regardless, I do not recommend using C# for user-side scripting. It is heavy-weight, and because it forces everything to be wrapped into a class, the experience in general is awful. It is exceptionally unpleasant to work with from within the game.

What about a visual scripting system?
I don’t know about your requirements and goals however isn’t a bit weird we as game developers have and use a variety of visual scripting based tools (including some unity systems) and think to give players language based systems?
Years ago finding full featured visual graph-based tools in content creation software was a rare event, nowadays it’s common and I like it most of the times, of course not all tasks are suited for it. Programming for me is always a language based activity, if you rule out shader programming :smile:

Just my two cents.

As you said, programming is a text based activity, hence why when talking about user scripting it makes sense to mention a text based approach :slight_smile:

That said as I mentioned in my post, we are doing both on my team.

But yeah, a lot of modders would want an actual scripting API to mess with, not just some bespoke visual scripting tool (which in itself can contain bugs etc getting in the way of modders doing what they want to do). Not everyone likes visual scripting. If I had to only have 1 I would go with scripting, its only as we are supporting multiple options that we are adding VS. If we hit delays, we VS is first thing that will be cut from our project.

No intention to criticize other solutions, surely it makes sense to mention and consider a text based approach, infact if someone asked me about a scripting system for modders I would immediately answer LUA or a different scripting language, it’s common in games as Python in software where a certain level of control is exposed to users, like Blender or Gimp.

However what made me think of visual scripting and graph-based tools is on the one hand the OP mentioning user-generated content (maybe they are interested in procedural content generation? do they need in game asset creation or an external level/asset editor?) and on the other hand the fact that’s usually simpler for the general player, I’m surely not stating that its development would be easy but that may be useful.

What path to choose depends on the OP, their game type, target audience, studio resources etc. all things I can’t know.