godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.14k stars 93 forks source link

Encourage setting a "unique name" at project creation to simplify Android/iOS export for first-time users. #9989

Open FFF27 opened 3 months ago

FFF27 commented 3 months ago

Describe the project you are working on

An open-source cross-platform video game with a relatively common name.

Describe the problem or limitation you are having in your project

The other contributors were confused by the choice of iOS/MacOS "Bundle_Name" and Android "Package.Unique_Name" and ended up using the default value of "org.godoengine.${genname}"

This resulted in an issue where I was unable to install the game on my phone because an existing app was using the same package name.

I expect this may improve slightly by the change of "com.example.${genname}" as default package name but many first-time users will use the default for settings they do not understand.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

When creating a new project, ask the user to set an optional "Unique Name" for the project and explain how to correctly choose that name, including examples.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

On the "Create New Project" dialog, there is an additional field "Unique Name" with the default value "com.example.${genname}" and the following explanation:

""" Required for mobile and macOS export.
This name should be based on your Project's web address with the domain part reversed. https://www.godotengine.org -> org.godotengine.editor https://your-user-name.itch.io/your-game-name/ -> io.itch.your_user_name.your_game_name """

The "Unique Name" field should update in real time as the user enters a project name. be clearly optional and easy to ignore because many users don't need mobile support.

This value is saved in project settings as "application.config.unique_name" The default "export_preset.android.options.package.unique_name" will be "${unique_name}.android" The default "export_preset.(ios|mac).options.application.bunde_identifier" will be "${unique_name}.(ios|mac)" Any plugin that requires e.g. a unique C#.NET "assembly_name" may also use this value where appropriate.

When upgrading a project from an older version of Godot, the user will be prompted to set a unique_name when they perform a mobile or macOS export. This prompt will include a checkbox to allow for update existing export presets, and a warning that they should not update the name if the project has already been published to an App Store.

When changing the unique_name in the project settings dialog, the same warning will appear.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This problem is trivial to avoid if you are aware of its existence before publishing a project. Changing the package name after the fact requires all existing mobile users to reinstall the app, losing their user:// data.

Is there a reason why this should be core and not an add-on in the asset library?

This is a user education issue. Users who are unaware of the problem will not install an add-on to fix it.

AThousandShips commented 3 months ago

I worry that this will be too much details to put in when just creating a new project, especially for beginners, it'll easily overwhelm by forcing a lot of decisions on the user without knowing anything about what the user wants

I'd say the time to prompt this is when the user creates an export for the relevant platforms, only then can we be sure they are at all interested in exporting for those platforms, and you might not even want to name things in this particular way or use the same name etc.

Calinou commented 3 months ago

The other contributors were confused by the choice of iOS/MacOS "Bundle_Name" and Android "Package.Unique_Name" and ended up using the default value of "org.godoengine.${genname}"

This name should already be unique because ${genname} is automatically replaced by the project name (with illegal characters being stripped to make it a valid identifier). The only situation where you might get a conflict when not changing any settings is when you create several projects with the same name (e.g. leaving the default "New Game Project" or using an empty name). We could sidestep this by appending a random string to "New Game Project" (e.g. "New Game Project 4F12"), but this might look strange to users.

org.godotengine was also replaced by com.example since 4.0.

FFF27 commented 3 months ago

@AThousandShips

I'd say the time to prompt this is when the user creates an export for the relevant platforms, only then can we be sure they are at all interested in exporting for those platforms,

I'll grant that. I do think the field should be optional.

and you might not even want to name things in this particular way or use the same name etc

"People might want to use completely custom settings" is not an argument against setting a default that better serves the average user.

@Calinou I am aware that 4.2 uses com.example as default, but I have seen .jars with com.example.* in the wild.

${genname} is only as unique as your project name. Less so, in fact, since it strips spaces. It is marketing best-practice to give your project a unique name, but search for "Calculator Plus" on Google Play, search for "Dog Game" on itchio, search for "Calendar" in the apps pre-installed on a factory-new Samsung phone!

AThousandShips commented 3 months ago

I'll grant that. I do think the field should be optional.

That won't change that unless it's under some advanced tab, it will still be overwhelming, a new user won't know what's obligatory or not, I'd say the VCS field is a bit overwhelming for new users

FFF27 commented 3 months ago

Git can be completely ignored and won't hurt anyone. The Engine selection is the truly overwhelming part. Put like that, the "New Project" experience needs to be completely reworked.

mockup Something like this, with e.g. unique name appearing only if mobile is selected. But that's beyond the scope of this suggestion

FFF27 commented 3 months ago

I do see the point of having the "pop-up when the first mobile export is added" as the primary (or only) experience.