Quote Originally Posted by Ludens View Post
Hardcode has become a bit of a swearword since modders started using it to explain why they couldn't add certain features. Some people then assumed it was put in the game-engine on purpose to block modding attempts. In fact, it simply means the game-engine itself. Hardcode are those part of the game or program not changeable by modding, because modding means altering the data files while programming is changing the engine itself.

What modders mean when they complain about hard-codes is that they want more aspects of the game to be put in the data files, instead of being hidden in the engine itself, like the max. number of factions is. They don't complain about there being hardcodes, because those are simply part of programming. In fact, hardcodes are the core of the program itself.
Yes, hardcode is, well just that: rock solid hard code you can't simply replace with your Notepad style text editor.

The obvious question then is why do game-designers feel the need to hide aspects of the game in the data-files? I can't really answer that because I am not much of a programmer, but I do suspect that processing speed is one reason. After all, if it's not in the engine itself the program has to look for it and then translate it into something the computer will understand. This wouldn't make much of a difference if just one factor was outside the program files, but if you want many things to be moddable it may seriously slow a program down. Also, it is not as if there is an instruction in the program that says "if faction number exceeds 31, then CTD". M2:TW has been made with 31 factions in mind, so you'd probably need to change many parts of the code to allow for more. This may also result in memory uptake for these faction, whether they are used or not.
Yes, it's the cost of reading, parsing etc. etc. which makes it beneficial to store as much as possible in a single file. It comes at the cost of greater flexibility; but this is not an issue if you 'pack' all these files into one. Also one big file allows for better/easier compression and (potentially) encryption. Keep in mind that the harddisk which is where most of the I/O operations go to, is easily 1000 times slower than your RAM is -- hence it becomes very interesting to see if you can speed up the I/O by constructions such as memory mapped files: which is also significantly easier with one big file. For an example: the swap or pagefile your OS uses, usually that is just one big memory mapped file (directory).