FrederikTobner / tobot-engine

A simple 2D game engine built on top of SDL2
https://frederiktobner.github.io/tobot-engine/
GNU General Public License v3.0
2 stars 0 forks source link

Create new user interaction layer #33

Closed FrederikTobner closed 1 year ago

FrederikTobner commented 1 year ago

We need to add a new user interaction layer, because writing code in c++ sucks ass. We could either write a CLI tool to generate the code for the user or transpile the code from a different language. We could for example use ANTLR for that purpose and transpile files written in our own domain specific language, that is close to c++ to .cpp and .h files. Another possiblity is to use a language that integrates well with C++, like C# or Lua. We could of course also create our own scripting language based on Lox / Cellox

CLI

tobot add scene / game-object / text etc. tobot create example tobot build (--target 3DS) tobot test tobot analyze tobot profiler

Editor

A seperate editor would be another solution for creating tobot applications. The editor could utilize the cli tool in the background. The editor could support another domain specific scripting language or / and c++.

Lua

Another possibilty would be to use lua as the scripting language, because it is easily integrates with c++ and is profen scripting language.

ANTLR / LLVM

From a scripting language with a clike syntax we could generate the code in c++. Similar to how Unity utilizes C#. The transpiler could utilize the cli tool in the background to create the application.

C

C# offers interoperabilty with C++ and offers good performance. Additionally it is widely used in and outside of game development. Therefor using it would make propably make sense as well.

Custom Lox based scripting language

We could build our own scripting language using lox / Cellox as a template and call the scripts in our c++ example. We would need to provide some native functions for that purpose.

Carbon

Even though carbon is not even released yet we could use it as our scripting language latter as well. If carbon is ready when we create our sscripting layer we should evaluate this possiblity again, even though it propably won't be that easy to use compared to the other alternatives (excluding c++ - nothing is harder than this piece of shit 🥴)

TODO:

Add a new cli module / library with some basic commands and define architecure. Add a graphical editor that utilizes either our CLI tools or the other tobot libraries.

To define

jksevend commented 1 year ago

Maybe we can wait and make carbon the integrated language. But either way a cli would be awesome

FrederikTobner commented 1 year ago

I agree with the part about making a cl,i because creating such a transpiler would be long term project. But maybe we create something like that in the future and stick with the cli approach for now. We could even provide both options later. But we should at least define if we want our users to write the scripts in c++ or in another language, before we add this.

FrederikTobner commented 1 year ago

Added ideas to the tobot-engine architecture repo