What's your workflow for porting to another platform?

Godot Version

4.2.1

Question

I just finished a desktop version of a practice project and I wanted to port it to mobile, I’m new to game development, so my question is how does one go about it? What is the workflow? I thought of branching the project in two in git, a branch for mobile development and another for desktop, then each will be isolated and would not share scripts/scenes/assets between them(even though some of these would be practically duplicates of each other). Or, second option, keeping everything contained in one project and evaluate at runtime which scripts/scenes/assets to use depending on the platform, which is what I went with so far, but it’s increasing the complexity of the project significantly. If you are someone with experience on the topic, I would thank you for the help.

If the desktop version is already 100% finished, then branching can make sense, as it removes the possibility of accidentally breaking the desktop version.

If both versions are in development at the same time, then it’s best to have only one version, with just one set of scripts/scenes/assets, that can be exported for both desktop and mobile platforms.

2 Likes

I use the same project for everything. For platform-specific code I use preprocessor directives and OOP with inheritance. (GDScript still doesn’t seem to have this feature, but simple if-statements should work fine too)

For UI I usually design the desktop UI to be compatible with mobile right from the beginning. (no rightclicks needed, big buttons, fullscreen menus instead of small windows, …)

Mobile- and desktop-specific things (UI mostly, such as a control stick for touch screens) are stored in extra scenes and loaded at scene start depending on the current platform.

I think putting everything into an extra branch would result in more work. Godot is pretty good at scene nesting, so only editing and loading what I currently need works best for me.

3 Likes

This might be the best solution, I’ll try to apply it beforehand next time I start a project. Thanks.