I want to make an easy to use browser-based game editor, which simply allows you to import some resources (models/audio/etc) and lets you make scripts to make things happen. Databases, collaboration, anti-cheat and server hosting all get automatically managed by the editor. I want this engine to be as easily maintainable/upgradable as possible, so I can always stay on edge performance wise.
As a part of this plan, I want a simple to learn scripting language which has library binds to babylon (which will be doing most of the hard work). This means I only have to maintain the language and some server stuff, the content gets created on top of the hood using the custom language itself.
What I’ve found so far:
Lua (my most likely option, but lacks flexibility)
Typescript/C/C#/etc to WASM compiler (I want to be able to customize the language for simplicity)
Eclipse xText (not sure if I can compile this to wasm, but seems ideal)
LLVM (way too ambitious)
I am wondering if anyone else has ever tackled the problem of making a custom (in-browser) scripting language, or if anyone knows any alternatives to the ones mentioned above. Any advice or feedback is welcome, thanks for any help!
Sounds interesting! Curious though, what are your security concerns with a JS interpreter? The BJS PG does essentially that same task and AFAIK there aren’t security issues with it.
Have you considered going with a custom DSL (domain specific language) instead of full blown scripting? A DSL has the advantage of being totally defined by you to do exactly what you want (which is also the problem with it!)
With regards to scripting, the Roslyn C# compilers and source generators make it very easy to do what you’re describing. If you’re looking in that direction, it’s worth checking out.
I think you’ll need to decide what balances ease of development with granularity of control for your users; should users have to know or think programming or is a Roblox style of development what you’re aiming at?
Ola, in regards to my security concerns, see this quote;
I think DSL is what I am aiming for. The main one I found for this was xText, Roslyn C# seems interesting, and I’ll make sure to check it out. In the end it should just be a relatively barebones language (think Lua), but that has enough control to modify/extend it when needed. (I also kind of dream of having it be type-based for a better workflow)
Aside from making the language, it has to work in a browser though, thats also a hard part of using a custom language
I tried something similar a few years ago. At that time I wanted to build an editor with which you can automatically build a 3d configurator including GUI. I quickly moved away from webassembly, more about that in a moment. To build a browser based editor I used Retejs and Blockly from Google. After a while I dropped this project, because it doesn’t fits my customer needs.
To build a DSL I recommend Jetbrains MPS. We once had two consultants in our company who presented it to us. It was pretty impressive, but my boss at the time decided that we didn’t need it
If you need some further information, feel free to contact me
Thank you for all this insight! I’ve actually just started following a free course about MPS, it looks like it has a lot of potential. I really hope I can make an interpreter with it though, as I realized that compiling a language server-side is slow.
Okay, you are webassambly fan But before you start a project that you never get finished within 3 months (this is the time when most people quit, because it starts to be get boring ^^), look how others solved the problem to create a game engine or something like that. Unity 3d i.e. took Monogame as their environment and used C# including the toolchain as scripting language (with just a lexer, a parser and a compiler you are not finished - you also need an editor, a bundler and some other things). This had two advantages:
They were able to completely focus on building new features for the game developer
C# was a widely used and accessible language, which made the entry easier for new developers (no one really wants to learn godot script )
The success proves them right So I recommend you to use an existing language with toolchain, which can be compiled to webassembly. May be here is something for you, which you can use:
I love C#! As I mentioned in the post, I really want to do as little work as possible and don’t mind using existing solutions. That said, I havn’t found a language yet that quite hits the right spot and being easy for non-programmers to pick up/teach. I really do need strong control over this language as the entire game is built around it. “They were able to completely focus on building new features for the game developer” in my case, the programming language is what offers most of the features, so im quite positive the work put into it is worth it.
That said, I do agree with everything you’re saying, ill definitely be looking around more for existing solutions, this is such a complex topic