ChangeLog:
2009-01-05 22:26 translate by pcicp
2008-06-08 00:09 1.1 by 痴漢公賊
2008-04-26 15:52 1.0 by 痴漢公賊

	<<game package, resource and extractor>>

a game, may be with wonderful scenario, flowery cg and tuneful music. even if you don't like game itself, in which always there are something exciting your heart，so you want to grab its only treasure for you, it's the motivation that why game resource extractor which reply and realize people's will and desire appear. before extracting, you should make some ready, come to a little understand something you face to, at least it may be lovely elf, also can be horrible devil.

【terminology explanation】
resource meta-file - means raw material used to make game, the raw material always are file in some common formats, such as the most common image format .bmp, .wav in PCM as well as with good compression ratio .ogg(notice: in most cases, original material should be PCM source, after that converting to ogg for reducing size, here the material format via transformation also aka. meta-file).
resource file - means private file data format transformed from resource meta-file by developer. usually when packaging, the file read by packager is resource file. but in such a case of resource meta-file without any transforamtion and directly packaging any if no such transforamtion process before packaging, here resource meta-file also is resource file.
packaging - means a process which package resource file into entirety then generate cluster file, also calls package or encapsulation. typical packaging behavior happen at eve of finishing game making, by developer made resource material classified on the basis of resource type is packaged to cluster file which finally is named after descriptive filename. of course there is no rule without exception, some games' resource file without packaging process, but directly is classified to organize clear directory structure.
package - as also archiving or archive, means during packaging finally created cluster file(in order to avoid going into chaos with verb meaning of package, using "packaging" instead of verb meaning of "package" in following words).
package in type of resource - also naming resource package for short, specially means resource file without packaging process. in such circumstance, package in type of resource is resource file.

after coming to know these concept, it will bring naturally some following question to you, i wish explanation here can help you better understand these concept. 

【why package resource】
when you browse game directory, always notice something with special extension or unusual large size. some guys who have first feeling about wanted treasure within there, should deserve more praise - your intuition is strongly sensitive. data used by game, include scenario, image, audio, video, 3D model and so on/anything using for game, usually they all wouldn't like to expose in most original form to people's eye - at least in front of you, they aren't frank with you. if do so, game developer think that their magic will drop gameplay, so they make use of every means to preserve inner resource against cracking and extracting as far as possible. in fact after all object is only game data, developer would like misunderstand himself as father with lot complex protecting daughter, who is able to integrate organically all scattered data into entirety and perform vividly and incisively to manifest expression, is ture developer, at the same time such game willn't fear of cracking and extracting. in fact package format produced by developer reflect more or less their narcissus complex.
on the other hand, good package format at the beginning isn't designed purposely in order to encrypt and protect resource, their design original intention is merely a return of most simple and most practical design idea of cluster file - just out of the consideration of reducing resource size or improving IO performance for accessing. the "less is more" thinking is anyway most persuasive. if finding a encrypted package, i only believe the developer to be a coward or narcissism. if it's a general game engine, the encryption protection also can purely to give slight comfort to with similar mindset game developer. in reality any encryption protection isn't worth mentioning at all, as long as you is in the case of running  on general and open processor, and without taking any hardware protection measure.

