Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic checking for engine updates #75916

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented Apr 11, 2023

Closes godotengine/godot-proposals#1132


The PR adds update checks in a form of a label on the bottom of Project Manager and editor. See #75916 (comment) for more images.

The update checker will check for newer version and tell you when one is available. Clicking the button will open the download page for this specific version. The checker can check updates in 3 modes: "Newest Unstable", which checks for newest official version, "Newest Stable", which checks for newest stable version and "Newest Patch", which checks for the newest patch of the current minor version. "Newest Stable" is the default for stable versions, "Newest Unstable" is default for preview versions.

Note that updates are disabled by default due to network mode being offline by default. There is also a setting to disable updates separately from network mode.

For version checking I'm parsing the version YAML from Godot website. The editor will make many assumptions about structure of the file (such as it's sorted from newest to oldest version), so hopefully it won't change 😅

You can test the PR by modifying version.py file. Compiling with allow_automatic_update=false scons option will disable the dialog completely.

@Calinou
Copy link
Member

Calinou commented Apr 11, 2023

Remember to add a SCons option to allow disabling update checks at build-time, as the Flatpak (and other Linux distribution packages) must not display in-app update notifications by design. It's expected that these packaging systems handle update notifications on their own instead.

@Saul2022
Copy link

This is looking pretty cool, but i think the check for updates should be only in the project manager and not in the editor as it can be distracting as users could enable it by accident there. Also maybe an option to replace the current version with the newer one so you don't have to uninstall a old version you don't want to use for a more stable one.

@KoBeWi
Copy link
Member Author

KoBeWi commented Apr 11, 2023

This is looking pretty cool, but i think the check for updates should be only in the project manager and not in the editor as it can be distracting as users could enable it by accident there.

The popup appears on first launch and then only when there is an update available. Other than that the dialog will check for new versions in the background and you won't see it very often.
I added it in the editor too, because it's possible to open the project directly, and while probably rare, some people don't use Project Manager very much or at all.

Also maybe an option to replace the current version with the newer one so you don't have to uninstall a old version you don't want to use for a more stable one.

This is not that simple, because you can't replace an executable that is already running (at least on Windows). The implementation would be a bit involved. For now only version checking will be available; actual update can be added later.

@capnm
Copy link
Contributor

capnm commented Apr 11, 2023

This is looking pretty cool, but i think the check for updates should be only in the project manager and not in the editor as it can be distracting as users could enable it by accident there.

I think also for privacy reasons the connection to the Internet should be a by default disabled option and/or selectable in the project manager.

@KoBeWi
Copy link
Member Author

KoBeWi commented Apr 11, 2023

The dialog that appears is the same both for Project Manager and editor. Before making any HTTP requests it will ask you if you want to enable it (unlike AssetLib btw). The setting is disabled by default.

@capnm
Copy link
Contributor

capnm commented Apr 11, 2023

The dialog that appears is the same both for Project Manager and editor. Before making any HTTP requests it will ask you if you want to enable it (unlike AssetLib btw). The setting is disabled by default.

Why not just integrate the (annoying) dialog into the manager? Then you don't have to bother about dev builds, e.g.:
grafik
+ dialog - links / buttons ... below

grafik

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from 81fbdd4 to 9a454e0 Compare April 11, 2023 17:15
@KoBeWi KoBeWi marked this pull request as ready for review April 11, 2023 17:15
@KoBeWi KoBeWi requested a review from a team as a code owner April 11, 2023 17:15
@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from 9a454e0 to b9758b6 Compare April 11, 2023 17:24
@KoBeWi KoBeWi requested a review from a team as a code owner April 11, 2023 17:24
@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch 2 times, most recently from e3a2673 to ed31d9b Compare April 11, 2023 17:53
Copy link
Member

@RedworkDE RedworkDE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much traffic this causes, but I would probably work on a document just listing the interesting versions to minimize it and possibly simplify this PR a bit.

editor/engine_update_dialog.cpp Outdated Show resolved Hide resolved
editor/engine_update_dialog.cpp Outdated Show resolved Hide resolved
editor/engine_update_dialog.cpp Outdated Show resolved Hide resolved
@xix-xeaon
Copy link

I like being notified about updates. I do not like to be interrupted by dialogs. I think a passive icon should show up in the top right corner (or on the bottom, next to the display of the current version) when there's a new update.

@jordanlis
Copy link

I like being notified about updates. I do not like to be interrupted by dialogs. I think a passive icon should show up in the top right corner (or on the bottom, next to the display of the current version) when there's a new update.

I agree with Xix, even if I realize that this pop-up has been developed.
I imagined something way less distracting

image

The mockup is not perfect, but the idea is here.

Anyway, it's still a great feature that is really good, even in a pop-up.

@KoBeWi
Copy link
Member Author

KoBeWi commented Jul 28, 2023

