Maaack / Godot-Game-Template

Godot template with a main menu, options menus, pause menu, credits, scene loader, extra tools, and an example game scene.
MIT License
283 stars 17 forks source link

Easier process to switch between Menus Template and Game Template #83

Open hsandt opened 1 month ago

hsandt commented 1 month ago

I found the Menus Template, installed it, then later found about the Game Template which adds a Pause menu.

So I removed the Menus Template addon, installed the Game Template and most references worked at first, and replacing the manual extends path from maaacks_menus_template to maaacks_game_template was easy.

Fixing all the menu prefabs, not so. I had to replace the OptionsControl script with the new one, but even then I'd get a bunch of broken dependencies. At some point errors stopped, I ran the game from the main menu, but it immediately closed.

I realized I was still using the old Autoload singletons so I removed them, and unchecked Project Settings maaacks_menus_template/disable_plugin_dialogues so the addon prompts me to recopy all prefab examples once more. It offered me to update the main scene to the new opening with logo, and the new autoload singletons were properly re-added.

Now the new main menu does work but I lost, as expected, all my prefab overrides, and I don't think I can easily revert my changes without breaking dependencies again. To be honest, I just tried and it's not that bad, I managed to bring back my local options sub-menu changes, but for some reason I can't retrieve the MainMenu changes themselves.

Well, I suppose the easiest will be to just copy paste the PauseMenu.gd, .tscn PauseMenuController.gd and InGameMenuController.gd and replace _game_ with _menus_ in references, rather than the other way round. Is this what you'd recommend?

For next project I'll think ahead which addon suits my project best. I may end up with my own Pause Menu for bigger projects too.

Since it's pretty edge case, I don't expect you to code a super tool to automate that, but if you have some tips on how to make the process easier (after I started working customizing the main menu), you can tell me.

I haven't modified that much of the main menu and I saved the theme as a separate resource, so I suppose installing a brand new Game Template and reapplying my changes manually could also be a solution.

Maaack commented 1 month ago

Well, I suppose the easiest will be to just copy paste the PauseMenu.gd, .tscn PauseMenuController.gd and InGameMenuController.gd and replace game with menus in references, rather than the other way round. Is this what you'd recommend?

That's probably the route I'd take, too.

Since it's pretty edge case, I don't expect you to code a super tool to automate that, but if you have some timps on how to make the process easier (after I started working customizing the main menu), you can tell me.

In scene files, if a UID is present on an ext_resource, it will be used to find the resource, and the path will be ignored. When copying scenes within the same project, but outside of the editor, something to keep in mind is that the UID's may conflict. The copying tool works around this by assigning each copied scene a new UID, and removes all external references to UIDs by replacing the regex uid="uid:\/\/[0-9a-z]+" (with an intentional space at end). This then lets the editor re-assign the UID that matches to the ext_resource path the next time the scene is saved.

All of that is easier to deal with when using an additional IDE with VCS to capture the changes that Godot makes to files under-the-hood. I personally use VS Code. (More of a tip for others; I got an impression you're already using an IDE).

And, more of a time-saving tip, but you can access the copy tool directly from the menu: image

hsandt commented 1 month ago

Thanks, I'll just add the Pause Menu manually this time but this shall help me when replacing assets, and in fact probably with other addons too. I also have big issues sometimes when upgrading an asset as Godot doesn't support asset script upgrade (you must remove them, breaking deps temporarily, then reinstall them and it can still cause broken references afterward), I wonder if this could help too.

I only use VSCode for heavy lifting like batch renaming, but I like it's embedded VCS visualizer too so I will open it for this kind of operations too.

The Tools menu will be useful to re-trigger the example copy, thanks!