In the game development and maintenance process, the client is constantly updated, and every update will be released.
Update a patch package to update the old client to make it a new client. The patch package should contain
The minimum number of resources updated to the new client (the maximum number of resources is that the entire new client overwrites the old one)
Update Program Read an update script to add, overwrite, and delete files on the old client.
Update the old client. When the number of updates is relatively small, the update script can be sorted by resources.
The personnel write the script by themselves, but when there are too many updates and a large amount of resources, it is very easy to update the script by hand.
It is necessary to develop a tool to automatically find the differences between the two versions and generate an update script automatically.
Comparison Method:
Assume that there are two folders A and B. A is the old client and B is the new client. Algorithm Come
Identify the differences between the two folders and generate a script, which explicitly indicates that some operations can convert A to B
.
1. traverse all file names in folder A, including sub-directories, and store them in O.
2. traverse all the file names in folder B, including subdirectories, and store them in N.
3. Find the files to be added to the old version:
Traverse each file in N to check whether the file exists in O. If the file does not exist, it is the file to be added.
, And store it in Fa.
4. Find the files to be deleted in the old version:
Traverse each file in O to check whether N exists. If n exists, the file needs to be deleted,
And store it in FD.
5. Find the files to be overwritten in the old version:
Traverse each file in N to find that this file also exists in O. Here, the resource package used by the game is excluded,
They will be detected and updated in subsequent operations. If two identical files are found, only
If the content of one byte is different, the file in the old version needs to be overwritten by the file in the new version.
6. Update the game resource package:
Traverse each file in N as the game resource package and find whether
This file also exists. If two files have the same content, if one byte is different, it indicates
If the content is different, jump into the updating operation of the bread.
A. traverse all the files in the old package and store them in the Po.
B. traverse all the files in the new package and store them in PN.
C. Find the files to be added in the old package:
Traverse each file in PN, find out what is not in Po, and store it in PA.
D. Find the files to be deleted in the old package:
Traverse each file in the Po, find out what is not in PN, and store it in PD.
E. Find the files to be overwritten in the old package:
Traverse each file in the Po. If this file exists in the Pn, if there is a byte between them
This indicates that the file in the old package needs to be overwritten and stored in PR.
Through the above process, the differences between the two folders have been identified, then you can generate an update script based on the difference information,
In addition, the old version needs to be added, overwritten, and included in the package. The overwritten files are extracted to generate a resource package.
The following is a version comparison tool I wrote:
Finally, all the resources to be added and replaced are copied to the Resource Directory.
The generated update script is similar to the following:
<Versioncompare>
<Version old = "1.0" New = "1.1"/>
<Resource Path = "./resource/"/>
<Updateactions>
<Fileactions>
<Add from = "0.dat" to =" skybox/newpictures/anc_elephantear1.png "/>
<Add from = "1.dat" to =" skybox/newtexts/apple.txt "/>
<Add from = "2.dat" to =" skybox/newtexts/pear.txt "/>
<Add from = "3.dat" to =" skybox/newtexts/orange. txt "/>
<Add from = "4.dat" to =" terrainmaterial/goodlcuk.doc "/>
<Add from = "5.dat" to =" watercolour/half animal "/>
<Add from = "6.dat" to =" abc1.sgp "/>
<Delete where = "skybox/bm00500skybox_bk.jpg"/>
<Delete where = "shadowlayer/terrainblock16.tga"/>
<Delete where = "shadowlayer/terrainblock36.tga"/>
<Delete where = "shadowlayer/terrainblock44.tga"/>
<Delete where = "shadowlayer/terrainblock63.tga"/>
<Replace from = "7.dat" toreplace =" 00500.xml"/>
<Replace from = "8.dat" toreplace =" shadowlayer/terrainblock46.tga "/>
<Replace from = "9.dat" toreplace =" skybox/skybox. Material "/>
<Replace from = "10.dat" toreplace =" terrainmaterial/terrainmaterials. Material "/>
<Replace from = "11.dat" toreplace =" watercolour/watercolour_bm00500.tga "/>
</Fileactions>
<Packageactions package = "shadowlayer/abc1.sgp">
<Add from = "12.dat" to =" complex skybox/terrainblock7.tga "/>
<Delete where = "00002.dat"/>
<Delete where = "00002. dat. Addons"/>
<Delete where = "00002. xml. Bak"/>
<Delete where = "bf1_2.xml. Bak"/>
<Replace from = "13.dat" toreplace =" AAA. xml "/>
<Replace from = "14.dat" toreplace =" skybox/lava_01.tga "/>
<Replace from = "15.dat" toreplace =" skybox/skybox. Material "/>
<Replace from = "16.dat" toreplace =" Duplicate skybox/skybox. Material "/>
</Packageactions>
<Packageactions package = "skybox/abc1.sgp">
<Add from = "17.dat" to =" shadowlayer/bm00500skybox_bk.jpg "/>
<Delete where = "skybox/bf4242skybox_bk.dds"/>
<Delete where = "skybox/bf4242skybox_dn.dds"/>
<Delete where = "skybox/bf4242skybox_fr.dds"/>
<Delete where = "skybox/bf4242skybox_lf.dds"/>
<Delete where = "skybox/bf1_2skybox_rt.dds"/>
<Delete where = "skybox/bf4242skybox_up.dds"/>
<Delete where = "skybox/lava_01.tga"/>
<Delete where = "skybox/skybox. Material"/>
<Delete where = "skybox/thumbs. DB"/>
<Replace from = "18.dat" toreplace =" AAA. xml "/>
<Replace from = "19.dat" toreplace =" Duplicate skybox/skybox. Material "/>
</Packageactions>
<Packageactions package = "terrainmaterial/abc1.sgp">
<Add from = "20.dat" to =" Create a folder/bm00500terrain.jpg "/>
<Delete where = "watercolour/bf4242wateredge. Dds"/>
<Replace from = "21.dat" toreplace =" AAA. xml "/>
<Replace from = "22.dat" toreplace =" skybox/lava_01.tga "/>
<Replace from = "23.dat" toreplace =" skybox/skybox. Material "/>
<Replace from = "24.dat" toreplace =" Duplicate skybox/skybox. Material "/>
</Packageactions>
<Packageactions package = "watercolour/abc1.sgp">
<Add from = "25.dat" to =" skybox/watercolour_bm00500.tga "/>
<Delete where = "shadowlayer/shadowlayer.rar"/>
<Delete where = "shadowlayer/terrainblock0.tga"/>
<Delete where = "shadowlayer/terrainblock1.tga"/>
<Delete where = "shadowlayer/terrainblock10.tga"/>
<Delete where = "shadowlayer/terrainblock11.tga"/>
<Delete where = "shadowlayer/terrainblock12.tga"/>
<Delete where = "shadowlayer/terrainblock13.tga"/>
<Delete where = "shadowlayer/terrainblock14.tga"/>
<Delete where = "shadowlayer/terrainblock15.tga"/>
<Delete where = "shadowlayer/terrainblock16.tga"/>
<Delete where = "shadowlayer/terrainblock17.tga"/>
<Delete where = "shadowlayer/terrainblock18.tga"/>
<Delete where = "shadowlayer/terrainblock19.tga"/>
<Delete where = "shadowlayer/terrainblock2.tga"/>
<Delete where = "shadowlayer/terrainblocktga TGA"/>
<Delete where = "shadowlayer/terrainblock21.tga"/>
<Delete where = "shadowlayer/terrainblock22.tga"/>
<Delete where = "shadowlayer/terrainblock23.tga"/>
<Delete where = "shadowlayer/terrainblock24.tga"/>
<Delete where = "shadowlayer/terrainblock25.tga"/>
<Delete where = "shadowlayer/terrainblock26.tga"/>
<Delete where = "shadowlayer/terrainblock27.tga"/>
<Delete where = "shadowlayer/terrainblock28.tga"/>
<Delete where = "shadowlayer/terrainblock29.tga"/>
<Delete where = "shadowlayer/terrainblock3.tga"/>
<Delete where = "shadowlayer/terrainblock30.tga"/>
<Delete where = "shadowlayer/terrainblock31.tga"/>
<Delete where = "shadowlayer/terrainblock32.tga"/>
<Delete where = "shadowlayer/terrainblock33.tga"/>
<Delete where = "shadowlayer/terrainblock34.tga"/>
<Delete where = "shadowlayer/terrainblock35.tga"/>
<Delete where = "shadowlayer/terrainblock36.tga"/>
<Delete where = "shadowlayer/terrainblock37.tga"/>
<Delete where = "shadowlayer/terrainblock38.tga"/>
<Delete where = "shadowlayer/terrainblock39.tga"/>
<Delete where = "shadowlayer/terrainblock4.tga"/>
<Delete where = "shadowlayer/terrainblock40.tga"/>
<Delete where = "shadowlayer/terrainblock41.tga"/>
<Delete where = "shadowlayer/terrainblock42.tga"/>
<Delete where = "shadowlayer/terrainblock43.tga"/>
<Delete where = "shadowlayer/terrainblock44.tga"/>
<Delete where = "shadowlayer/terrainblock45.tga"/>
<Delete where = "shadowlayer/terrainblock46.tga"/>
<Delete where = "shadowlayer/terrainblock47.tga"/>
<Delete where = "shadowlayer/terrainblock48.tga"/>
<Delete where = "shadowlayer/terrainblock49.tga"/>
<Delete where = "shadowlayer/terrainblock5.tga"/>
<Delete where = "shadowlayer/terrainblock50.tga"/>
<Delete where = "shadowlayer/terrainblock51.tga"/>
<Delete where = "shadowlayer/terrainblock52.tga"/>
<Delete where = "shadowlayer/terrainblock53.tga"/>
<Delete where = "shadowlayer/terrainblock54.tga"/>
<Delete where = "shadowlayer/terrainblock55.tga"/>
<Delete where = "shadowlayer/terrainblock56.tga"/>
<Delete where = "shadowlayer/terrainblock57.tga"/>
<Delete where = "shadowlayer/terrainblock58.tga"/>
<Delete where = "shadowlayer/terrainblock59.tga"/>
<Delete where = "shadowlayer/terrainblock6.tga"/>
<Delete where = "shadowlayer/terrainblock60.tga"/>
<Delete where = "shadowlayer/terrainblock61.tga"/>
<Delete where = "shadowlayer/terrainblock62.tga"/>
<Delete where = "shadowlayer/terrainblock63.tga"/>
<Delete where = "shadowlayer/terrainblock7.tga"/>
<Delete where = "shadowlayer/terrainblock8.tga"/>
<Delete where = "shadowlayer/terrainblock9.tga"/>
<Replace from = "26.dat" toreplace =" AAA. xml "/>
<Replace from = "27.dat" toreplace =" skybox/lava_01.tga "/>
<Replace from = "28.dat" toreplace =" skybox/skybox. Material "/>
<Replace from = "29.dat" toreplace =" Duplicate skybox/skybox. Material "/>
</Packageactions>
</Updateactions>
</Versioncompare>