【package nomenclature】
in theory, package name is freewill, even can be without extension, also can be named after careless number counting from 0. because name is recognized by game engine, instead of dribbled and thinking of unpacking them you. it can be named by any form so long as game engine has ability of recognition. for the reason, we needn't pay attention to most concerned package extenison. for example, our common three package extension: .dat(data abbr.), .pak(package abbr.) and .arc(archive abbr.), can become to popular BIG3 merely because a great deal of game systems use them as package extension, there is no deeper meaning. package particular structure and content format is parsed by game engine, so particular structure is decided by game producer, it's grossly mistaken if you're in opinion of all .dat package with same structure, so it's just a silly question like asking: "what format is .dat file?"(from reading the article, you'd better not ask me such silly question). actually only a class of .dat package which provide mutually some consistent internal features, have same structure, in other words, game using the class of package owning mutually some consistent internal features as resource container, is developed and maked by same game engine or SDK(game software development kits). we can't easily believe that two games' .dat package have same structure, aslo can't consider that a extractor can extract a game's .dat package but surely be able to extract another one. you merely can think package extension used by two games' engine or SDK, are all named by .dat, other all minds must come by technical analysis verification. it's interesting about opposite statement, if a game system use extreme rare extension as package extension, almost certainly, all games naming the extension as package extension, are maked by same game development tool. in other words, extractor which can extract the class of package, may can extract game using same type package. considering any well-designed game engine will both leave opportunity for updating package format, therefore resource extractor which just support a specific version, still can't extract structure updated package.

【package existence】
because process of creating package is related to specific package format and tool, it's unfair to take any example, here giving packaging process on general concept, process marking with parenthesis is negligible.

resource meta-file (-> resource file) (-> package file)

it's seen that, sometimes resource meta-file is exposed directly to us, but it's premature, nearly no kind developer will handle some key resource files in this way, the most obvious file is cg(based on previous described reason), the discriminated resource file always is audio.
if resource file is only treated with foramt transformation but without packaging, the resource file is also called package(owing to having process of foramt transformation), nothing but it's not performing multi-file cluster operation. for convenience of debugging and updating, developer is normally more willing to accept conditionally the form compared with previous one, because it's hard difficult to update patch to a archive; if game is also in developing state, the form is comfortable to replace problematical resource file at all times.
it's most common that resource file is archived, because in theory it will be of great benefit that integrating all related resources into a file, but previous described used encryption mean due to lacking of confidence, will regularly counteract even over compensate the profit. sometimes ultra protection will create great issue on file update, only if developer would like to overcome difficulty to program quite complicated patch tool, otherwise most developer would like to select second existence as update option - if under current game directory game engine can find needed reading resource file on a specific location, will access the resource file in package no longer. the approach not only is very smart, but also takes power advantage of game chinese localization.

【package special-case】
instance include: package without extension, package hidding inside other file(in common at end of host file), resource type of package without packaging and package without obvious internal feature.

·without extension, in fact is nothing but the special instance of package naming, you have no control over them which just like no extension.
·package hidding inside other file, usually append behind game host program exe, game storing package in this way is always trial version. if you find a game exe bigger than tens of or hundreds of MB, it must be in the case. it isn't quite good to package game resource as the mode, it has only a advantage of well compact file number, it's really suitable to release trial version.
·resource type of package without packaging, actually is that resource file which just apply determinate process and transformation(sometimes there is no any handling) to resource meta-file, but isn't carried out to package. usually developer would like to integrate a class of resource into a directory, then package all files under the directory to a file, it's meaning of "pack" in word of package - a file can be unpacked out n resource files out. another meaning of package is transformation of resource format, so it isn't necessary to package all resources into entirety but to treat every resource with transformation(encryption and compression), it will get resource type of package without packaging(though it's may not well proper to using "package" as naming).
·package without obvious internal feature, in essence is as seen by internal structure, for most people, it may be with extension, even with a extremely special extension, be clear seen from its name. but programs which can parse package internally existing nothing obvious mark, are all ground on a assumption: suppose if the package should have what structure, suppose if it should store name here, should save offset here...if practical situation don't match assumed condition, bad-designed program will simply crash.

【package intra-format】
TODO

【game resource extractor】
game resource extractor is the tool which simulate game engine to parse kinds of game package, and therefrom save resource to meta-file which is game raw material or compilation result(like binary script). there are many ways to program game resource extractor, it's most common that programmer generally by way of reverse engineering work on destination game engine program with anti-compilation analysis, tracking I/O activity, memory dump and so on, analyse out specific content structure of game package, then during programming implement process of parsing package again. additionally some game engines are open source, so under help of source code it's also able to program corresponding resource extractor.