First thing first: there is (generally) no way for a computer to know whether a file is pirated or not. Piracy is a legal/moral term, and sinceas so, it has no meaning on a file consists only, which is only composed of ones and zeroes, there are no technical ways to know if a copy of a file is legitimate or not.
That said, piracy prevention and countermeasures usually involve checkingfocusing on finding out whether or not a user has something (usually an object) which can only be obtained if a copy of the game was purchased, and do something if the check failsmake that difficult to duplicate. There are tons of ways to do this, each one with advantages as well as flaws. I'll mention a few:
Early games asked users to input a word from the game manual, which you should only get if you bought a game box. A photocopier or a scanner easily defeats this technique though.
More recently, media checks are more common. The idea is that you require the game CD to be in the drive to runfor the game to run. WithTo implement this technique, you can eitherfor example access critical data files from the CD without which the game cannot run, or simply check for the existence of a file in the CD. This worked pretty well when CDs were difficult to duplicate, but CD copiers, and more recently drive emulators like Daemon Toolscan be used to easily defeat thisthese technique.
To preventHowever, CD copyingcopies are not perfect, so many other techniques focus on detecting whether the CD is the original pressed CD, or a copy. To implement this, a game can check for non-standard elementsnon-standard elements that wereare inserted on the game disc during press time, but cannot be easily and reliably replicated inby a CD burner, or on a CD-R discs. Some common ways to do this are:
WritingCreating dummy "ghost" files in the CD during mastering, which are not accessible from the CD filesystem, but do exist, and can be read if you know where to find them. This data is absent on CDs which are copied file-by-file disc copies. DiscCopying the entire disc image copies easily defeat thiswill copy these files though.
IntentionalAnother way is to intentionally insert errors: in the disc. CDs can detect and correct some data errors usingcontain error correction codes available on each sector. By intentionally inserting errors during press timein the data, and checking forwhich can be transparently corrected by a disc reader, the existence ofdisc will work normally, but the errors won't be copied to the CD-R. By looking for these intentional errors, a discgame can consider a CD to be judgedan original pressed copy. RAW disc image copies defeat this though.
Inserting twin sectors, with the same address but different data will yield different results when seeking data forward and backward. Checking for the existence of this is possible, and replicatingduplicating a CD with these twin sectors is very difficult.
MeasuringMeasuring the actual position of the pits in the CD. ThisOnce again, duplicating a CD with the pits in the same positions is very difficult to replicate.
However, many CD emulators, like Daemon Tools, or Alcohol 120% can actually emulate the samethese features a physical CD has. Because of this, many publishers choose to include a CD emulator detection step, and prevent the game from running if an emulator is detected. The implementation of an emulator detector is outside of the scope of this answer though.
Instead of, or in addition to checking for a physical CD, a game can request the user to input some data, like a serial codeproduct key. Some ways to use serial codesproduct keys are:
Checking for mathematical features in the key. However, this doesn't prevent key duplication, and if the features arechecking algorithm is discovered or reverse-engineered, can allow piratesa pirate may be able to create new keys, at will which havewill appear to be legitimate to the same featuresgame. Software that does thiscreates keys at will are usually called "keygens""keygens".
Generating a hash based on the user's hardware, send this hash and the serial codeproduct key (usually a combination, called the "installation key") to a server owned by the game company, to get a third keyand based on the hash and serial, create an activation key. Then use some mathematicalUsing one-way numeric methods (modularlike modular arithmetic and, or some methods with elliptic curves are common) to check whether, a game can see if the thirdactivation key is correctmatches the hash and serial code, and only run if they match. This technique is called "activation". An additional advantage to this method is that the game company can
With activation, a server may refuse to give thirdprovide activation keys based on serials that have already been used. However, if the user'sfor multiple hardware changes (either becausehashes with the same serial code. Because of a hardware change, or a resale)this, even if the hardware hash will changeserial code, and activation key are copied, the thirdactivation key won't match anymore. Some companies allow for de-activation of keys for this purposeand the game won't run on other computers.
All of these measures are meant to find whether or not the user owns a purchased copy of the game. However, implementing them requires program code that checks for this. It is possible for a pirate to modify the game code to disable or bypass the checks instead of attacking the copy protection mechanisms themselves. The act of modifying game binaries to disableremove anti-piracy checks is called "cracking".
Checking the binary with some hash. However, there must be a program that checks the hash, which can in turn be cracked as well.
Encrypting the program, or simply the check routine, and decrypting it in runtime. This makes disassembly more difficult, as it involves one or more additional decryption steps. IF the decryption key is included in the program (as it must be, because without it, the game cannot be decrypted), then the pirate can reverse engineer the decryption, find the routine, and crack the copy protection. As
Because of this, as a game publisher, you want to make the key as hard to find as possible, and optionally make the decryption algorithm hard to understand. Some ways to make the key hard to find are:
However, regardless of the method you use to create your keys, the keys itselfthemselves will be in memory when thewhile decryption step takes placeis in progress. Memory inspectors, debuggers and emulators can help a pirate find and copy the key while it is in memory. You can prevent memoryMemory peeking bycan be attacked in several ways:
Having a privileged service that detects memory accesses in the specified region, and redirect the addressing somewhere else. ThisAs this requires ring 0 access, and programs that do this are akinmore commonly used for not-so-legitimate purposes, antivirus software usually block them. (this is why many games and other software ask to rootkitsturn off virus protection when running). Writing themsoftware that correctly does this is extremely difficult, and can easily compromise the stability and security of the host OS. Search for the XCP scandal forThe XCP scandal is a related storygood example of an implementation of this method gone wrong.
Modern hardware and operating systems allow for much more secure and stable techniquesprovide some tools, like memory curtainsmemory curtains, secure media pathssecure media paths and TP modulesTP modules, to make it easier to make programsa program that decryptdecrypts data, while being resistant to memory inspection.
There are many many more techniques to attack piracy, ranging from the trivial to the esoteric. HoweverUnfortunately, remember that detecting copied binariesit is not possible, so any technique implemented that tries for all of these techniques to detect if the user has something which can only be obtainable whenfail to recognize a genuine copy is purchased, will invariably createand it's usually the possibility ofmore aggressive techniques that have higher false positivespositive ratios.
AlsoAs a game publisher, remember that all techniques -can- be cracked. The intent of piracy protectionyou usually consists in the selection ofwant to choose a varietyset of techniques whose cost of implementation, expected cracking time, and false positive ratio are in line with your expectations.
It is a common misconception that piracy protection is meant to slowbe completely unbreakable. Most game sales happen in the creation offirst few months after release, so a cracked copy forpiracy protection scheme is usually considered effective if breaking it consumes enough time for the game publisher to getcollect a large amount of profits for the game developer/publisherbefore it gets broken.
Regarding Game Dev Tycoon, they did not use any anti-piracy technologies. They simply created a "broken" build, and distributed it over BitTorrent, as is stated in the beginning of the article you mentioned.