Launcher with auto patch

Results 1 to 9 of 9
  1. #1
    Registered TaTang Jaiyim is offline
    MemberRank
    Sep 2014 Join Date
    7Posts

    information Launcher with auto patch

    Now I'm making a launcher(Emil Chornicles Online) but I don't know how to make it with auto patch or auto update in Visual Basic
    I just wanna know how to make launcher with auto patch in VB or another program

    Thank you and I'm sorry. My English is not good.


  2. #2
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,554Posts

    Re: Launcher with auto patch

    GamePatcher
    https://github.com/Agasper/GamePatcher


    A game patcher for Windows/PC games. Can patch huge files with small patch.

    This page contains an installation and using guide


    Patcher

    In root of builded patcher create folder 'patcher'. It must contain next files:

    configuration.xml - a patcher configuration file
    game_logo.png - 248x338 game logo displayed at the form
    publisher_logo.png - 248x112 publisher logo displayed at the form
    version.txt - file that contain 1 integer digit defining current version number

    configuration.xml
    Code:
    #!xml
    <?xml version="1.0"?>
    <root>
        <!-- used in form title -->
        <game_name>TestGame</game_name>
        <!-- launches when play button pressed -->
        <game_exe>Test.exe</game_exe>
        <!-- opens in default browser when game logo clicked-->
        <game_url>http://coolgame.com</game_url>
        <!-- URL of file contains last version of game client-->
        <check_version_url>http://coolgame.com/version.txt</check_version_url>
        <!-- URL of directory contains patched-->
        <patches_directory>http://coolgame.com/patches/</patches_directory>
        <!-- URL with news page-->
        <news_url>http://coolgame.com/news_for_patcher.html</news_url>
        <!-- opens in default browser when publisher logo clicked-->
        <publisher_url>http://coolpublisher.com</publisher_url>
    </root>
    Patch builder



    Create source directory in the root of patch builder. Place game clients in folders with name of it's version. Game clients must contains configured patcher with correct version.txt file matching with the index of folder (name). For example:


    example

    Run patch builder and select from which to which version build a patch. Step must be one, because patcher supports only incremental update. Click "Make patch". Result patch will be placed in output folder with name like 1_2.patch

    P.S. You may place this patch to any web hosting (even Dropbox)

    Code based on this https://github.com/einaros/RsyncNet

    License: MIT


    Credits go to:
    Alexander Agasper
    Russia, Rostov-on-Don
    Alexandr Agasper - independent developer
    https://github.com/Agasper


    ===============
    My two coppers:
    I've used this in the past and it does very well for what it is.
    If you're looking to make it more than just a launcher / patcher, this is still a good start.

    -never reinvent the wheel, when you can use the spare-


    - - - Updated - - -

    Article about the project found at this link:
    https://habrahabr.ru/post/163791/
    (Translated below)

    Spoiler:
    Development of the game patcher
    Game development *, .NET *
    After writing the first game in front of us there was a problem, which we have not even thought about before. This development of the game patcher. we have identified the following requirements for our patcher:

    Support Unity Games
    User friendly
    Showing gaming news
    Versatility for all games developed by our studio
    Flexible settings
    And the most important thing: the ability to make small patches of large files


    Link to source patcher at the end.

    As usual before reinventing the wheel, I'm looking for ready-made solution to the problem. But either I googled bad, or only meets the requirements of this M2H Patcher with Unity Asset Store.
    In the introduction, we spent a few days, and propolzovalis them for about a month (up to the first and also the last of breakage). One day patcher refused to do patch. After spending hours on the investigation I found out the reason.
    The fact that this used to work patcher utility bsdiff & bspatch . For the utility must bsdiff max (17 * n, 9 * n + m) + O (1) memory. It so happens that the best machine in the office was only 4 GB of RAM, and a resource file was over 600 MB. Generally bsdiff refused to work with him (before the creation of the patch was obscene 30+ minutes).

    Then I decided to collect all the same bike.

    Algorithm

    Now was naguglit comparison algorithm large binary files. Worthy candidates were two. It Rsync and suffix sorting algorithm of bsdiff.
    Since the second were problems, I stayed on the ground.
    Its essence is as follows. Splitting source file into equal-sized pieces (the chunks from the English. Chunk).
    For each chunk believe two hash: strong and weak. Strong Hash - this is the usual MD5. Weak hash - a ring hash . Its feature is that if the hash from n to n + S-1 is equal to R, then the sequence of bytes from n + 1 to n + S can be calculated based on the R, byte n and byte n + S without the need to take into account the bytes lying within this interval.
    Similarly, you need to calculate the resulting file. At the exit we should get two sequences hash chunks.
    Next, we compare the weak hashes to files in seeking equal chunks. If the hashes match, the compare hashing strengths. The key of the algorithm is to create two signatures - fast and stable. Fast is used as a filter. Persistent used for a more accurate test.
    At the exit we have a list of different chunks, which are recorded in the patch.

    Creating a patch


    For our game well-suited system, where the version number is indicated by an integer. So we usually have a bunch of folders with different versions of the current project: 1, 2, 3, etc.






    The first thing to be done after pressing the button - is to determine which files have changed, delete, add. To do this, compare folders through

    string[] files1 = Directory.GetFiles(folder1, "*.*", SearchOption.AllDirectories); string[] files2 = Directory.GetFiles(folder2, "*.*", SearchOption.AllDirectories);



    and maintain a list of changes. If a file is added, then consider md5. If changed, we consider the old and new md5. These hashes are needed in order to determine whether it is possible to apply the patch, and if it is well established.
    These data are collected in an archive with maximum compression via SharpZipLib . In the end we appends to a file patch_info.txt which stores data on the size of the chunk, a list of files with their hashes and actions.
    Example:


    1024 R star-draft_Data\level1 M settings.xml 5e54da0d0c1dfca2bbc623979b7bceef 7a64fb8bc102b9d6bc0862ca63cdbb8d A star-draft_Data\level0 a3d14f5ed8d05164d59025cc910226ea M star-draft_Data\resources.assets 02466b9218cbf482d562570d8c0c90c8 20f1f88b5036a168bdd26fe7f4f9dadd M patcher\version.txt c81e728d9d4c2f636f067f89cc14862c c4ca4238a0b923820dcc509a6f75849b



    * R - removed, A - added , M - modified
    Depending on the action there is a file itself, or a patch for the older version.
    Now this patch can be put on any web hosting. I TESTED FOR dropbokse.

    It is important to note that for the normal health system in the game folder should be based on the file. \ Patcher \ version.txt. It stores information about the current version of the game. It reads the patcher itself as a result of changes in the process of applying the patch. Patch builder tries to follow so you do not make a mistake, and the version in the file matches the version specified in the folder name.

    patcher (screenshot -- On the left should be logos and games publisher, and the right news)



    When you start the patcher reads the configuration file on the road ./patcher/configuration.xml and checks for validity.
    Sample file with comments:


    <?xml version="1.0"?> <root> <!-- Используется в заголовке окна --> <game_name>TestGame</game_name> <!-- Запускается при нажатии кнопки "Играть" --> <game_exe>Test.exe</game_exe> <!-- Открывается в браузере по умолчанию при нажатии на логотип игры--> <game_url>http://coolgame.com</game_url> <!-- URL файла с последней версией игры --> <check_version_url>http://coolgame.com/version.txt</check_version_url> <!-- URL каталога с патчами --> <patches_directory>http://coolgame.com/patches/</patches_directory> <!-- URL новостей игры --> <news_url>http://coolgame.com/news_for_patcher.html</news_url> <!-- Открывается в браузере по умолчанию при нажатии на логотип издателя--> <publisher_url>http://coolpublisher.com</publisher_url> </root>
    ?>
    <?xml version="1.0"?> <root> <!-- Используется в заголовке окна --> <game_name>TestGame</game_name> <!-- Запускается при нажатии кнопки "Играть" --> <game_exe>Test.exe</game_exe> <!-- Открывается в браузере по умолчанию при нажатии на логотип игры--> <game_url>http://coolgame.com</game_url> <!-- URL файла с последней версией игры --> <check_version_url>http://coolgame.com/version.txt</check_version_url> <!-- URL каталога с патчами --> <patches_directory>http://coolgame.com/patches/</patches_directory> <!-- URL новостей игры --> <news_url>http://coolgame.com/news_for_patcher.html</news_url> <!-- Открывается в браузере по умолчанию при нажатии на логотип издателя--> <publisher_url>http://coolpublisher.com</publisher_url> </root>




    First of all, the patcher will check its version of ./patcher/version.txt file. Then it will check the latest version of the game from the link settings. If the latest version of the update process under the scheme more than the start:


    for (int i = current_version; i < last_version; i++) { DownloadPatch(URL + string.Format("{0}_{1}", i, i+1)); ApplyDownloadedPatch(); }
    <last_version; i ++)
    for (int i = current_version; i < last_version; i++) { DownloadPatch(URL + string.Format("{0}_{1}", i, i+1)); ApplyDownloadedPatch(); }




    To apply the patch, you must first get a list of changed files. So the first thing we get from the downloaded archive patch_info.txt, parse it and looping cycle file.
    If the file to be removed, then remove. If added, then unpack the archive. If changed then use the patch if the hashes match (so as not to spoil it).
    At the end do not forget to check out the new md5 hash.

    I tried to make sure that any exception to the patcher had a text description and solutions.
    Just patcher is already localized into Russian and English languages ​​.NET tools

    Statistics

    To test I immediately shoved it in our game client on Unity3D, which refused to work bsdiff.
    Client version 1 - 1669 Mb
    Client Version 2 - 1692 Mb (we added modelku with a bundle of textures)
    Size of patch size chunks 1 KB and maximum compression of the archive - 11.8 Mb, which is very similar to the results of the patcher with bsdiff'om
    Time create a patch on my car less than a minute, and the use of about 10 seconds.

    The Source: https://github.com/Agasper/GamePatcher



  3. #3
    Infraction Banned Demoter is offline
    MemberRank
    Feb 2017 Join Date
    55Posts

    Re: Launcher with auto patch

    @DNC can i use this for other game also?or this is source for what game?

  4. #4
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,554Posts

    Re: Launcher with auto patch

    Quote Originally Posted by Demoter View Post
    @DNC can i use this for other game also?or this is source for what game?
    Works great on any game bro

    - - - Updated - - -

    Source folder:
    Folder1 = base game files (all of them)
    Folder2 = base game files (all of them) - Then put in your modified files over the top of this folder and/or remove the files that get removed.

    Run the PatchBuilder (point to version 1 and version 2)

    The Output folder will now contain a very small patch file that contains the bdiff of the 2 versions.


    build(folder).jpg
    Primary build folder layout
    IMAGE 1 Below
    Click image for larger version. 

