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/
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.
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
@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 :)
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!
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...
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...
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.
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.
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.
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 🤔
@@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.
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!
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!
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.
@@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
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
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
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!
@@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 "
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?
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.
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.
@@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.
@@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?
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 (?)
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 😅
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.
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).
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
@@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!
If anyone is wondering why the "rootPath = Directory.GetCurrentDirectory();" causes an error just put "using System.IO" on the top (idk if this applies to anyone but it did apply for me) Sometimes it just isn't there
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
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?
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
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
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.
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.
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.
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).
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
Can I put a video or a gif on the Launcher's background, instead of only an image, because an image sounds a bit boring for me :D If it is possible, how do you do that?
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?
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"?
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
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?
Hey man, great video, im at the end of the tutorial but can't get the thing to run, Visual Studio doesnt seem to make an exe and "build" function doesn work, it only shows one error in code, it being "The name 'ZipFile' does not exist in the current context, would you know how to fix it?
You probably figured it out already, but this might help for someone in the future who runs into the same problem; You are indeed missing a reference. As was the case with me, "using System.IO;" is appearantly not enough for the code to recognize the ZipFile extension. Add "using System.IO.Compression.FileSystem;" should fix this. If its not recognized, it means you do not have the reference to this extension enabled. In the solution explorer right click on References and click "Add reference" Then find "System.Io.Compression.FileSystem" in the list and enable the checkbox in front of it. Hit OK and it should work.
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.
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 ;-)
Sounds like it's getting stuck somewhere along the way, but I'm not really sure what would cause it, especially if you're not getting any errors. Best I can say is to compare your code to what's on GitHub.
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 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
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?
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.
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 System.IO.Compression doesnt add it, i had to right click on my references and add System.IO.Compression.FileSystem. Wasnt able to add it by adding "using" either, very strange
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!
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.
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
@@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 :)
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..?
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.
Hi im doing the launcher and in the DownloadingGameCompleteCallback there is a error with : ZipFile.ExtractToDirectory(gameZip, rootPath, true); Can someone pls help
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?
Try this: stackoverflow.com/a/20073418 Alternatively you can take advantage of a library, such as this one: github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
is this part 1 of this tutorial? Seems like it doesn't start at the beginning. I'd like a little more info on the set-up and pre-requirements to get this set up. Also, would this work if you want a launcher to be able to launch multiple games?
Yes, this is part 1 (the only part). What extra info exactly are you after? This won't work with multiple games out of the box, but modifying it support more than 1 game should be relatively trivial-all the download/install _logic_ should be the same, but you'll obviously have to change download links and stuff.
I guess I am not quite advanced enough at coding yet to use this. I feel I’m not understanding all of the terminology you use, and I don’t have experience with XAML or WPF. What basic concepts do I need to study before I come back to this? Thanks for your time:)
You know that this will always download the Build.zip file, no matter if its downloading an "Update" or the game ? So there is no difference. Just an idea: Do zip files named as the version of the update (like Update-1.0.1.zip) and if the launcher installs the game, it downloads them one by one and for updating it downloads just one by one for actual local version to current version on server. But anyways: great tutorial like always :)
Yeah, I'm aware. The only reason we added two different launcher states was to display different text to the user. I'm not entirely sure what you mean by "it downloads them one by one" though-I don't see why you would want to download files from previous game versions...that's a waste of time and resources.
@@tomweiland this way the archives whould only contain changed Files and can be downloaded very fast 😉 Problem is that then it needs to Download one by one so all changed Files are processed. Thats btw how the Publisher Gamigo AG's Fiesta Online Launcher works. When you have an old Version you see Patch by Patch downloading but very fast.
Hmm, interesting. That doesn't sound like it would work with Drive though (at least not the way we've done it), since you're not updating the zip file, but instead adding new ones, which means you'd have more download links that the launcher isn't aware of.
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?
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.
How does the code work when you update and there is already a build folder for unity. Whenever this happens to me I get an error since it will not allow me to overwrite existing files. I saw that ZipFile.ExtractToDirectory has an additional bool parameter but I cannot add that in my project, as it claims it cannot convert bool to System.Text.Encoding. I know that the bool parameter essentially says whether or not to overwrite files, unfortunately I can't use that at all. If there is a solution? I will be happy to hear if so, great video by the way.
If you don't have the method that takes a bool as one of its parameters, then you're probably using .NET Framework (the methods are a bit different than in .NET Core, which I didn't realize before making this video). You could just check if the file exists, and if it does, delete it before extracting the new one.
@@tomweiland Already figure it out by changing to web source, but I'm having error when creating WPF App (.NET Core) it's stating to use preview versions. Would you mind telling what version of SDK you're using? I'm using VS 2019 with 5.0.408 core SDK but I can't create WPF App (.NET Core) Project. Thank you! :D
Your game doesn't need to be multiplayer for this to work, if that's what you're asking, but without an internet connection no updates will be able to happen.
@@tomweiland yes i know that if saman dont have internet connection is the update is not happen is obvious if saman dont have indernet the update is not happen
Hm weird I can only open that project with VS 2019 not 2017 or 2015 🤔 It doesnt matter but I just wonder why it is like that^^ Thanks again for the GitHub and all of ur Vids
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?
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.
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?
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.
On my non tech savvy friends computers, they are required to download the .NET framework to launch my GameLauncher. Is this always going to be the case? Also their antivirus doesnt like the .dll files
.NET Framework is included in Windows. If you built the launcher with .NET Core your friends would have to install that-the way around it is to either switch to .NET Framework or to publish the launcher with the _self-contained_ option enabled (which will include .NET Core in the launcher build). As for the antivirus issue, I think you'll have to get a code signing certificate to get around that, which I believe costs money (though I'm not 100% sure, I haven't really looked into it).
Awesome video the only problem im having is that on line 129 it says The name 'ZipFile' does not exist in the current context would you know what's up with that?
_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 ?._
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.
Thanks. Its possible to earn good money with this launcher app: 2000-5000$ easily. Cant write here in details. But good tutorial to make "fake" launcher.
Are you talking about scams or malware distribution or something? I know me asking probably won't change your mind, but please don't use it for that...
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/
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.
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.
@@tomweiland Just tested it and OneDrive works. Thank you, it's much more simple!
@@jmgb2645 great :)
@@jmgb2645 how do you do it?
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
its good
Thanks guys :)
@@stefffi2003 thank :)
@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 :)
@@tomweiland no steffi, no money?
This is just what i needed for my dev plan for the summer.
Awesome :)
A fortnite dev?
One year later, how did the plan go?
you just ran into us with winter
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!
: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.
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...
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...
yo Zippy, i love your devlogs man
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.
OneDrive and Dropbox are potential alternatives as well.
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.
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.
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 🤔
dude you are so underrated it is insane
I appreciate the kind words 😅
You are very quick at programming.
The footage is a little bit sped up, so this isn't my "organic" typing speed 😅
@@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.
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!
Thank you, I definitely will!
After 5 Secs I thought:
I LOVE YOU ! 😆
Thanks rly rly nice, usefull AND awesome ! :)
I'm glad you liked it!
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!
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.
Tom Weiland alright, that’s totally alright man! Looking forward to your next devlog : )
@@nichoas3495 awesome, it's nice to know people enjoy the devlogs!
@@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
Just wanted to say Tom loving these videos. They are super informative and a massive help. Thank you
I'm glad you liked it :)
Perfect tutorial.. the first that I really learned about how to create an mmo.. Very nice Tom!
Brazilian here 😁
Thanks, I'm glad you liked it :)
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
Wow, that was exactly what I was searching for. Great video!
Glad I could help :)
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?
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
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!
Glad it worked!
Awesome tutorial, clear, easily followed and at the same time in depth.
Thank you!
I remember looking for something like this in 2015 and 16 when I wasn't experienced in c# at all,thanks for sharing
Well I hope you like(d) it :)
@@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 "
Check the pinned comment on this video, that error looks like it might be caused by what I address there.
i was looking for a game launcher tutorial for a while lol ty
Glad I could help :)
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?
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.
@@tomweiland thank you so much!
Only at 6:03 but I'm really loving the tutorial - Thank you!
👍
Thanks! Really the only straight on turorial I could find! Appreciate it man! 👌
I'm glad you liked it :)
Thanks for this awesome tutorial, your channel is precious you make tutorial about subjects I personally didn't find any tutorial appart here
Thanks, that means a lot :D
Amazing video.
I bookmarked it and will get back to it when I reach the point of implementing an launcher.
👍
Omg thanks! 🤩 Thats exactly what i need it! Your tutorials are the best! 👌
Thank you, I'm glad you like them :D
Really cool, needed this badly! Thanks a lot. Became a fan of yours.
Thanks, that means a lot :D
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.
Glad it was helpful!
If your having errors, upload your files to dropbox, use a direct link converter, put the links in, and there! it works!
Yeah, a lot of people seem to have issues with Google Drive. OneDrive is another alternative.
@@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.
@@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?
Yes, you can add as many buttons/games as you like.
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 (?)
Thank you, that means a lot to hear :D
This is actually a neat tutorial
Thank you :)
Amazing tutorial, very helpful! Anyone else try to type in the direct download link to try and get the game lmao
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 😅
Brilliant video, thank you!!
I'm glad you liked it!
Genius Tom! 😄
Thank you :D
Thank you for this tutorial. 🙌
You're welcome :)
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.
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).
gameExe = Path.Combine(rootPath, "Build/YourAppName.exe");
Adding "Build/..." fixed my issue.
@@altermann4072 Appreciate you dude!!
This video helped me with the zip download and extraction, thank you!
Great! Glad I could help :)
ty so much! you make awesome tutorials 😁
I'm glad you like them :D
I think this might be big! There are virtually no game launcher tutorials for Unity.
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
@@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!
There are but this is the best one
@@tomweiland Well even some Steam games have their own launchers for updates... :D
@@Enum_Dev thanks :P
Thank for sharing the knowledge!
Glad it was helpful :)
@@tomweiland Just wondering. Is there anyway to pass parameter to game from the launcher?
Found what the answer to my question. Good video.
THIS IS INSANELY GOOD.
Thanks :D
You are a hero.
😅
A really great tutorial, good job
Thanks, glad it was helpful :)
Thank you! This help me really hard !
Glad to hear it :)
Dude you are real hero :)
Thanks :D
If anyone is wondering why the "rootPath = Directory.GetCurrentDirectory();" causes an error just put "using System.IO" on the top (idk if this applies to anyone but it did apply for me) Sometimes it just isn't there
Yep.
did that but still getting error so instead i just put System.IO before the path code thing
Thank you very much for this lesson!
You're welcome :)
Great vid ! Many thanks - love it !
Glad you liked it!
Great job! Thanks!
Glad you liked it :)
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
You'll need to make a second updater application, as programs can't really modify their own files while they're running.
This is so cool! THANK U :D
Glad you like it :)
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?
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
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
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.
Tom Weiland thank you! And yes a did double repost it was accident and I’ll remove it lol
Hey!, I have this error, "Error finishing download: Central Directory corrupt.
It occurs in line 129 (Zipfile.ExtractToDirectory)
Thank you
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.
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.
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).
@@tomweiland thanks for the swift response, what is a hash? And how would you go about coding that in?
This work perfectly
Thank you so much :)
I'm glad it's working!
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
Thanks for the tip :)
Can I put a video or a gif on the Launcher's background, instead of only an image, because an image sounds a bit boring for me :D
If it is possible, how do you do that?
It's almost certainly possible, but I couldn't tell you how. I'm no WPF expert 😅
Fantastic ! Thanks for source code :D
You're welcome :)
@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
And it doesnt work :( i copied everything from MainWindow.xmal.cs and renamed the namespace
Join the Discord server and ask there.
Ehrenmann, wirklicher Ehrenmann
😅
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?
Check the pinned comment :)
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"?
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
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?
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.
Hey man, great video, im at the end of the tutorial but can't get the thing to run, Visual Studio doesnt seem to make an exe and "build" function doesn work, it only shows one error in code, it being "The name 'ZipFile' does not exist in the current context, would you know how to fix it?
Are you missing a using statement at the top? Maybe compare your code to mine on GitHub.
You probably figured it out already, but this might help for someone in the future who runs into the same problem;
You are indeed missing a reference. As was the case with me, "using System.IO;" is appearantly not enough for the code to recognize the ZipFile extension. Add "using System.IO.Compression.FileSystem;" should fix this.
If its not recognized, it means you do not have the reference to this extension enabled.
In the solution explorer right click on References and click "Add reference" Then find "System.Io.Compression.FileSystem" in the list and enable the checkbox in front of it. Hit OK and it should work.
@@combasnalah oh thanks actually had the same problem :)
@@combasnalah This worked to me too, thanks!
@@combasnalah Man i love u
Thanks Man You saved Me!
You're welcome 😅
Hello, thanks a lot for your video. I have a question: what will happen with my saves after update?
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.
Are you an life savior? Because you saved mine
😅
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 ;-)
That sounds like a smart thing to do :P
Nothing happens when I launch the application, even the "play" button stays on "Checking For Update" Do you know why?
Sounds like it's getting stuck somewhere along the way, but I'm not really sure what would cause it, especially if you're not getting any errors. Best I can say is to compare your code to what's on GitHub.
@@tomweiland Exactly I did and it is same as your code
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 ?
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.
@@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
@@malphiem sameeeeeeeeeeeeeeeeeeeee
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?
Wait nvm fixed it i just took out the boolean ("true") and it works
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.
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
You asked about this on Discord right? Did you get it fixed?
7:05 ERROR: The Object "ZipFile" does not exist in the current content. How can I fix it?
Add the necessary using directive at the top of your file. I think it's System.IO.Compression or something.
@@tomweiland System.IO.Compression doesnt add it, i had to right click on my references and add System.IO.Compression.FileSystem. Wasnt able to add it by adding "using" either, very strange
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!
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.
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
@@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 :)
Tom i just wanted to let you know that the link converter desnt work any more and also is there a substitute for it
Give this a try: www.wonderplugin.com/online-tools/google-drive-direct-link-generator/
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..?
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.
Hi im doing the launcher and in the DownloadingGameCompleteCallback there is a error with : ZipFile.ExtractToDirectory(gameZip, rootPath, true);
Can someone pls help
Check the pinned comment.
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?
Try this: stackoverflow.com/a/20073418
Alternatively you can take advantage of a library, such as this one: github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit
@@tomweiland Alright otherwise I'll join ur Discord. Thhnxxx
If your gonna make a launcher for multiple platforms you will need to use something like Electron or QT creator
Yeah, this is mainly meant to just show people the basics.
is this part 1 of this tutorial? Seems like it doesn't start at the beginning. I'd like a little more info on the set-up and pre-requirements to get this set up.
Also, would this work if you want a launcher to be able to launch multiple games?
Yes, this is part 1 (the only part). What extra info exactly are you after?
This won't work with multiple games out of the box, but modifying it support more than 1 game should be relatively trivial-all the download/install _logic_ should be the same, but you'll obviously have to change download links and stuff.
I guess I am not quite advanced enough at coding yet to use this. I feel I’m not understanding all of the terminology you use, and I don’t have experience with XAML or WPF. What basic concepts do I need to study before I come back to this? Thanks for your time:)
You know that this will always download the Build.zip file, no matter if its downloading an "Update" or the game ? So there is no difference.
Just an idea: Do zip files named as the version of the update (like Update-1.0.1.zip) and if the launcher installs the game, it downloads them one by one and for updating it downloads just one by one for actual local version to current version on server.
But anyways: great tutorial like always :)
Yeah, I'm aware. The only reason we added two different launcher states was to display different text to the user. I'm not entirely sure what you mean by "it downloads them one by one" though-I don't see why you would want to download files from previous game versions...that's a waste of time and resources.
@@tomweiland this way the archives whould only contain changed Files and can be downloaded very fast 😉
Problem is that then it needs to Download one by one so all changed Files are processed. Thats btw how the Publisher Gamigo AG's Fiesta Online Launcher works. When you have an old Version you see Patch by Patch downloading but very fast.
Hmm, interesting. That doesn't sound like it would work with Drive though (at least not the way we've done it), since you're not updating the zip file, but instead adding new ones, which means you'd have more download links that the launcher isn't aware of.
@@tomweiland the links could be in a separate Text File (Line by line) or Something.
This way it could work with Google Drive too.
That's exactly what I was thinking of when I added "(at least not the way we've done it)" :P
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?
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.
How does the code work when you update and there is already a build folder for unity. Whenever this happens to me I get an error since it will not allow me to overwrite existing files. I saw that ZipFile.ExtractToDirectory has an additional bool parameter but I cannot add that in my project, as it claims it cannot convert bool to System.Text.Encoding. I know that the bool parameter essentially says whether or not to overwrite files, unfortunately I can't use that at all.
If there is a solution? I will be happy to hear if so, great video by the way.
If you don't have the method that takes a bool as one of its parameters, then you're probably using .NET Framework (the methods are a bit different than in .NET Core, which I didn't realize before making this video). You could just check if the file exists, and if it does, delete it before extracting the new one.
@@tomweiland I was able to get it resolved. Thanks.
Thanks it helped me a lot
Glad to hear it :)
@@tomweiland is devlog #45 coming
Not quite, but there is a new video coming as soon as I finish editing it!
Great video! Is it possible to display a webpage on the background instead of an image?
Probably? I'm not sure though.
@@tomweiland Already figure it out by changing to web source, but I'm having error when creating WPF App (.NET Core) it's stating to use preview versions. Would you mind telling what version of SDK you're using? I'm using VS 2019 with 5.0.408 core SDK but I can't create WPF App (.NET Core) Project. Thank you! :D
auto update that sound amazing
one question this system works with the offline games as well ?
Your game doesn't need to be multiplayer for this to work, if that's what you're asking, but without an internet connection no updates will be able to happen.
@@tomweiland yes i know that if saman dont have internet connection is the update is not happen is obvious if saman dont have indernet the update is not happen
Hm weird I can only open that project with VS 2019 not 2017 or 2015 🤔
It doesnt matter but I just wonder why it is like that^^
Thanks again for the GitHub and all of ur Vids
That is indeed strange-not sure why that might be 🤔
@@tomweiland Still thanks for ur fast reply 😊
Awesome. 🤩
Glad you liked it!
THIS SAVED ME THANK YOU
Glad I could help :)
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?
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.
thank you so much Sir!
You're welcome :)
Привет. За видео большое спасибо. Вопрос: если у меня в игре есть сохранение, то при скачивании новой версии что будет с файлом сохранения?
I'm guessing your other comment is a translation of this one, so take a look at my response to that.
Thank you for that explanation ♥.
But explain how to add more games in launcher 🙃👍🏻.
It's literally the same code-you'll just need to specify which game should be downloaded/updated/launched.
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?
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.
@@tomweiland Oh lmao that was the problem, I had to run the launcher as administrator. Thanks!
Hey, is there a way to select the location of the game files before installing the game (just like in a setup wizard)?
You could make a button for that.
On my non tech savvy friends computers, they are required to download the .NET framework to launch my GameLauncher. Is this always going to be the case? Also their antivirus doesnt like the .dll files
.NET Framework is included in Windows. If you built the launcher with .NET Core your friends would have to install that-the way around it is to either switch to .NET Framework or to publish the launcher with the _self-contained_ option enabled (which will include .NET Core in the launcher build).
As for the antivirus issue, I think you'll have to get a code signing certificate to get around that, which I believe costs money (though I'm not 100% sure, I haven't really looked into it).
Awesome video the only problem im having is that on line 129 it says The name 'ZipFile' does not exist in the current context would you know what's up with that?
Did you add the necessary namespace?
@@tomweiland If I try putting my game zip in it then the extract to directory does not work
@@tomweiland Im not sure what name space you mean
_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 ?._
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.
Thanks.
Its possible to earn good money with this launcher app: 2000-5000$ easily.
Cant write here in details. But good tutorial to make "fake" launcher.
Are you talking about scams or malware distribution or something?
I know me asking probably won't change your mind, but please don't use it for that...