26F-Studio / Techmino

Techmino:方块研究所唯一官方仓库(Github)
https://www.studio26f.org
GNU Lesser General Public License v3.0
529 stars 66 forks source link

Auto-Update Feature #853

Open Not-A-Normal-Robot opened 1 year ago

Not-A-Normal-Robot commented 1 year ago

What feature do you want to suggest to the game?

An auto-update feature.

It's not very fun having to redownload the entire game when a new version is available. In fact, many players are stuck on the old version because it's a hassle to manually update the game.

I'm thinking we should make an auto-update program included in the release of the game.

(also there should be a toggle to disable auto-update if the player really doesn't want to update)

(Also, the auto-update program's directory should be the same one that has Techmino in it, right beside Techmino.exe)

The auto-update program doesn't have to be too fancy. Just a simple command line program should do the trick. Although, I currently don't know of any command-line frameworks that can support multiple platforms. I also don't know how to make this work in Android. Well, not unless we publish the game to Google Play Store, which I highly doubt will happen anytime soon. Or maybe we can publish the game to F-Droid? It's up to MrZ imo.

Edit 1: Also, maybe a detector if the game is packaged or just ran as source code? Basically only devs run from source code, and they usually know how Git(Hub) works so if they want to update they'll just update it using Git. tl;dr: disable autoupdate if running from source

User670 commented 1 year ago

Mobile, and probably App Store version of Mac version: the game cannot auto-update; players have to go to the app marketplace to update the app (or have the marketplace do the auto updating, which I have fallen victim many times screw you Google Play defaulting to auto updating apps and then updates the apps that I don't want to update). The game could open a link to the marketplace, which is what most apps do.

Android: Alternatively, the game could download an apk, then initiate installation of said apk. I wonder if Love/Lua has such API for this.

Not-A-Normal-Robot commented 1 year ago

to start working on this we might need a new repo called TechminoAutoupdater

also these might help:
https://docs.github.com/en/rest
https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-the-latest-release

i wonder if it's even possible for CI to grab the autoupdater from another repo and put it in the release tho

User670 commented 1 year ago

i wonder if it's even possible for CI to grab the autoupdater from another repo and put it in the release tho

CI is capable of downloading files from external sources, as far as I'm aware. I think I saw part of the workflow involving downloading LOVE and ColdClear during the build process. It can also upload to external services, like a mirror for downloading in China or something

shoucandanghehe commented 1 year ago

An existing auto-update tutorial: https://github.com/a327ex/blog/issues/6 Should we try it?

shoucandanghehe commented 1 year ago

Android: Alternatively, the game could download an apk, then initiate installation of said apk. I wonder if Love/Lua has such API for this.

as far as i know: no

and the above automatic update seems to only happen inside love, we can't update the version number registered in the operating system

Not-A-Normal-Robot commented 1 year ago

that solution is overly complex for PC imo

I say, we add auto update to PC this way:

For Android, maybe we'll use that tutorial you sent. It might need heavy refactoring though, so idk. It really feels like publishing the game to F-Droid may be a better move, but it kinda risks a DMCA. It's all up to MrZ to choose.

User670 commented 1 year ago

If we do the tutorial for Android anyway,........... it would probably work on every platform...?

Not-A-Normal-Robot commented 1 year ago

true, maybe the command line program should only be a temporary fix for PC only until the complex version is finished

shoucandanghehe commented 1 year ago

maybe for Android We can open the download page with the browser

Not-A-Normal-Robot commented 1 year ago

they'd have to install the apk normally tho

some people are just lazy and don't wanna update unless it's just a single click

shoucandanghehe commented 1 year ago

yep, but love does not provide an api to call the apk installer, can we write a Java extension or magic change love?

User670 commented 1 year ago

maybe for Android We can open the download page with the browser

Same goes for every system.

they'd have to install the apk normally tho some people are just lazy and don't wanna update unless it's just a single click

... ...... ... tbh there is literally no harm in players playing an old version? If you really don't want old versions to be out there, just block old versions from launching (check update on launch and throws an error/plz-update page if there is an update) and people will just have to update anyway, no matter how many clicks it takes

shoucandanghehe commented 1 year ago

... ...... ... ~tbh there is literally no harm in players playing an old version?~

If their version is too old, the save may be lost when updating (

User670 commented 1 year ago

magic change

Did you mean 魔改? https://www.wordsense.eu/%E9%AD%94%E6%94%B9/

shoucandanghehe commented 1 year ago

magic change

Did you mean 魔改? https://www.wordsense.eu/%E9%AD%94%E6%94%B9/

yep( I am using google translate(

shoucandanghehe commented 1 year ago

Same goes for every system.

For other systems, we should have a better way At least for Windows it's simple (

Not-A-Normal-Robot commented 1 year ago

use DeepL it's usually better than google translate

shoucandanghehe commented 1 year ago

I know, but it's a bit slow sometimes

ImpleLee commented 1 year ago

Isn't this mostly an upstream problem?

ImpleLee commented 1 year ago

An existing auto-update tutorial: a327ex/blog#6 Should we try it?

After reading this, I believe that auto-update is achievable in user-land. But we have to do some other things to make our code in appdata dir to have higher priority than our own code... which I think is possible, but not that easy.

ImpleLee commented 1 year ago

Maybe move all code into appdata, and make our game a launcher instead? I mean, we can leave only necessary code in main for future update, and move all other code into the appdata dir.

Not-A-Normal-Robot commented 1 year ago

feels like that solution will make the code a lot more messy...

ImpleLee commented 1 year ago

I will make a demo recently...

ImpleLee commented 1 year ago

A runnable demo on Linux (because the library used for downloading depends on libcurl) at https://github.com/26F-Studio/auto-update-demo.

Not-A-Normal-Robot commented 1 year ago

Maybe we should also disable auto-update if running from source code (because you'd use Git to update)

Not-A-Normal-Robot commented 1 year ago

yeah i have no clue how to code up the downloading part without using an external library to help with downloading releases from github

i know zframework has an http module but i got no clue how to use it lol

anyways, can someone else do the downloading portion? i plan to make the "installer".

downloader:

installer:

ImpleLee commented 1 year ago

By using luasocket (bundled with love2d), the auto-update-demo does not need Linux now.

Not-A-Normal-Robot commented 1 year ago

I've done the installer portion: https://github.com/26F-Studio/Techmino-autoupdater We just need to implement the downloader in the game

Not-A-Normal-Robot commented 1 year ago

okay so for my current plan (only for desktop) we have to do one of these: