Jump to content
champ

GitHub Based Game Client Updater

Recommended Posts

Hi folks,

 

I have promised a tutorial the other day on how to create a game updater but unfortunately I have been quite busy and to be completely honest it's easier and quicker for me to write something rather than create a high quality guide.

 

The advantage of using this patcher is that you do not need to keep track of your patches or create any sort of zips, simply commit your changes to your repository containing your client and the updater will automatically sort everything out for you :) 

 

This patcher requires only one configuration file which is called appsettings.json. In there you need to set up a few things for the patcher to work correctly, those are:

  1. RepositoryName - set this to the name of your public repository containing your game client.
  2. ApiKey - you need to generate an api key and store it inside appsettings.json file, to create your api key, go to this link. This api key requires only repo:status priveleges (access to read commits from public repositories), you can set other privileges at your own risk. Please ensure you set no this token expiration date to "No expiration".
  3. Owner - GitHub username of account that is the owner of the repository. In other words, if I created a repository called kopClient, then I would change my appsettings RepositoryName to kopClient and change Owner to champ.

 

This solution is written in C#, which consists of two projects:

  1. PkodevUpdater project - WPF application with the GUI of the updater.
  2. UpdaterLibrary - .NET core library which contains the main functionality of the updater.

 

Capture1.PNG

 

This updater is free to use and was released for PkoDev.net specifically, therefore I kindly ask to not post this updater outside of PkoDev.net community.

 

To compile this project you need Visual Studio 2019 and above, as well as .NET 5.0 framework.

 

Capture.PNG

 

 

Please bear in mind there are a few things that could be improved and those were marked with TODO comments. For instance:

  1. The method that updates client hash accepts a hash string param but the code does not check if that string is a valid hash.
  2. When a file is deleted and the directory where this file was deleted from is empty, the launcher does not delete that directory or the corresponding parent directory.

 

Please let me know if you come across any issues or bugs. If you would like to contribute, then please fork the repository and create a PR.

 

The image used in the updater is a placeholder only and I strongly suggest that you do not use anything that belongs to King of Pirates without my consent.

 

Link to the repository: click me

  • Like 4
  • Thanks 3

Share this post


Link to post
Share on other sites
32 minutes ago, Ropedann said:

Классаная идея!)

Согласен с Вами. Не знаю, почему мне данная идея не пришла в голову, когда был свой сервер 🤷‍♂️ В любом случае, надеюсь, что кому-то пригодится.

Share this post


Link to post
Share on other sites

Да блин это гениально! =D Я писал лаунчер на основе идеии что клиент лежит на фтп сервере и есть софт который гененрирует хэш суммы для каждого файла и измененые файлы заносит в отдельный список после игрок уже получает список этих файлов и качает. а используя гит это все можно опустить)

 

19 часов назад, champ сказал:

Согласен с Вами. Не знаю, почему мне данная идея не пришла в голову, когда был свой сервер 🤷‍♂️ В любом случае, надеюсь, что кому-то пригодится.

 

Share this post


Link to post
Share on other sites

I loved the idea.

However, I tried to put 5 plain text files inside a folder to do a test. The program creates the folder and sometimes downloads one file or another, but never all of them.

Could you tell me what I'm doing wrong?

Share this post


Link to post
Share on other sites
On 8/2/2022 at 4:24 PM, farofa0 said:

I loved the idea.

However, I tried to put 5 plain text files inside a folder to do a test. The program creates the folder and sometimes downloads one file or another, but never all of them.

Could you tell me what I'm doing wrong?

I fixed and improved it a little bit. I will make a pull request later.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/5/2022 at 4:01 PM, farofa0 said:

I fixed and improved it a little bit. I will make a pull request later.

Thank you, what was the issue?

Share this post


Link to post
Share on other sites
On 3/16/2022 at 5:05 PM, champ said:

Hi folks,

 

I have promised a tutorial the other day on how to create a game updater but unfortunately I have been quite busy and to be completely honest it's easier and quicker for me to write something rather than create a high quality guide.

 

The advantage of using this patcher is that you do not need to keep track of your patches or create any sort of zips, simply commit your changes to your repository containing your client and the updater will automatically sort everything out for you :) 

 

This patcher requires only one configuration file which is called appsettings.json. In there you need to set up a few things for the patcher to work correctly, those are:

  1. RepositoryName - set this to the name of your public repository containing your game client.
  2. ApiKey - you need to generate an api key and store it inside appsettings.json file, to create your api key, go to this link. This api key requires only repo:status priveleges (access to read commits from public repositories), you can set other privileges at your own risk. Please ensure you set no this token expiration date to "No expiration".
  3. Owner - GitHub username of account that is the owner of the repository. In other words, if I created a repository called kopClient, then I would change my appsettings RepositoryName to kopClient and change Owner to champ.

 

This solution is written in C#, which consists of two projects:

  1. PkodevUpdater project - WPF application with the GUI of the updater.
  2. UpdaterLibrary - .NET core library which contains the main functionality of the updater.

 

Capture1.PNG

 

This updater is free to use and was released for PkoDev.net specifically, therefore I kindly ask to not post this updater outside of PkoDev.net community.

 

To compile this project you need Visual Studio 2019 and above, as well as .NET 5.0 framework.

 

Capture.PNG

 

 