Name:	build(folder).jpg 
Views:	4 
Size:	23.3 KB 
ID:	162460

    build(folder)_with_source(subfolder).jpg
    source subfolder of your build folder (contains version 1, 2, 3, etc)
    (I highly recommend putting it like this 00000001, 00000002, 00000003, etc --- as it seemed to hate going above 9 otherwise)
    IMAGE 2 Below
    Click image for larger version. 

Name:	build(folder)_with_source(subfolder).jpg 
Views:	3 
Size:	6.9 KB 
ID:	162461


    patcher(folder).jpg
    Primary patcher folder layout
    IMAGE 3 Below
    Click image for larger version. 

Name:	patcher(folder).jpg 
Views:	3 
Size:	26.4 KB 
ID:	162462


    patcher(folder)_with_patcher(subfolder).jpg
    patcher subfolder of the primary patch folder
    Contains the following:
    Code:
    configuration.xml - a patcher configuration file
    game_logo.png - 248x338 game logo displayed at the form
    publisher_logo.png - 248x112 publisher logo displayed at the form
    version.txt - file that contain 1 integer digit defining current version number
    IMAGE 4 Below
    Click image for larger version. 

Name:	patcher(folder)_with_patcher(subfolder).jpg 
Views:	3 
Size:	18.7 KB 
ID:	162463

    - - - Updated - - -

    Inlined the images, they look small and there are 4 of them.
    Be sure you click each one for the better view popup.
    Last edited by DNC; 14-02-18 at 12:25 PM. Reason: had 1 typo ;0)



  5. #5
    Infraction Banned Demoter is offline
    MemberRank
    Feb 2017 Join Date
    55Posts

    Re: Launcher with auto patch

    very usefull nice job @DNC and thank you for sharing

  6. #6
    Infraction Banned Demoter is offline
    MemberRank
    Feb 2017 Join Date
    55Posts

    Re: Launcher with auto patch

    @DNC bro i don't need find checksum every patch this is a direct maker right?

  7. #7
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,554Posts

    Re: Launcher with auto patch

    run the patch builder every patch.
    previous version increments by 1, new version updates by 1.
    source folder needs a Full copy of the previous version and new version.
    IE
    0000001
    0000002
    0000003
    0000004
    0000005

    builder would need left value 0000004 and right value 0000005

    output folder would receive the new patch specific to version 0000004 to 0000005



  8. #8
    Registered TaTang Jaiyim is offline
    MemberRank
    Sep 2014 Join Date
    7Posts

    Re: Launcher with auto patch

    @DNC
    I want to know. What's flie has to be in folder client for run game ? and
    I can't start my game. It told me : Can't verify current version of files. Please reinstall game.
    Last edited by TaTang Jaiyim; 27-03-17 at 06:19 PM.

  9. #9

    Re: Launcher with auto patch

    I have a question... I followed all the steps and everything in my launcher looks amazing. However, when I run the patch builder... it runs without error but leaves no patch. I have the full unchanged client in folder 1, and my changed client in folder 2. Anyone else run into this issue?

    Update: The problem was that the patch I was trying to do was too small. Got it to work, however when someone puts the patcher files in a game client not on the C drive, it states the folder cannot be found :(
    Last edited by PhoenixServers; 08-12-17 at 03:49 AM.



Advertisement