How Are Games Patched?

Started by
14 comments, last by try_catch_this 18 years, 11 months ago
After a developer/ publisher releases a game onto the world, how is the task of actually patching the game achieved? Im insterested in the technical side of it, how its it achieved. Do they simply rewrite the .exe and replace it in the game folder, etc. Any links or comments would be helpfull. Thanks.
-----------------------------Like A Midget At A Urinal, Im Always On My Toes.Beer helping ugly people get laid since 4000BC.
Advertisement
That seems the only sensible way to do it. I can't think of a reason to go and actually edit the binaries.

At the lowest level, a simple shell script could do it.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
I would think so.
It would be very hard to make changes to the source, and then compile some sort of differences file to patch the binary, because even a minor change in the source can change all the offsets in the binary, let alone changing symbol tables and the like.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Firstly, they take the old version and the new version of the game, and run a difference-checking tool. This makes a note of all the differences in all the files, and describes all the changes needed to turn the old game into the new game (change these bytes in this file, add that file, delete those, etc.).

This creates a script (known as a patch) to upgrade one version to another, but they must then add a check to the script which makes sure that the proper version is being patched, so as not to cause corruption.

But you want a patch to upgrade any version of the game. So they make patches to change any version of the game to the next version (ver 1.0 to 1.1, 1.1 to 1.2, 1.3 to 1.4, etc.) and put them all (compressed) into a single executable, so that they get run in series when the exe is run.

So let's say you have Game version 1.2 and you get the 1.4 patch. You run it, it sees if you have version 1.0, which you don't, so it skips to 1.1, and then 1.2. It sees that you have 1.2, so it upgrades you to 1.3. It then upgrades you again to 1.4, and it's done.

Alternatively, instead of using differences between each version, they can simply write all the files which have changed at any point from the original version to the final version. This is a MUCH simpler approach, which is probably used more often in games, although I am speculating.
If they simply replace the .exe and add other files that are needed, why is it that some games require you to install earlier patches for later patches to work? Is there an industry standard, companies follow in order to allow games to be patched?

Google has nothing on Game patching that I can find, and nobody has brought this subject up before.


*Reads Post above, that appeared while typing and posting this one. Is this the way patching is done in the gaming industry?
-----------------------------Like A Midget At A Urinal, Im Always On My Toes.Beer helping ugly people get laid since 4000BC.
Quote:Original post by Arclight
If they simply replace the .exe and add other files that are needed, why is it that some games require you to install earlier patches for later patches to work?


Because if patch #1 changes files A and B, but patch #2 only changes file A, it isn't going to also provide file B if you're releasing s an incremental patch. If you're releasing a full patch, then you'll be providing everything required to bring you from the base version up to the latest version. When the cumulative patch sizes become larger than the full patch size, it becomes worth your while. Then you can start releasing incremental patches based on that new baseline version.

Quote:Is there an industry standard, companies follow in order to allow games to be patched?


Not to my knowledge.

Quote:nobody has brought this subject up before.


It has been brought up before. The site search function has ... issues.

Quote:*Reads Post above, that appeared while typing and posting this one. Is this the way patching is done in the gaming industry?


Diff files work fine for source code, but are a hassle I would definitely not bother with for binaries without extremely compelling reasons. I don't see why software publishers would bother either; the gaming industry is not special in that respect.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Here you can find a sw used to build patch of binary files... maybe its description can be interesting.
Fil (il genio)
I also read of using subversion to make an update style patch system as well, which I thought was rather clever.

Quite a few different ways to patch a game, of course.
Simply replacing the exe with a new one is the easiest way. However usually it is done as Jaywalk said. It is more secure this way. If the original exe is cracked the patch won't work.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
hm just lately i have seen a game why does patching the following way

gamefolder:
contains all the file you need to actually run the game
modfolder:
here is the game data levels ...
folderofamod/v1000:
contains all files of version 1.0
folderofamod/v1001:
contains all files of version 1.001

.....

to update the executeable you run a second update executeable that replaces your current exe file

if there are only a few files to update it simply downloads them from a server

pros:
the advantage is you can always tell the game to run at this and that version so you don t have to install tons of installations just to run older modifications which aren t upwars compatible

cons:
if you don t have package files you will probably fragment your hd so go and write a package library or use zlib, a lot of people hate installing tones of single *.<filextenion> files just because the programmers are too lazy to pack them all together

writing a intelligent package system will also reduce the amount of data you have to download to run custom maps (implement dependencies)

P.S.: this is pretty similar to the way linux kernels are patched
P.P.S.: another note to the package system, what i have never seen in a game, but what i d definately desire is a package system that doesn t only download needed packages, it should be able to drop a file with download links and such so low bandwidth users just take this file to their laptop and can download everything at work or at university or where ever they have broadband access

back at home you just run the application and tell it to install the downloaded packages


sorry it s been a little bit offtopic but i think you should take my suggestions into consideration
http://www.8ung.at/basiror/theironcross.html

This topic is closed to new replies.

Advertisement