Please bear in mind there are a few things that could be improved and those were marked with TODO comments. For instance:

  1. The method that updates client hash accepts a hash string param but the code does not check if that string is a valid hash.
  2. When a file is deleted and the directory where this file was deleted from is empty, the launcher does not delete that directory or the corresponding parent directory.

 

Please let me know if you come across any issues or bugs. If you would like to contribute, then please fork the repository and create a PR.

 

The image used in the updater is a placeholder only and I strongly suggest that you do not use anything that belongs to King of Pirates without my consent.

 

Link to the repository: click me

 

{
  "Title": "Tales of Pirates Game Updater by PkoDev",
  "RepositoryName": "TechiGG",
  "ApiKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "Owner": "lastpirates",
  "ProductHeader": "pkodev-updater",
  "ClientCommitAt": ""
}

 

Operación Recompilar iniciada...
1>------ Operación Recompilar todo iniciada: proyecto: UpdaterLibrary, configuración: Release Any CPU ------
Se ha restaurado C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\UpdaterLibrary.csproj (en 10 ms).
Se ha restaurado C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\PkodevUpdater\PkodevUpdater.csproj (en 60 ms).
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\OctokitGithubClientFactory.cs(17,30,17,48): warning CS8766: La nulabilidad de los tipos de referencia del tipo de valor devuelto de "GitHubClient? OctokitGithubClientFactory.CreateGitHubClient()" no coincide con el miembro "GitHubClient IOctokitGithubClientFactory.CreateGitHubClient()" implementado de forma implícita (posiblemente debido a los atributos de nulabilidad).
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\CommitFile.cs(5,23,5,27): warning CS8618: El elemento propiedad "Name" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\CommitFile.cs(7,23,7,26): warning CS8618: El elemento propiedad "Url" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\CommitFile.cs(9,23,9,29): warning CS8618: El elemento propiedad "Status" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(5,23,5,37): warning CS8618: El elemento propiedad "RepositoryName" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(7,23,7,29): warning CS8618: El elemento propiedad "ApiKey" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(9,23,9,28): warning CS8618: El elemento propiedad "Owner" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(11,23,11,28): warning CS8618: El elemento propiedad "Title" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(13,23,13,36): warning CS8618: El elemento propiedad "ProductHeader" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\Models\AppSettings.cs(15,23,15,37): warning CS8618: El elemento propiedad "ClientCommitAt" que no acepta valores NULL debe contener un valor distinto de NULL al salir del constructor. Considere la posibilidad de declarar el elemento propiedad como que admite un valor NULL.
1>UpdaterLibrary -> C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\UpdaterLibrary\bin\Release\netcoreapp3.1\UpdaterLibrary.dll
1>Compilación del proyecto "UpdaterLibrary.csproj" terminada.
2>------ Operación Recompilar todo iniciada: proyecto: PkodevUpdater, configuración: Release Any CPU ------
2>C:\Users\el_me\OneDrive\Desktop\PkodevUpdater-main\PkodevUpdater-main\PkodevUpdater\forms\UpdaterWindow.xaml(62,108,62,140): error CS1061: "UpdaterWindow" no contiene una definición para "StartGameBtn_MouseLeftButtonDown" ni un método de extensión accesible "StartGameBtn_MouseLeftButtonDown" que acepte un primer argumento del tipo "UpdaterWindow" (¿falta alguna directiva using o una referencia de ensamblado?)
2>Compilación del proyecto "PkodevUpdater.csproj" terminada -- ERROR.
========== Recompilar todo: 1 correctos, 1 incorrectos, 0 omitidos ==========

I get this error when compiling

Share this post


Link to post
Share on other sites

@champ sorry to bother would you be able to walk me through this if possible? I have downloaded your files but am not sure where to edit or put them into my client files.

 

I appreciate the assistance and such an amazing tool. Good Work!

Share this post


Link to post
Share on other sites

Hi, if you’re unsure how to compile and/ or have no experience with C#, then I suggest you use a different launcher. There’s plenty available on the forum :)

  • Thanks 1

Share this post


Link to post
Share on other sites
42 minutes ago, champ said:

Hi, if you’re unsure how to compile and/ or have no experience with C#, then I suggest you use a different launcher. There’s plenty available on the forum :)

Oh I have compiled it sir just not sure where to put the compiled file. Just into the client?

 

Otherwise if you have any recommendations for a good launcher / updater I would appreciate it as I see you know this topic well.

Share this post


Link to post
Share on other sites

After compiling there are alot of files in my debug folder. I see the launcher there and it runs fine. Just not sure what files I need to move across.

 

If your available on discord for 5mins. I am more then happy to pay for your time. @champ

Share this post


Link to post
Share on other sites

Hello there. I am getting back to work with Tales of Pirates (as a hobby from now on).

I am trying to collect the latest stuff related to Client & Server (but I want to work on them from the source code) since I lost the HD from my days. So, I was thinking on creating a client updater and website with clean architecture but let me tell you yours is fabulously coded with the quick view I took from it. I'll probably end up using yours, since as a plus your idea of using GitHub as the Client host is a great idea and better idea than most I have had back in my days and nowadays. Lowering the usage of any PVS resources.

 

Edited*
Didn't take a look at the PKO-Launcher (which has more appealing UI) yet since it clearly says, "Use at your own risk." and it'll take longer to understand that quote lol. Probably is just something related to ownership but i could use code in it.

 

Thanks for it.

I'll let you know if I can contribute to it or have any doubt.

Edited by Blanquitoh

Signature.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...