So I have been reading on the interwebs about mod support for video. I am doing everything correctly to my surprise, and now it is time to add some user scripting into my game.
I would looove to use JavaScript as my scripting language. This is because personally, I love the language(not as much as C# ha ha), and, and I barely get to use it. Lua would also be a great choice.
For JavaScript, I have seen things like JavaScript.NET, ClearScript, and Jint. For Lua, I have seen NLua and MoonSharp.
What would be the best choice here? And how exactly would I allow modders to create their files such as “extraObject.js”, and have the code inside that file be loaded after everything else, and execute the code in the file?
This is more of a discussion then question. I would just like to be directed as to what the most effective JavaScript choice would be, and Lua choice would be. And be directed as to how I would implement it into my game.
I’m only posting since you haven’t gotten any replies yet. I know basically nothing about the subject, but my wild guess is that you’d want to go with JavaScript, Lua, or maybe even Python, since those seem to be the more well known ones, so I’m thinking users would be more likely to be familiar with one of those. Definitely NOT VBScript, hehe.
I noticed there’s a $15 asset on the asset store called Lua Framework that uses MoonSharp: Unity Asset Store - The Best Assets for Game Making
Since they’ve already figured out the mechanics of it, maybe that’s the best option just because it may be the easiest?
You may have noticed this already, but the term “scripting” can get funky on the Unity forums, since a lot of folks refer to even C# programming as scripting (I guess because the editor calls it that). Folks often even call C# classes “scripts”, which is a bit of a pet peeve of mine.
Why thank you for responding. And also, when people say that all classes are “scripts”, it annoys me too ha ha. But I think I am going to go with JavaScript.NET. It is outdated/hasn’t been updated in 10 months, but it is very fast and easy to use.
The hardest part of all is writing my own API ha ha.
One of the easiest things to do is to allow users to compile a .NET dll and have your game automatically load it. Then your users could write in whatever language they want as long as it compiles to .NET, so they could use JavaScript.NET or whatever. You (the developer) would have an easier time writing the API as well since you’d just need to wrap/expose parts of your code rather than creating a whole separate layer.