Ok I have an idea how for alternative implementation (which is similar to above comments). This is what would users see by default:
image
The [ Auto-update is disabled ] (style TBD) would be a clickable button, which would open a dialog similar to the currently implemented popup. Until the user enables auto-updates, Godot will not do version checks of any kind.

If the update is enabled, the text will change depending on version status:

  • [ No update available ]
  • [ New stable version available: VERSION ]
  • [ New unstable version available: VERSION ]
  • [ Failed to check for updates ]

The stable/unstable text could have different tints. Failed text would allow retrying the check.

I'm not updating the PR yet, because the future of this feature is actually uncertain right now.

@KoBeWi
Copy link
Member Author

KoBeWi commented Feb 26, 2024

I pushed a WIP update. It does more or less what I described in the above comment:
image
Clicking it opens the version page in download archive. I also changed how version is determined using the YAML file from Godot website (my code makes many assumptions about it's format, but that's probably ok).

If the user is in offline mode, updates are disabled:
image

If there is no update:
image

Also this mostly works with official versions. In custom builds it can fail if it can't determine newer version:
image

I still have a cleanup to do and I plan I plan to add an editor setting. The setting would have 4 values: "Disable Update Checks", "Check Newest Unstable", "Check Newest Stable" and "Check Newest Patch".

Also the update checker is only in project manager right now. I will probably add it to EditorNode next to the version label, but it'st going to behave a bit differently to not take space.

EDIT:
Forgot to remove the old dialog. If you want to do a preliminary test, don't start the editor D:

@Calinou
Copy link
Member

Calinou commented Feb 26, 2024

The new button looks good, but I'd make the "Current version up-to-date" text gray like the offline mode text so it doesn't take as much attention from the rest of the dialog. Only "update available" and "failed to check for updates" should really stand out from the rest.

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from b275197 to e94e21c Compare February 26, 2024 22:42
@KoBeWi KoBeWi requested review from a team as code owners February 26, 2024 22:42
@KoBeWi
Copy link
Member Author

KoBeWi commented Feb 26, 2024

Ok I changed the up-to-date text:
image

Also added the update label to the editor:
image
However it will only be visible if it's currently checking for updates or an update is available. If there is an error or no new version, the label will be hidden to save space. In project manager it's always visible.

I also added the "Newest Stable" and "Newest Patch" update modes.
image
image
Newest Stable is the default.

With this the PR should be ready to go.
(ignore the inconsistent underline, I made it hover-only, but after taking the screenshots)

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch 2 times, most recently from c9e92e6 to 1275213 Compare February 26, 2024 22:52
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

However, when running a self-compiled development build, you'll always see this at the bottom of the project manager:

image

The red color can make people think it's an error, leading to false bug reports as update checking for these builds isn't supported by design.

To handle this particular situation (unnumbered dev/beta/rc builds), I suggest displaying a message in gray of the form:

Running a development build.

@KoBeWi
Copy link
Member Author

KoBeWi commented Feb 26, 2024

btw I just had an interesting idea. Say we merge this for some dev version. Since "Newest Stable" is the default setting, when a beta appears, users will still see that there is no update, which might lead to bug reports. What if the default was different for stable versions and unstable versions? This way if you have unstable version, you will get updates until stable, then in stable you will only get info about next stable, unless you again go to unstable build. Does that make sense?

@Calinou
Copy link
Member

Calinou commented Feb 26, 2024

What if the default was different for stable versions and unstable versions? This way if you have unstable version, you will get updates until stable, then in stable you will only get info about next stable, unless you again go to unstable build. Does that make sense?

Stable versions should only inform you about other stable versions by default, while unstable versions should inform you about unstable versions as well (while including stable versions).

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from 1275213 to c37ce8b Compare February 27, 2024 00:42
@timothyqiu
Copy link
Member

By the way, I think the network request should also utilize network/http_proxy/{host,port} editor settings.

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from c37ce8b to 704c311 Compare February 27, 2024 11:41
@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from 704c311 to e50c969 Compare March 7, 2024 00:17
@akien-mga
Copy link
Member

Tested briefly, looks good to me!

Small nitpicks:

  • When in offline mode, the message about it still has link styling, but does nothing. Would it be possible to make it open the PM's Quick Settings dialog to allow going online? (Or retrigger the dialog that asks about it maybe? Or was it a full screen thingy in empty assetlib?).

  • In self-compiled dev builds, it currently shows "Running a development build." as discussed above. That's fine when compiling latest master for dev purposes, but I wonder about users who have soft forks of the engine and might e.g. be still on 4.2.beta because that's when they branched off. Should we still check for newer dev snapshots or stable releases that are strictly newer than any 4.2.beta commit (i.e. 4.2.rc1 or 4.2.1.stable)?

  • I see there's a interface/editor/engine_version_update_mode setting which allows disabling the check, which is good. How about moving it to the PM's Quick Settings dialog next to Network Mode? For consistency with network/connection/network_mode, maybe it should be named network/connection/engine_version_update_mode?

