There have been a couple threads asking about a coding language for players on a server, not raw C# ofc.
I want to reignite the discussion about this, because i think it has potential.
I actually wrote a lexer/tokenizer in C# and am still expanding my little Expression’3’, but i think most stuff is still S&Box dependant (i don’t have access). I wonder what would be the most clean way of creating a E2 port (scary stuff) or a new language altogether.
My idea/feature list is:
- NO direct C# execution in any way (C#, from my knowledge, doesn’t have sandboxing) - server security is first priority
- Separate files for types/tokens/operators/modules
- Access levels (provide more proficient players with more fun stuff to make, and restrict new players from abusing it)
- As much flexibility as possible (modify/create/restrict functions/modules). Useful when making your own sandbox server - add server-specific functionality.
I might expand this later, if something comes to mind.
Also, as said, i am kind of new’ish to C# and would like any project organization tips for this. (thanks in advance <3)
Myself and thegrb93 are both working on (separate) Lua interpreters for s&box. I think he’s serious about creating a successor to starfall whereas my thing is just a shitpost at this point.
Some of my fondest memories of gmod are from dinking around in E2 so I’m glad to see another person interested in working on this kind of thing.
Why there has to be another (and probably worse) language?
It was a pain to move from E2 to Lua back when I was figuring out programming. C# already has everything, it is easy to learn and you can use all the knowledge you get outside of S&box, so why put a layer of pretty much useless and slower language like Lua in that?
You don’t get it.
C# Is great, but it isn’t safe to let any player on your server use it, at all. Gmod wasn’t only for friends goofing around on a local server with lua, and S&box will not be too. In C# you can’t just restrict someone from doing dirty stuff - no sandboxing functionality.
It won’t be as slow as E2 for sure. I don’t think Lua is the only option, it’d be fun to make something new, closer to E2, but more refined.
And we obviously need some kind of benchmark/cpu limit (memory too perhaps) with this, because noone wants a server lagging/crashing from the hands of a ‘particularly’ smart coder/player. OPs in E2, I think were a joke, because the only thing server suffers is cpu time, so i still have no idea why it has that.
Why can’t you? It’s your addon, you can do whatever you want. Instead of using the LUA language syntax, just use c# syntax.
And write a whole C# interpreter with it? Pretty overkill - but I assume you probably mean that it can be something more C#-like than Lua which would be nice.
I wouldn’t of thought it would be any different to building a system that uses Lua, You can compile C# on the fly at runtime also instead of building an interpreter and get errors back regarding compilation for an ‘in game ide’ sort of feel, can’t see why that wouldn’t work depending on what you can/cant do in sandbox. No idea if each player would compile others code client side or server side does it and pushes it to other clients though. Would be good to see how wiremod/e2 did it before
At least then the in game c# could translate to useful real world skills or even addon dev for the game itself.
I have really wanted to explore the idea of writing WASM bindings so users can bring whatever language they want to the table. Maybe in a few more years they will open access for people who were unaffiliated with garrys mod in the past.
Kinda strange bringing the old things to the new game.
E2 was fun and everything, but it was dependent on wiremod - dad of em all. It might be wiser to wait for new core addon to show up or discuss that addon or smth.
Because i’m sure that 90% of devs that created fun and cool stuff still being outside because of the queue and fnaf model importers. Game doesn’t have to be exactly like gmod. We can improve things a lot. I still waiting for spacebuild idea inheritor to be born.
Btw we still don’t really know how gamemod and c# works inside, so kinda strange thinking about lua and intepretor. Also don’t think about bringing in more languagues inside. It will create a big mess, always will. It’s not how quality works.