Can You Limit a Game’s Mods to Only C# with WASM?

0
4
Asked By GameDevNinja123 On

Hey everyone! I'm developing a moddable game and I've chosen to use C# compiled to WebAssembly (WASM) for mods. I'm curious if there's a way to enforce that users can only use C# with WASM and not other languages that compile to it. The idea here is that it would make it easier for users who want to refer to other open-source mods. I understand this kind of goes against the flexibility of WASM, but I'm struggling to find a good language that meets static type safety, sandboxing, and supports object-oriented or procedural programming. Any thoughts?

4 Answers

Answered By CreativeCoderX On

It's kind of like saying you can only use TypeScript for JavaScript on your website; it just doesn’t work that way. Instead, consider laying out clear expectations in your API so it maintains certain structures, but allow for different languages to interact with it.

Answered By TechGuru89 On

Unfortunately, you can't really enforce a single language when it comes to WASM. Each language that compiles to WASM should function the same way, so it wouldn't matter if it's C# or anything else. The underlying WASM code is just an instruction set that doesn’t differentiate the origin, similar to how CSS can come from different pre-processors and it's still CSS at the end.

Answered By WASMWhiz On

You can't impose restrictions directly in the WASM layer itself. The solution is mostly about controlling the environment where the WASM modules run. If you ship your game with a specific C# toolchain and make your mod loader check for that, you'd effectively guide users to stick to C#. This way, you retain the benefits of WASM while limiting the languages used.

Answered By CoderDude42 On

Nope, that restriction isn't really feasible. You might think about adding some metadata to your WASM modules to indicate they were compiled from C#, but that can be easily bypassed. Plus, if users have the freedom to choose their language, they'll usually pick what they know. Forcing them to switch might just turn them away altogether. Instead, just focus your documentation on C# to guide them!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.