#need help in merging multiple game projects in one main file

28 messages · Page 1 of 1 (latest)

dense pike
#

lol sorry this is kinda a very beginner question but im just v confused and i cant seem to find stuff on google,

so i made multiple minigames—whom I've all made separately, all of which i want to put in a main game file. So the game incorporates those minigames and i want them to be put in order. Is there any idea how i can mash them all together in one file? Thanks, this will be a big help :3

#

to preface i have been using godot for just 3 weeks LMAO

old oasis
#

You could make a new project and make a nice UI where all the minigames will be started from and then use OS.execute() to start each minigame. You'll need to provide all the games as well with the new project

#

I can make an example project for you later if you're interested :)

high pine
#

Part I: Migration

The 'Copy Everything' Approach

This method is the fastest option. However, it's also the one that is most
likely to run into dependency breakage issues (missing assets/scripts,
and/or broken scenes/paths/resources).

To ensure compatibility, make sure to keep your file path structure the exact
same as it moves from the subproject to your main.

(* Note: Even then, you may still need to rename and fix things by hand, in
some cases e.g. class/file name conflicts.)

The 'Selective Recreation' Approach

While it may seem a bit unpleasant at first, re-creating your scenes is
probably the safest option. On the bright side, your assets (images, audio
files, etc.) and scripts can be carried over safely (*) without needing to
do any extra work (*)
.

(* Note: if you're using custom resources, you'll need to keep their script's file
path structure to ensure compatibility.)

Part II: Scene Switching

The hard part is over! Switching between your mini-games is as simple as
calling:

get_tree().change_scene_to_file("res://<path to your scene>")

(Note: you can get any file path by right clicking on a file and activating
the 'Copy Path' action from the editor's file browser.)

It's up to you to decide how you want to implement your scene selector UI. If
you need something basic, you can always opt to just throw a bunch of
Buttons in a VBoxContainer.

Related Docs

https://docs.godotengine.org/en/stable/classes/class_scenetree.html#class-scenetree-method-change-scene-to-file

dense pike
dense pike
old oasis
#

when running it from the editor make sure that you have the directory constant in games.gd set to the path where your launcher will be

#

Once you have a build however you can place it inside a folder and create a folder for each game in there. Each game inside it's own folder needs to have it's exe and an info.json file which contains all of the details about the game like title and description. The final folder structure should look like this:

Launcher Folder
- Launcher.exe
- Minigame Folder
--- Minigame.exe
--- info.json
- Minigame2 Folder
--- Minigame2.exe
--- info.json
...
old oasis
#

JSON example:

{
"title":"Minigame",
"description":"This is my awesome minigame."
}
dense pike
dense pike
old oasis
dense pike
#

And last question, haha sorry for the numerous questions but can i put godot projects directly to these folders or do i have to just set them up scene by scene?

dense pike
old oasis
#

The info file is for any other type of info you may want to add for the game. It is parsed when the launcher starts and kept in the Games.games dictionary

#

So you can access it and view the info about any of the games

#

If you don't want to I guess you can remove it entirely but the loading function also has to be modified to not error when there's no info file

#

Maybe this could be done better but I just wrote it out quickly

dense pike
old oasis
dense pike
old oasis
# dense pike thanks sm ^^ < 3 !

pushed some new changes to the repository fixing some bugs and improving the loading a lot. I also changed the description to use RichTextLabel which allows you to use BBCODE if you want to add an interesting look. It also handles links.

dense pike