Exporting .cpp instead of .exe

I’m a bit curious about if is possible to export project from Godot 4.7+ as solution for Visual Studio with included engine, so it can be recompiled into DX12 App in Visual Studio?

I know the UWP was dropped from 3.6 onwards, I tried few things to get working ANGLE but it’s very picky about the things is working from Godot itself, such as materials only simple shaders get displayed, no warning or other logs pushed - maybe replacing ANGLE itself but out there is DX12 which is more modern and supported in latest Godot.

I know the Mono version(C#) exists but not sure how far is it from C++?

If someone could explain me this a bit, I’ll be thankful the difference between source of engine, compiled engine, export template, exported binaries.

I found in GDK this fastObj which works perfect in VM, Xbox, Sandboxes - loading also simple materials from .mtl

So to explain the terms:

The engine source is the code that makes up the engine, makes up both the editor and running game

The compiled engine (I think maybe you are thinking about the editor binary) is one version of that, including certain code that is specific for it. One interesting thing with Godot is that the editor is a Godot project itself, though with a lot of specific code, but it uses the same basic framework and components (like Nodes and Objects)

The export templates are the parts needed for the running game, but for any potential project, compiled from the same source but with a different configuration (excluding things that are editor specific), it is built for a specific configuration for the target platform, debug or release build, with our without C# support, etc.

The exported binaries use the export templates with some changes (in some cases all the change is that the file is renamed, but on some platforms there’s a lot more changes, like Android for 4.x which can be recompiled in their own way)

So exporting the project takes a compiled version of the engine and modifies this, together with the exported game files (usually as a .pck file), it expects a finished compiled template for the specific target platform

So for the question, would it be possible to export as source

The short answer is no, it’s not how the export process works

The longer answer is that it could be possible to do this, but it wouldn’t really change anything because the exported project needs a template file, and it can use any template file as long as it’s the right platform and version

Exporting as source would still require compiling that template version and modifying it to be the export data etc., so it would be more practical to build the export templates for the target platform itself

2 Likes

so if I can add to this how works then libgodot?

  • Compile Godot Engine as either static or shared library.

so is Godot in this role the engine or how is becoming library?

I’m not very familiar with libgodot but as I recall it allows you to run Godot inside another program, like a widget etc., by allowing some other code to wrap Godot instead of running it as an executable

It still requires compiling Godot but just as a library instead (might be a .lib or .dll file for example)

1 Like

so if I understand it, it could run under DirectX12 App solution calling for libgodot/samples/cpp_sample/src/main.cpp at libgodot_migeran_45 · migeran/libgodot · GitHub as Component?

Should be possible but not familiar with the DirectX12 system or libgodot really

1 Like

I see they demonstrated live debug from VSCode on MacOS to Android device, which itself start sounds like embedding into signed DX12 App should be easy.

1 Like

After digging around, I came to conclusion it’s too difficult for me to get it working.

So at least it be occasion to learn a more about C++ and start typing non engine game :slight_smile: .

If someone in future figure out UWP with DX11/DX12 please let me know .

1 Like

What you are trying to do doesn’t make much sense, from a technology and logical perspective.

What did you get working with ANGLE- doesn’t that just mean using Compatibility mode, what did you do different?

C# is very far from C++

As others have stated Godot zips up your imported assets and copies a “release template” into the same directory, the release template does not change much between games. Options like encryption and of course embedding the pack file will change the release template more, but ultimately the engine code remains.

I suppose the closest “export to c++” would be copying the godot engine source code instead of a release template. I have no idea why you would want to do this though. Or you mean you want to compile GDScripts into machine code? Like Unity’s IL2CPP which transpiles C# into C++, then compiles that into DLLs loaded in-game.

1 Like

I have tried multiple version of Godot compilations, export templates, compiled from source with scons.

  • Mac OS worked just fine, Parallels VM machine was slugish but inconsistent with colours while using GLES2, and target device Xbox recognised it but silently was back-falling to OpenGL ES 2.0 - even it wasn’t set in Project Settings as backfall option for GLES3.

I had look on that, it’s fairly big source code base ,so out of my limit to do this.

yes this be great if I could do this, in .dll

Would I need to build loader for those dll’s or is there existing method to do this?