@KoBeWi
Copy link
Member Author

KoBeWi commented Apr 15, 2024

(Or retrigger the dialog that asks about it maybe? Or was it a full screen thingy in empty assetlib?).

That dialog is removed.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick code and doc review.

SConstruct Outdated Show resolved Hide resolved
SConstruct Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
doc/classes/EditorSettings.xml Outdated Show resolved Hide resolved
editor/editor_settings.cpp Outdated Show resolved Hide resolved
Comment on lines 251 to 256
#ifdef ALLOW_AUTO_UPDATE
EngineUpdateLabel *eul = memnew(EngineUpdateLabel);
eul->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
eul->enable_compact_mode();
bottom_hbox->add_child(eul);
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we even need it in the editor. I think having it in the project manager might be good enough.
If a user chooses to stay on an older version for one reason or another, but still wants to keep track of the latest, it makes sense to me to see the update message in the PM but not to have it nag you constantly during development in the editor.

We're also constrained in width in the editor bottom panel, this message being constantly there will quickly become a problem on smaller screens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option is for users who don't use Project Manager. But I guess not using it at all is not that common 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I thought about that too. It's true alternative project managers like godots are rising in popularity and likely imply skipping the default project manager. But those alternative PMs also do their own update checking logic, so it might not be much of a problem.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is launching project directly, like directly from the folder or using e.g. VS Code. Personally I open projects with VS Code most of the time.

@KoBeWi KoBeWi force-pushed the hot_new_version_in_your_area branch from e50c969 to 49e69fa Compare April 15, 2024 13:28
@KoBeWi
Copy link
Member Author

KoBeWi commented Apr 15, 2024

Updated.

  • I made Offline label open settings dialog.
  • If version index can't be determined, the checker will now assume newest version and only show dev build label if no newer version was found.
  • Renamed editor setting and macros.
  • Removed version label from editor.

I didn't add the update setting to quick settings dialog though. After #89788 I realized the dialog needs some major refactoring, but refrained from doing it, because we won't add that many settings anyway (it's supposed to be small). Now I don't feel like touching it at all.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me!

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Apr 15, 2024
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga merged commit 49dd453 into godotengine:master Apr 15, 2024
16 checks passed
@KoBeWi KoBeWi deleted the hot_new_version_in_your_area branch April 15, 2024 16:15
Comment on lines +53 to +63
if (p_result != OK) {
_set_status(UpdateStatus::ERROR);
_set_message(vformat(TTR("Failed to check for updates. Error: %d."), p_result), theme_cache.error_color);
return;
}

if (p_response_code != 200) {
_set_status(UpdateStatus::ERROR);
_set_message(vformat(TTR("Failed to check for updates. Response code: %d."), p_response_code), theme_cache.error_color);
return;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thought about this, but I wonder if we should future proof in case we ever refactor the website and no longer have https://raw.githubusercontent.com/godotengine/godot-website/master/_data/versions.yml

Maybe we should just print verbose these messages, and not show anything in the PM when requests fail?

So people can keep using e.g. Godot 4.3-stable without being nagged if in a year the website has been ported to a new framework and this file no longer exists.

Otherwise, we need to make sure the file we use for these checks will always be online (but that's hard to future proof).

WDYT @Calinou @coppolaemilio?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valid concern because we might lose control of githubusercontent.com. However it can be debated we can also lose control of godotengine.org.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The update checker also makes many assumptions about the file's structure.

I think the most reliable way to handle it would be adding a dedicated page on the main website, which would provide a raw text dump of version data (it would be hidden/not linked in any page; only for the purpose of accessing it by the engine).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking the same.

We currently add .json files to https://godotengine.org/mirrorlist/ (e.g. https://godotengine.org/mirrorlist/4.2.1.stable.json) for each release, but it's not the most convenient to parse.

It should be fairly easy to add a build step for the website to generate e.g. https://godotengine.org/mirrorlist/versions.json that would include all versions with their respective blog post.

Copy link
Member

@coppolaemilio coppolaemilio Apr 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we shouldn't use this file. I would go with our website. We can serve a page like versions.yml in a domain that we control so that if we change servers or things like that we still have the same response from the same address.

This could be versions.godotengine.org/yml or godotengine.org/versions.yml. Anything like that will be better.

I can make the changes needed for getting that address up.

Edit: not sure why github didn't show me last messages when I replied, but we could also go with what akien proposes of https://godotengine.org/mirrorlist/versions.json and/or https://godotengine.org/mirrorlist/versions.yml as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW when we implement that, the description I amended in https://github.com/godotengine/godot/pull/75916/files#diff-52f0c165415d19abd2d5586c8a168169a8d39716be86688a9117125409b421f0R878 should be changed to remove explicit mention of GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Notify about new versions of Godot in Project Manager