How to link the godot engine to new windows ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BlackWave42

Hey there,

My question is a bit tricky, and will probably need knowledge to poeple who understand really well the engine.

I am currently gathering information to create a C++ Module to create new windows as if they were nodes into the scene tree. I figured out how to spawn new windows and new OpenGL Contexts into those windows, but I could not figure yet how to inject the engine in that new created context. Once that done, I think I could manage to have a dinstinctive view into that new window, but I need that critical link…

Anyone an idea ?

PS: I already looked into the os classes, but I did not really understood what’s going on to inject the engine…

Maybe spawn another instance of the game and communicate via (localhost) network/multiplayer?

wombatstampede | 2019-05-24 09:24

The idea is actually just not that. Because, by doing this, you will really soon be limited by the ressources of the computer as it will have to run a complete game engine multiple times, in addition to a local server. That will completely kill the perf of the computer.

The idea is to create a new window, a new OpenGL Context, and then in that window, run a new Viewport node. Like that, there is actually no other instance of the engine running, and information will be shared faster and easier, and the processor will be less busy. That would allow the game to use more ressources in its graphics, AI, or gameplay.

Your solution is probably the laziest, and the quickest to implement. If someone has a light game and the need for 2 or 3 windows, it would work well. But I am more into performance, and I do not see how to link a new Viewport node into a new window…

BlackWave42 | 2019-05-24 12:17

:bust_in_silhouette: Reply From: Jowan-Spooner

Hey BlackWave42, I don’t know the answer to your question, I just wanted to tell you that they are already planning on implementing multi windows officially until at least 4.0. Nevertheless it would be really cool if you find a solution, good luck.


Thank you for this information. Do you know what is the release date of the 4.0 ? Because, multi-windowed game is actually the last feature I need in order to go on with my game dev…

And I think that I am getting closer… I’ll jump into the working of the visual server, and the details of the Viewport class, I think that I could find a way in a few weeks (without the implementation of course). I’ll then have to code and test. I will give some updates if requested.

BlackWave42 | 2019-05-24 12:23

Of what I have heard, 4.0 will need some time to be released. Probably a year or even more.

Jowan-Spooner | 2019-05-25 12:11