How to Make a Game Launcher and an Auto Updater With WPF | C# Game Launcher Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 май 2020
  • In this launcher tutorial you'll learn how to make a game launcher and an auto updater for your Unity (or other) games.
    Check out my devlogs: • Multiplayer Pirate Gam...
    ⎯⎯⎯⎯⎯⎯
    Source code: github.com/tom-weiland/csharp...
    Google Drive link converter (updated because the original one doesn't work anymore): www.wonderplugin.com/online-t...
    Discord server: tomweiland.net/discord
    Support me on GitHub Sponsors: github.com/sponsors/tom-weiland
    Support me on Ko-fi: tomweiland.net/kofi
    GitHub: tomweiland.net/github
    Website: tomweiland.net/
    ⎯⎯⎯⎯⎯⎯
    In this game launcher tutorial, we set up a launcher that can also automatically install updates for players. When I created a launcher and auto updater for my Unity multiplayer game in one of my devlogs, I got a lot of comments asking for a tutorial on how to do this, so here it is!
    By the end of this tutorial, you'll know how to make a launcher and game updater for your Unity games. You can also use it to automatically update games built with other engines-even regular applications will work!
    #UnityTutorial #GameLauncher #Unity3D #AutoUpdater #GameDev

Комментарии • 865

  • @tomweiland
    @tomweiland  4 года назад +63

    Here's the source code: github.com/tom-weiland/csharp-game-launcher
    *If you've run into issues with the zip file not extracting properly, there's a few things you can do:*
    1. Make sure you zipped your files using the default Windows method, _not_ with a third party application such as WinRAR, WinZip, 7-zip, etc.
    2. Try using a different file storage provider, such as OneDrive or Dropbox.
    3. Host the files on your computer and just use the file path as the download link. Obviously this won't work if the launcher isn't running on your computer, but it'll do the trick for testing/development purposes. You'll have to find a _proper_ file hosting solution at some point anyways, as Google Drive, OneDrive, Dropbox, etc. all have limits on how frequently a file can be downloaded, so all of those are really only usable during development.
    4. The last (and most involved potential solution) is to stick with Google Drive and to try and fix the error, which may be caused by Google Drive sometimes showing a confirmation page when downloading files. This prevents the zip file from downloading properly, which in turn means that it can't be unzipped. Unfortunately I never ran into this problem myself when building my launcher, so I wasn't able to account for it in this video, but here's a StackOverflow answer that mentions a GitHub repo which you should be able to use to circumvent the popup: stackoverflow.com/a/44402826
    From my research it sounds like the confirmation only pops up if the file is larger than a certain size, although I'm not sure what that threshold is. The StackOverflow answer claims that it's 50mb (my zipped folder was 20mb), but others have apparently gotten the popup with files under 30mb.
    Edit: the original Drive link converter doesn't seem to work anymore, so here's an alternative: www.wonderplugin.com/online-tools/google-drive-direct-link-generator/

    • @jmgb2645
      @jmgb2645 4 года назад +1

      Thank you for the fix! Was running into the issue. How would I adjust the code to fix the 50mb issue? Great tutorial as always.

    • @tomweiland
      @tomweiland  4 года назад +3

      I haven't used the solution in that answer, but from looking through the code it seems that you just need to call the DownloadGoogleDriveFileFromURLToPath method. Alternatively you can use other storage solutions-according to some members on Discord, using OneDrive avoids the popup problem. You probably won't want to host your files on Drive anyways once you publicly release your game.

    • @jmgb2645
      @jmgb2645 4 года назад +3

      @@tomweiland Just tested it and OneDrive works. Thank you, it's much more simple!

    • @tomweiland
      @tomweiland  4 года назад +2

      @@jmgb2645 great :)

    • @toyotacorolla-2001
      @toyotacorolla-2001 4 года назад +1

      @@jmgb2645 how do you do it?

  • @tomweiland
    @tomweiland  4 года назад +66

    What do you guys think of the new end screen? I spent way too much time on it, but I'm still not sure if I actually like it 🤔
    Also, at 5:10 I added a popup saying "this should be false!" even though it should say "this should be true!"-I guess that's what happens when you've been editing for too long :P

    • @naturalevo180
      @naturalevo180 4 года назад

      its good

    • @tomweiland
      @tomweiland  4 года назад

      Thanks guys :)

    • @tomweiland
      @tomweiland  4 года назад

      @@stefffi2003 thank :)

    • @tomweiland
      @tomweiland  4 года назад +3

      @SwiftzEnd -I actually just shared the project on Discord because someone else asked for it-it doesn't seem like it's worth putting on GitHub, but you can find it in the resources channel :)-
      Edit: I ended up making a GitHub repo after all :)

    • @Qitler13
      @Qitler13 Месяц назад

      @@tomweiland no steffi, no money?

  • @eraykaya2628
    @eraykaya2628 4 года назад +5

    Wow! These series are just going better and better... I first watched you in networking series and you made this topic very easy to understand for me. You are doing excellent job. Please keep it up!

    • @tomweiland
      @tomweiland  4 года назад

      Thank you, I definitely will!

  • @heinzketchup2542
    @heinzketchup2542 4 года назад +67

    This is just what i needed for my dev plan for the summer.

  • @ayoitsjack7319
    @ayoitsjack7319 4 года назад +2

    Just wanted to say Tom loving these videos. They are super informative and a massive help. Thank you

    • @tomweiland
      @tomweiland  4 года назад

      I'm glad you liked it :)

  • @joelfrom08
    @joelfrom08 3 года назад +4

    My game is getting close to being finished and I have been searching a lot on how to make a launcher. Thank you FBI and other trackers for putting this into my recommended!

    • @tomweiland
      @tomweiland  3 года назад

      :P
      Just be aware that this only works on Windows. The logic/process should be similar for other platforms, but WPF is Windows-only as far as I know.

  • @xzippyzachx
    @xzippyzachx 4 года назад +26

    I think I'm gonna try this out! It will be very useful when developing a game because it is updating frequently. This will make it much easier for testers to get the constant new updates. Also nice end screen. You just need to fit in the subscribe card somewhere...

    • @tomweiland
      @tomweiland  4 года назад +5

      Yeah, it makes distributing builds to beta testers way less of a hassle!
      About the subscribe card, I'm not sure where to put it as I don't really want to blot out the footage, but there's no other place it can go...

    • @andrews4208
      @andrews4208 2 года назад

      yo Zippy, i love your devlogs man

  • @DJLKM1
    @DJLKM1 4 года назад +2

    Awesome tutorial, clear, easily followed and at the same time in depth.

  • @scart3redup304
    @scart3redup304 4 года назад +1

    Thanks! Really the only straight on turorial I could find! Appreciate it man! 👌

    • @tomweiland
      @tomweiland  4 года назад

      I'm glad you liked it :)

  • @ImInfenix
    @ImInfenix 4 года назад

    Thanks for this awesome tutorial, your channel is precious you make tutorial about subjects I personally didn't find any tutorial appart here

    • @tomweiland
      @tomweiland  4 года назад

      Thanks, that means a lot :D

  • @RobLang
    @RobLang 4 года назад +11

    Tutorial is excellent, as always! I'd add more specific error trapping to give the user more info on how to solve problems. Also I would write an Equals/Hash pair for the version number struct.
    Loving the tutorials, tho, they're great!
    Like the new end screen, forgotten that I'd appear on it.

    • @tomweiland
      @tomweiland  4 года назад +1

      I mean the errors print out the exception itself, so you do get the actual error message. I didn't want to go through and consider every possible exception that could arise and then write a more "understandable" summary for all of them-that'd take forever :P
      What do you mean "hash pair for the version number struct"?
      Edit: do you mean taking the version string and hashing it so that instead of the IsDifferentThan method you can just check if the two hashes match? That'd definitely work, but it's a bit more effort to set up and just does the same thing 🤔

  • @VIKTOR69
    @VIKTOR69 4 года назад +1

    Omg thanks! 🤩 Thats exactly what i need it! Your tutorials are the best! 👌

    • @tomweiland
      @tomweiland  4 года назад

      Thank you, I'm glad you like them :D

  • @mohitsethi99
    @mohitsethi99 4 года назад +1

    Really cool, needed this badly! Thanks a lot. Became a fan of yours.

    • @tomweiland
      @tomweiland  4 года назад +2

      Thanks, that means a lot :D

  • @457Deniz457
    @457Deniz457 4 года назад +10

    After 5 Secs I thought:
    I LOVE YOU ! 😆
    Thanks rly rly nice, usefull AND awesome ! :)

    • @tomweiland
      @tomweiland  4 года назад +1

      I'm glad you liked it!

  • @IlIlIlIlIIIIIllll
    @IlIlIlIlIIIIIllll 3 года назад +3

    dude you are so underrated it is insane

    • @tomweiland
      @tomweiland  3 года назад +1

      I appreciate the kind words 😅

  • @RugbugRedfern
    @RugbugRedfern 4 года назад +3

    Would this also work to retrieve the game files from a github repository? Or do I need to use a service that can host a .zip file like Google Drive?

    • @tomweiland
      @tomweiland  4 года назад

      There's probably a way of getting it to work with GitHub. You'd need to write some code to generate the download links though-it looks like they need to be in this format: raw.githubusercontent.com/user-name/repo-name/branch-name/rest/of/file/path.extension

  • @phoenixtheceikraill
    @phoenixtheceikraill 2 года назад

    Thanks my guy! I had no issues on my end, I even managed to set a custom user agent string too. The game files are hosted on my own server so there was no issue with it.
    Thanks again!

  • @jeanribeiro651
    @jeanribeiro651 4 года назад +1

    Perfect tutorial.. the first that I really learned about how to create an mmo.. Very nice Tom!
    Brazilian here 😁

    • @tomweiland
      @tomweiland  4 года назад +1

      Thanks, I'm glad you liked it :)

    • @jeanribeiro651
      @jeanribeiro651 4 года назад

      I'm working on a Launcher that works with versions of files "like git" and their hashes, thus avoiding modifications of "cheaters" but the problem is with large files

  • @JeloOW
    @JeloOW 4 года назад +1

    i was looking for a game launcher tutorial for a while lol ty

  • @phantomslayer9714
    @phantomslayer9714 Год назад +1

    Hi, love the content, you literally the only person I’ve seen on RUclips who made a tutorial like this. Keep up the great work !!😎Also out of curiosity, how would we create a settings menu , with for example the ability to change languages , also how would we make a auto update for the launcher?

    • @tomweiland
      @tomweiland  Год назад +1

      An auto updater for the launcher would pretty much just be the same thing as this launcher, but downloading different files and stuff. For a settings menu you'd add an extra tab or a button somewhere that enables different UI elements when clicked. There's nothing particularly complex about it, so there isn't really much else to say about it.

    • @phantomslayer9714
      @phantomslayer9714 Год назад

      @@tomweiland thank you so much!

  • @dylanr0662
    @dylanr0662 2 года назад +3

    For anyone having the error on line 129 with google drive that pops up, upload the files to firebase storage and get the access token (The direct download link). Firebase is free to use and it fixed this problem for me. Great Video btw, helped a lot.

    • @tomweiland
      @tomweiland  2 года назад +2

      OneDrive and Dropbox are potential alternatives as well.

    • @HaruChanZ64D
      @HaruChanZ64D 3 месяца назад

      Hey man! I also use Firebase but have you found a way to auto-refresh the token? Because if I incrementally update my game. I had to update the URLs in the launcher's code.

  • @DamageSoftware
    @DamageSoftware Год назад

    Amazing video.
    I bookmarked it and will get back to it when I reach the point of implementing an launcher.

  • @LinkinJuan23
    @LinkinJuan23 3 года назад

    You are awesome! I enjoy your videos so much!
    Im not a kind of people that comments videos, but you are the exception.
    PS: Sorry for my bad english (?)

    • @tomweiland
      @tomweiland  3 года назад +1

      Thank you, that means a lot to hear :D

  • @J_E_N_T
    @J_E_N_T 3 года назад +1

    Brilliant video, thank you!!

  • @Doesky
    @Doesky 4 года назад +1

    ty so much! you make awesome tutorials 😁

    • @tomweiland
      @tomweiland  4 года назад +1

      I'm glad you like them :D

  • @SquidyGuitar
    @SquidyGuitar 3 года назад

    This work perfectly
    Thank you so much :)

  • @frankzander5946
    @frankzander5946 3 года назад

    Great vid ! Many thanks - love it !

  • @antonvrigborn6666
    @antonvrigborn6666 2 года назад

    A really great tutorial, good job

    • @tomweiland
      @tomweiland  2 года назад

      Thanks, glad it was helpful :)

  • @LanPodder
    @LanPodder 4 года назад

    This is actually a neat tutorial

  • @lucidusdev7259
    @lucidusdev7259 3 года назад

    I remember looking for something like this in 2015 and 16 when I wasn't experienced in c# at all,thanks for sharing

    • @tomweiland
      @tomweiland  3 года назад

      Well I hope you like(d) it :)

    • @lucidusdev7259
      @lucidusdev7259 3 года назад

      @@tomweiland Sorry but i got an error and i'm not sure how to fix it
      "Errorfinishing downloading: System.IO.InvalidDataException: End of
      Central Directory record could not be found.
      at System.IO.Compression.ZipArchive.ReadEndOfCentr aIDirectory0
      at System.IO.Compression.ZipArchive.Init(Stream stream,
      ZipArchtveMode mode. Boolean leaveOpen)
      at System.IO.Compression.ZipArchive..ctor(Stream stream,
      ZipArchiveMode mode, Boolean leaveOpen, Encoding
      entryNameEncoding)
      at System.IO.Compression.ZipFile.OpenjString archiveFileNarne,
      ZipArchtveMode mode, Encoding entryNameEncoding)
      at System.IC).Compression.ZipFile.ExtractToDirecto ry(String
      sourceArchiveFileName. String destinationDirectoryName. Encoding
      entryNameEncoding, Boolean overwriteFiles)
      at System.IO.Compression.ZipFile.ExtractToDiredory (String
      sourceArchiveFileNamc, String destinationDirectoryName, Boolean
      overwriteFiles)
      at
      LucidusLauncherV2.MainWindow.DownloadGameComple tedCallback(O
      eject sender, AsyncCompletedEventArgs e) in
      D:\LucidusLauncher\LucidusLauncherV2\LucidusLau ncherV2\MainWind
      ow.xaml.cs:line 129 "

    • @tomweiland
      @tomweiland  3 года назад

      Check the pinned comment on this video, that error looks like it might be caused by what I address there.

  • @sypdev
    @sypdev 4 года назад

    This is super useful, thanks!

  • @nichoas3495
    @nichoas3495 4 года назад +7

    This is incredible, I will definitely use this. Is it possible you could make another video expanding on the hash comparison you talked about at the end to speed up downloads? If not, it’s totally fine, amazing video!

    • @tomweiland
      @tomweiland  4 года назад

      Thank you :)
      I'm not sure if I'll cover the hashing part since that's quite a bit more advanced, I haven't _really_ done it myself (I've played around with it a bit), and it won't work with Google Drive. That means I'd need to find another place to host the files, and it presents a roadblock for others who want to follow the tutorial but can't host their files anywhere.

    • @nichoas3495
      @nichoas3495 4 года назад

      Tom Weiland alright, that’s totally alright man! Looking forward to your next devlog : )

    • @tomweiland
      @tomweiland  4 года назад

      @@nichoas3495 awesome, it's nice to know people enjoy the devlogs!

    • @kelafac6261
      @kelafac6261 2 года назад

      @@tomweiland Hi, sorry for my English, I use a translator (I'm from Russia)
      I really liked the launcher, I made my own and everything works cool, but I would really like to see how a hash comparison can be attached to this code, can you help with this please? make a video or help if possible

  • @beaujanssen6243
    @beaujanssen6243 4 года назад +1

    This is so cool! THANK U :D

  • @davilkusgames812
    @davilkusgames812 2 года назад

    Thank you very much for this lesson!

  • @KingDara_
    @KingDara_ 2 года назад

    Thank you! This help me really hard !

  • @XordXildo
    @XordXildo 2 года назад +1

    THIS SAVED ME THANK YOU

  • @didi-mg2yk
    @didi-mg2yk 3 года назад

    Thanks! This is really helpful~

  • @cloudchen0831
    @cloudchen0831 Месяц назад

    You are a hero.

  • @benrex7775
    @benrex7775 3 года назад +2

    You are very quick at programming.

    • @tomweiland
      @tomweiland  3 года назад

      The footage is a little bit sped up, so this isn't my "organic" typing speed 😅

    • @benrex7775
      @benrex7775 3 года назад

      @@tomweiland I watch those videos speed up anyways. Because of that I didn't mean that. You didn't make any breaks and just typed and typed. I have to make thinking and researching breaks. And I also make distraction breaks. Actually I make a lot of distraction breaks.

  • @philberex
    @philberex 7 месяцев назад

    Thank you for this tutorial. 🙌

  • @BogdanAndreiRO
    @BogdanAndreiRO 3 года назад

    This video helped me with the zip download and extraction, thank you!

    • @tomweiland
      @tomweiland  3 года назад

      Great! Glad I could help :)

  • @generalis2095
    @generalis2095 3 года назад

    Great job! Thanks!

  • @dmrdev9934
    @dmrdev9934 4 года назад

    Dude you are real hero :)

  • @MasterofFire-sc3yn
    @MasterofFire-sc3yn 4 года назад

    THIS IS INSANELY GOOD.

  • @MistycznyArbuz2
    @MistycznyArbuz2 3 года назад

    Fantastic ! Thanks for source code :D

  • @ariskim897
    @ariskim897 3 года назад

    Thank for sharing the knowledge!

    • @tomweiland
      @tomweiland  3 года назад

      Glad it was helpful :)

    • @ariskim897
      @ariskim897 3 года назад

      @@tomweiland Just wondering. Is there anyway to pass parameter to game from the launcher?

    • @ariskim897
      @ariskim897 3 года назад

      Found what the answer to my question. Good video.

  • @DanielLochner
    @DanielLochner 4 года назад

    Genius Tom! 😄

  • @sullymlg9785
    @sullymlg9785 2 года назад +1

    Only at 6:03 but I'm really loving the tutorial - Thank you!

  • @antalervin1447
    @antalervin1447 Год назад

    Thanks Man You saved Me!

  • @Spamap
    @Spamap 4 года назад +2

    Amazing tutorial, very helpful! Anyone else try to type in the direct download link to try and get the game lmao

    • @tomweiland
      @tomweiland  4 года назад +2

      Thanks :)
      I'm sure you're not the only one. If you had tried it a few days ago you might have been successful-I found out that files are still accessible by link after they've been moved to the trash, so the game was technically available until I permanently deleted them 😅

  • @rockydonet
    @rockydonet 3 года назад

    thank you so much Sir!

  • @CueVoid
    @CueVoid 3 года назад

    Thanks it helped me a lot

    • @tomweiland
      @tomweiland  3 года назад

      Glad to hear it :)

    • @CueVoid
      @CueVoid 3 года назад

      @@tomweiland is devlog #45 coming

    • @tomweiland
      @tomweiland  3 года назад

      Not quite, but there is a new video coming as soon as I finish editing it!

  • @gokuakku9833
    @gokuakku9833 2 года назад

    sir u are really great :-)

  • @AphixDev
    @AphixDev 3 года назад

    Awesome. 🤩

  • @bluegreen15
    @bluegreen15 Год назад

    Ehrenmann, wirklicher Ehrenmann

  • @xyz5454
    @xyz5454 3 года назад

    thanks for your help

    • @tomweiland
      @tomweiland  3 года назад

      I'm glad you found it helpful :)

  • @Acrellux
    @Acrellux 2 года назад

    Hello. I'm having some trouble. Everything works fine, but when I press play, it won't do anything. Do you know what could be causing this? I had to tamper with Norton to get it to download, also, if that changes anything. Thank you.

    • @tomweiland
      @tomweiland  2 года назад

      Make sure your file paths are correct. Beyond that there's not much I can do to help, especially if you're not getting errors. If you are getting an error, go ask on Discord (debugging here in the comments is really tedious).

    • @altermann4072
      @altermann4072 4 месяца назад

      gameExe = Path.Combine(rootPath, "Build/YourAppName.exe");
      Adding "Build/..." fixed my issue.

    • @Acrellux
      @Acrellux 4 месяца назад

      @@altermann4072 Appreciate you dude!!

  • @scottgamedev8542
    @scottgamedev8542 2 года назад +1

    Thank you for this great video. Im currently modifying the code to support multiple games and it seems to be coming along. If this video wasn't here then I would probably have not bothered with an launcher.

  • @miracle__worker
    @miracle__worker 3 года назад +1

    Hello, thanks a lot for your video. I have a question: what will happen with my saves after update?

    • @tomweiland
      @tomweiland  3 года назад +1

      If you're talking about something like world saves, that depends on where you're storing them. You probably don't want to be storing them within the build folder, as that _will_ cause them to be overwritten with every update.

  • @lagosta
    @lagosta 4 года назад

    Are you an life savior? Because you saved mine

  • @arknet4973
    @arknet4973 3 года назад +1

    Good time of day. Ned to connect the extracting process to the progress bar, Found a lot info. Basically I need to compare the extracted size and need to exctract size. How can I get the the archive total size ( size which will be after extracting)? I right clicked on the zip and there is the "Total Size" how can I get it?

    • @tomweiland
      @tomweiland  3 года назад

      If you use the WebClient's DownloadProgressChanged event it provides you with the progress, however this doesn't work if you host on Google Drive as Drive doesn't send the total file size across at the start or something: docs.microsoft.com/en-us/dotnet/api/system.net.webclient.downloadprogresschanged?view=netcore-3.1

  • @RealBlackCastle
    @RealBlackCastle 3 года назад

    Hi, thanks for this great tutorial,
    But I got into some problem the google method is not working anymore so I was asking if there is any other way to do this Please?

    • @tomweiland
      @tomweiland  3 года назад

      Hosting the files on Google Drive should really only be a temporary solution anyways, as I'm pretty sure they have limits on how many times a file can be downloaded in a given time frame. While you're testing you could also try using something like OneDrive or Dropbox, but in the long run you'll probably need to pay to host files somewhere.

  • @EmuTheEmo
    @EmuTheEmo 3 года назад +1

    This might be a stupid question but is there a way to update the launcher once it's released? Say if I wanted to adjust the launcher to have an option for a new game(kinda like steam) is it possible to have it update or will people have to redownload it

    • @tomweiland
      @tomweiland  3 года назад

      You'll need to make a second updater application, as programs can't really modify their own files while they're running.

  • @NY-wh4gs
    @NY-wh4gs 3 года назад

    hi :D , thanks to perfect tutorial..!!
    I have one question about this tutorial. Can this floating object reflect the directional flow velocity(or current) in the marine environment? Where can I check if possible?

    • @tomweiland
      @tomweiland  3 года назад +1

      Did you comment on the wrong video because this sounds like a question related to my water physics tutorial...
      That being said, I'm not sure what you mean by directional flow-if you're talking about currents or something you'd need to define those somehow before you can access them and use them to move objects in a certain way.

  • @delautrer2480
    @delautrer2480 Год назад

    Hi! Very nice video! Can you show, how you would implements an slider showing the current progress? And maybe some stats, like mbit/s or a "time left"?

    • @tomweiland
      @tomweiland  Год назад

      You can use this to get the download progress, although I don't think it works when downloading files from Google Drive: docs.microsoft.com/en-us/dotnet/api/system.net.webclient.downloadprogresschanged

  • @makkapakkka
    @makkapakkka 3 года назад

    Great video,
    Question, from 11:00
    What do you mean by hashes containing these folders? I'm trying to make the launcher not download every file with each minor update.

    • @tomweiland
      @tomweiland  3 года назад

      You generate a hash for each file. If a file changes, it will produce a different hash, allowing you to easily figure out which files have changed (by comparing the hashes).

    • @makkapakkka
      @makkapakkka 3 года назад

      @@tomweiland thanks for the swift response, what is a hash? And how would you go about coding that in?

  • @robinnlmn3205
    @robinnlmn3205 4 года назад +2

    Hi im doing the launcher and in the DownloadingGameCompleteCallback there is a error with : ZipFile.ExtractToDirectory(gameZip, rootPath, true);
    Can someone pls help

    • @tomweiland
      @tomweiland  4 года назад

      Check the pinned comment.

  • @GamingWizardYT
    @GamingWizardYT 3 года назад

    Hello, I had commented earlier and I’m not quite sure if you remember you but you replied back to my questions saying that you didn’t understand what I meant by downloading it. I basically mean when you finish building “the first version” of your game and convert it to exe file. So is after I do that when I start the tutorial? Is is that an unnecessary step? Hopefully this provides more clarification

    • @tomweiland
      @tomweiland  3 года назад

      You can start this tutorial whenever you like. None of the code we write will be part of your project, but in order to test the launcher you'll need some kind of exe file-that can be your unfinished game or something entirely different. In theory however, you could build the launcher before even creating your game project as there's no particular order you need to do things in.

    • @GamingWizardYT
      @GamingWizardYT 3 года назад

      Tom Weiland thank you! And yes a did double repost it was accident and I’ll remove it lol

  • @the_fluffinator
    @the_fluffinator 3 года назад +2

    When I try downloading the game, it says error finishing download: System.IO.InvalidDataException: End of Central Directory record could not be found and occurs at line 128. May someone please help me?

    • @tomweiland
      @tomweiland  3 года назад

      Check the pinned comment :)

  • @frankzander5946
    @frankzander5946 3 года назад

    To ease updating literals I have come to use string constants that I define at the start of the code and I name them close to their content.
    That way updating the stings takes place in one spot and the compiler can spot any typos while coding instead of me having to find them during testing.... just a thought ;-)

    • @tomweiland
      @tomweiland  3 года назад

      That sounds like a smart thing to do :P

  • @OpenGamesCommunity
    @OpenGamesCommunity 2 года назад

    _This launcher can be turned to work as onlinepath also ? I see rootpath, instead of __build.zip__ can we add a url path ? To download from a FTP Server, then change drive links ?._

    • @tomweiland
      @tomweiland  2 года назад

      What? _rootPath_ is the path to the directory where you want to install the game locally. The Drive download links act as the "online path", and yes, you can change those out to download from somewhere else.

  • @lbbrowns37
    @lbbrowns37 2 года назад +1

    when i launch the game launcher it wont download the file but gives a really long error message that says the problem is at line 135 "ZipFile.ExtractToDirectory(gameZip, rootPath, true);" and the zip file it downloads is corrupted any idea on why this might be

    • @tomweiland
      @tomweiland  2 года назад

      You asked about this on Discord right? Did you get it fixed?

  • @s1m1ng7on
    @s1m1ng7on 2 года назад

    Hey, is there a way to select the location of the game files before installing the game (just like in a setup wizard)?

    • @tomweiland
      @tomweiland  2 года назад

      You could make a button for that.

  • @SuperNidey
    @SuperNidey Год назад

    I have a question. Will extracting the zip file work If my game is installed inside the 'Program Files' folder? I'm afraid the launcher might request 'admin access'. (Which is a hassle for my clients who aren't tech savvy).

    • @tomweiland
      @tomweiland  Год назад +1

      Yes, it'll need administrator permissions if it's in Program Files. That whole folder is protected.

  • @miracle__worker
    @miracle__worker 3 года назад +1

    Привет. За видео большое спасибо. Вопрос: если у меня в игре есть сохранение, то при скачивании новой версии что будет с файлом сохранения?

    • @tomweiland
      @tomweiland  3 года назад

      I'm guessing your other comment is a translation of this one, so take a look at my response to that.

  • @w1ildcard
    @w1ildcard Год назад +1

    hi! i did this with github and downloading works but whenever i update through github it doesnt update. i have to delete the game and relaunch the launcher for it to update, any idea why this is happening?

    • @tomweiland
      @tomweiland  Год назад

      Did you update the version file? If the version stored online/in the cloud differs from the one stored locally, it should trigger the update process.

  • @itzyaboijoey3398
    @itzyaboijoey3398 3 года назад +2

    Tom one last thing sorry to be critical but im using .net framework and the ZipFile.ExtractToDirectory(gameZip, rootPath, true); line is giving me an error saying Argument 3: cannot convert from 'bool' to 'System.Text.Encoding' what do i do?

    • @itzyaboijoey3398
      @itzyaboijoey3398 3 года назад

      Wait nvm fixed it i just took out the boolean ("true") and it works

    • @tomweiland
      @tomweiland  3 года назад

      Yeah in .NET framework the ExtractToDirectory method doesn't take a third boolean parameter, so you just need to remove it. If that causes any kind of issues, you may need to manually check if the files exist and delete them before extracting the zip file.

  • @DiscoDerpAnimations
    @DiscoDerpAnimations 3 года назад +6

    If you are doing this on the .NET framework and you can't find the ZipFile class, you need to install System.IO.Compression.ZipFile in the nuget package manager then include the namespace there

  • @malphiem
    @malphiem 3 года назад

    Thaaanks alot for this tutorial , it was easy to understand even tho im not familiar with the programming language :D. I was able to finish the launcher/patcher :D , btw is there a way that i can delete the file from local copy if it was not included in zip file ?

    • @tomweiland
      @tomweiland  3 года назад

      Which file is it you want to delete? If I remember correctly you can use File.Delete() and pass it the path & name of the file you want deleted.

    • @malphiem
      @malphiem 3 года назад

      @@tomweiland i forgot whats this problem about , its all working now haha , thaanks for this greate tutorial i was able to make my very own game luncher for the first time ,, i came from java to c# lol

    • @A1_Plant
      @A1_Plant Год назад +1

      @@malphiem sameeeeeeeeeeeeeeeeeeeee

  • @cynbyrne6344
    @cynbyrne6344 3 года назад

    When Creating a new Project, I dont get that Preview window. Any reason why? It worked before but now it doesnt show at all. Ive reinstalled my Visual Studio and reset all my setting yet nothing.

    • @tomweiland
      @tomweiland  3 года назад

      Maybe try this? stackoverflow.com/questions/30090719/xaml-designer-not-showing-up

  • @samuelgirmagirma4019
    @samuelgirmagirma4019 3 года назад

    LOve For tut they are so fun

  • @augustoantenucci4725
    @augustoantenucci4725 2 года назад +2

    Hey!, I have this error, "Error finishing download: Central Directory corrupt.
    It occurs in line 129 (Zipfile.ExtractToDirectory)
    Thank you

    • @tomweiland
      @tomweiland  2 года назад

      Make sure you're zipping your files the regular Windows way (not with something like Winrar, 7zip, etc). If that doesn't fix it, try using OneDrive or Dropbox instead of Google Drive.

  • @tristankubih
    @tristankubih Год назад

    Hi, I have a question, because as soon as I open Visual Studio, I don't get the template for a WPF App so i have none of the code that yall start with.. Please help..?

    • @tomweiland
      @tomweiland  Год назад +1

      If you don't have the WPF App template then you're missing a VS workload-maybe the .NET Desktop Development one? You'll have to modify your VS installation via the installer.

  • @Cooltrain
    @Cooltrain 4 года назад

    Would it be possible to use the games.exe version for version tracking, cutting the need for the txt?

    • @tomweiland
      @tomweiland  4 года назад

      Are you talking about the version that you set in the Unity editor (in the player settings I think)? I had that thought when I was building my launcher, but I couldn't find a way to access that information from outside the game. Even if you could access it, you'd still need to have the version file stored online.

  • @italianstallion1413
    @italianstallion1413 4 года назад +2

    Hey, awesome tutorial im just getting this one error. my zip folder only downloads to 39 kb then I get the error: System.IO.InvalidDataException:End of Central Directory record could not be found. any help would be awesome cheers!

    • @tomweiland
      @tomweiland  4 года назад

      I've never run into an error like that-have you tried googling it?
      If Google isn't able to help, I suggest joining the Discord server (link in description) as it's much easier to debug stuff there than here in the comments section.

    • @Tornadoally
      @Tornadoally 4 года назад

      Switch from google drive to OneDrive. It is because of the filesize. I had the same error and fixed it that way. Also sorry for being a month late but I hope this helps. :P
      Also if you can't figure out how to do that just reply with questions

    • @tomweiland
      @tomweiland  4 года назад

      @@Tornadoally yeah, after multiple people mentioned that this was happening (with various file sizes, so still not sure if there is a threshold), I pinned a comment with a solution from StackOverflow on this video. Switching to other hosting sites will also do the trick :)

  • @portsnotalt
    @portsnotalt 3 года назад

    So I'm having an issue with this, it shows no errors in visual studio but when I compile and try to run it it gives me an error message at line 129, I assumed it was the issue that he pinned about the google drive confirmation so I switched to onedrive, it still prompted the exact same error.

    • @tomweiland
      @tomweiland  3 года назад

      Without the error message and whatever is on line 129 (since code spacing might not be identical), no one will be able to help...

  • @itzyaboijoey3398
    @itzyaboijoey3398 3 года назад +1

    Tom i just wanted to let you know that the link converter desnt work any more and also is there a substitute for it

    • @tomweiland
      @tomweiland  3 года назад +1

      Give this a try: www.wonderplugin.com/online-tools/google-drive-direct-link-generator/

  • @RugbugRedfern
    @RugbugRedfern 4 года назад +3

    I think this might be big! There are virtually no game launcher tutorials for Unity.

    • @tomweiland
      @tomweiland  4 года назад +2

      True-there's really only one other tutorial, which (if I remember correctly) doesn't even cover downloading/updating the game files, and it's several years old.
      On the other hand, I'm not sure how many people are actually searching for something like this in the age of Steam, so I guess only time will tell :P

    • @RugbugRedfern
      @RugbugRedfern 4 года назад +2

      @@tomweiland I've searched for this many times before, but was met with dead forum discussions and unanswered unity answers posts. I'm glad there's finally a decent tutorial on the subject!

    • @CapCreeperGR_Main
      @CapCreeperGR_Main 4 года назад

      There are but this is the best one

    • @VIKTOR69
      @VIKTOR69 4 года назад

      @@tomweiland Well even some Steam games have their own launchers for updates... :D

    • @tomweiland
      @tomweiland  4 года назад

      @@CapCreeperGR_Main thanks :P

  • @MagustenTV
    @MagustenTV 2 года назад

    Hi, I made everything work, but I get a error whenever I make an update to the game.
    It downloads the .zip to the folder, but then it pops up with multiple errors, and also hinting that something went wrong on line 129.
    As far as I can see, the error is that the Build.zip is downloaded, tries to unpack, but can't cause the old "Build" folder is still there. So apparently it can't overwrite it. Do you know how I can fix this, or where I went wrong? Thank you very much:)

    • @tomweiland
      @tomweiland  2 года назад

      Without seeing the actual errors you're getting, what you have on line 120, and/or your code in general, there's not much I or anyone else will be able to do to help. I recommend joining the Discord server and asking there, and including that information.
      Also, read the pinned comment (if you haven't already) and make sure your issue isn't related to anything mentioned there.

  • @RecombobulatedStuff
    @RecombobulatedStuff 2 года назад

    is there a limit on file size for when it extract the zip? it works for other projects but it stops when it tries to downlaod the project i need it to download. am i missing soemthing?

    • @tomweiland
      @tomweiland  2 года назад +1

      Join the Discord server and ask there. Troubleshooting is a pain in the RUclips comments.

  • @RysticYT
    @RysticYT 2 года назад +1

    @Tom Weiland on 7:00 is there a problem with ZipFile , on you're screen it is blue and on mine it is white
    Could you help me please

    • @RysticYT
      @RysticYT 2 года назад

      And it doesnt work :( i copied everything from MainWindow.xmal.cs and renamed the namespace

    • @tomweiland
      @tomweiland  2 года назад

      Join the Discord server and ask there.

  • @mfortn
    @mfortn 3 года назад

    Thank you for that explanation ♥.
    But explain how to add more games in launcher 🙃👍🏻.

    • @tomweiland
      @tomweiland  3 года назад +1

      It's literally the same code-you'll just need to specify which game should be downloaded/updated/launched.

  • @ab0bus968
    @ab0bus968 3 года назад

    Hello! I really liked your tutorial, but for some reason I got an error: Error finishing download: System. IO. InvalidDataException: End of Central Directory record could not be found. Could you tell me how to fix this error? Thank you in advance

    • @tomweiland
      @tomweiland  3 года назад

      Check the pinned comment.

  • @erikmckelvey4796
    @erikmckelvey4796 3 года назад

    Thanks for the tutorial, it was very helpful! Any idea why the download is not working at all once I make an installer for the launcher? It is working great with no installer, but once I install it to program files the build.zip file won't install at all, and the only error is when the build.zip file is meant to be deleted, and the error is that the file does not exist. I am wondering if this has something to do with windows firewall?

    • @tomweiland
      @tomweiland  3 года назад +1

      If you're installing it to the Program Files folder that might be causing problems because you need to have administrator privileges to make modifications in there. Aside from that I'm not sure what the issue might be.

    • @erikmckelvey4796
      @erikmckelvey4796 3 года назад

      @@tomweiland Oh lmao that was the problem, I had to run the launcher as administrator. Thanks!

  • @GHOST-dg5tk
    @GHOST-dg5tk 4 года назад

    you could also use downloadstring and set that in a variable and then use that with downloadfile

    • @tomweiland
      @tomweiland  4 года назад

      Which part exactly are you referring to? Do you mean instead of using DownloadFileAsync to download the Build folder? You probably don't want to do that-having your application become unresponsive for any amount of time isn't good, and downloads can take really long on slow internet speeds, even for small games.

    • @GHOST-dg5tk
      @GHOST-dg5tk 4 года назад

      @Tom Weiland you could set a string to a pastebin paste by using download string and then use downloadfile to download that string (put the download link in the pastebin paste) so you dont have to use google drive, you could generate a new download link and put it in the pastebin paste

  • @axeljefyua9387
    @axeljefyua9387 2 года назад +1

    If your having errors, upload your files to dropbox, use a direct link converter, put the links in, and there! it works!

    • @tomweiland
      @tomweiland  2 года назад +1

      Yeah, a lot of people seem to have issues with Google Drive. OneDrive is another alternative.

    • @axeljefyua9387
      @axeljefyua9387 2 года назад

      @@tomweiland I think they don’t let you download exes or zips anymore unless you confirm it, so using other file hosting alternatives like Dropbox, one drive, idk about icloud but maybe, should do just the thing.

    • @axeljefyua9387
      @axeljefyua9387 2 года назад

      @@tomweiland I do have a few questions, I’m in the discord but my first question is can I make different buttons to launch different games? So I can have all my games on there, not just based on one?

    • @tomweiland
      @tomweiland  2 года назад

      Yes, you can add as many buttons/games as you like.

  • @tux_the_astronaut
    @tux_the_astronaut 4 года назад +2

    If your gonna make a launcher for multiple platforms you will need to use something like Electron or QT creator

    • @tomweiland
      @tomweiland  4 года назад +1

      Yeah, this is mainly meant to just show people the basics.

  • @nicksparrow009
    @nicksparrow009 3 года назад +1

    Hey bro, so I put down a OnMouseEnter Function and I try to change the background of a button, but I have worked half a day to get it working and I don't get it to work, mind if you help me?

    • @tomweiland
      @tomweiland  3 года назад

      Try this: stackoverflow.com/a/20073418
      Alternatively you can take advantage of a library, such as this one: github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit

    • @nicksparrow009
      @nicksparrow009 3 года назад

      @@tomweiland Alright otherwise I'll join ur Discord. Thhnxxx

  • @paddegroda4354
    @paddegroda4354 4 года назад +1

    In the ZIpFile.Extract... when I add true it says “Argument 3: cannot convert from ‘bool’ to ‘System.Text.Encoding’ “

    • @tomweiland
      @tomweiland  4 года назад

      Are you using .NET Framework? I think the Extract method takes different parameters there than in .NET Core. However, that boolean isn't really necessary-it just tells it to overwrite any existing files with that name.

    • @paddegroda4354
      @paddegroda4354 4 года назад

      I just looked for .Net so I guess I took the wrong one

  • @VIKTOR69
    @VIKTOR69 4 года назад

    I'm just wondering how to make the launcher find out if the files have changed and if not, not to download anything...

    • @tomweiland
      @tomweiland  4 года назад +1

      To check the files themselves, you'd need to use a hashing system like I talked about at the end of the video. However, assuming you only change the version number that's stored online when you release an update, the launcher will only ever download the files when something has changed.