Compression can occur in different ways at different levels, and when, where and how its use depends entirely on its goals and objectives (compression does not always mean saving disk space).
Basically, at the top level, all assets will / can be compressed into a massive archive (this speeds up reading, since reading from a hard disk is less, but you sacrifice processing power for this, using DMA to read uncompressed files that don't use a processor at all ), reading is almost always performed in memory, memory reading back on the HDD will lead to performance degradation and will cause many problems (and in some cases it will be impossible, for example, on older generation consoles).
The second level can / can be done on the asset itself, as an example, textures can be compressed in MANY different ways, but mainly block compression (S3TC / DXTn, BCn) is used, since its decompression is supported in (or emulated by the driver), therefore When reading it for an archive / disk, further decompression is not required.
Compression strategies also depend on the platform, especially on consoles that are very sensitive to memory layout, have limited resources and have small caches, etc.
Using a library like zlib (or any other) with C ++, how is this execution decompression performed?
usually you want to use memory mapped files in the archive and unzip it directly to RAM, which is a good example of an AAA archive system that is well documented, which makes it MPQ format (used by Blizzard Entertainment, more details here ), it uses a lot of compression algo, such as deflation for Diablo I, zlib for Warcraft III, bzip2 in World of Warcraft, and they recently added LZ and sparse compression for their new games, such as SCII.
Jan Wassenberg ( Optimizing File Accesses via Ordering and Caching ) has a good file management structure, which may also be of interest.