Opinions on an in-game programming language?


(/home/alkaline) #1

Hey there. I just had a neat idea that I’d like to try out during the later beta stages of Peacenet’s development - an in-game programming language.

My question is, what language and what features should it have?

What language?

I’m thinking about using an interpreted language - so C++ is out of the question. The language should support event-driven code and should be fairly easy to write. Which do you guys think we should use?

  • JavaScript
  • Lua
  • Python

0 voters

Features

What features should we expose to it? Surely it has to somewhat integrate with the in-game Peacegate OS. Should it allow user interfaces? Should they be run as commands? Show in the desktop as icons? How should the layout of a program’s UI be defined?


(Tobias SN) #2

Definitely add a way to run commands, and maybe even give some tools APIs to access.


(Declan Hoare) #3

I proposed something similar back when Peacenet was written in C#, and I thought the language should have all the power it has in the real world but with the language APIs all interacting with the in-game computer. Python has an inbuilt GUI library Tkinter which we could re-implement for Peacegate. We could also still use C# in-game. I hate to say it, but JavaScript is probably the easiest of the choices here to implement because it is designed to run in non trusted contexts and it has bugger all in its standard library.


(/home/alkaline) #4

The inbuilt GUI library in Python kinda scares me to think about re-implementing, mostly because UE4 has its own GUI system (UMG, which sits overtop of Slate) which probably works completely different from Tkinter from both a (UI) design AND API perspective. I don’t want to force either APIs’ conventions to work with each other if they happen to be different.

HOWEVER, if that did work, any python dev who knows Tkinter already knows how to write a program for the in-game OS.

Could be possible - Unreal does require mono for the editor to function properly because Unreal Build Tool uses C# files for its build config files, but I’m not sure if mono is required to install the engine itself (without the editor, build tool, etc) or how we’d go about hosting some sort of Roslyn runtime inside Unreal C++.

Still, C# isn’t that hard of a language to write, and we could literally just throw the user into vscode, vs2017, monodevelop or whatever their preferred editor environment is and they can code as if it was a .NET program.

Yeah, we don’t need anything to do with the DOM or any web crap inside a Peacegate program. We also don’t need more than the basic stuff in the language’s standard library because… Unreal APIs. Could just expose those. Moreover, event binding in Unreal is pretty simple to apply JS’s (honestly really nice) event syntax over-top of.

I kind of picture in-game JS’s APIs being similar to the APIs that get exposed to Blueprint in the editor.


(Declan Hoare) #5

I think I misunderstood your original post

These ideas would be great for a modding API. What I imagined for ‘in-game’ would be a scripting language you could write with the peacegate text editor, with nothing leaking from the game engine or the host OS. You could even distribute scripts to other players in multiplayer from within the game.

I agree it would be nice to not have any web crap in peacenet on principle


(/home/alkaline) #6

That’s what I was thinking too. We do not need a modding API because Unreal supports modding out of the box and if people want to mod, they can use the Unreal Editor (when we add support for that, possibly in beta.)

I was thinking of exposing Unreal APIs, things like string manipulation, regex, UMG, and things like that which are built into the engine so we don’t need to implement it ourselves in the chosen scripting language. Sure would be nice to do what we used to do in the ShiftOS days where we just say “this Lua function does this C# thing.”