Loading a Godot game from another Godot game.

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

I have a game that I want to load, from the menu screen of another game (mini-game)

When I try change_scene() or change_scene_to(), it tries to parse the string path to the current directory.

I’ve looked into the Directory object in Godot and I get how to call the directory and the items inside. But I don’t understand how to opening a whole different game from it’s main scene and switch the directory that the initial game is using. I feel like it’s simple and something I’m missing, but I can use some help.

Thanks a bunch!

:bust_in_silhouette: Reply From: AuthorSan

My question to your question is, why do you want to do that?

I have a game that I created and then I made another game. I want put them together via the menu screen that I’ve created in the second game.

Dumuz | 2020-08-24 06:10

Got it. I don’t know if you can call another application using GDscript. But you can definitely do it using c# .net library. I suggest you look into it and create a single c# script for this purpose. Export both the games under the same directory and then call the first game by providing the .exe path and close the second game.

This link should Help

AuthorSan | 2020-08-24 08:12

I appreciate the solution. I should have made it more clear. I want to still pass variables, such as the outcome of the players progress in the other game. Like score, if they won or lost the game for example. That way in the main game I can use them for other aspects of the game.

I know there is a way to call a directory in Godot, but is there a way to tell Godot to use that directory instead of the one it’s currently using?

Dumuz | 2020-08-24 16:28

Yes, you can do that with this method of using a c# .script. You just need to create a json file with all the data before closing the first game… and then use it to copy the data into the second game. This way you’ll be able to take all the progress of the first game to the second game.

AuthorSan | 2020-08-24 17:34

Gotcha. Godot is my first game engine and first time attempting script, so I’ve never touched C#. But I’ll look into this and let you know how it goes. Thanks for the tip. If it works out, I’ll hit best answer.

Dumuz | 2020-08-24 17:52