c++ - Game Engine Runtime Decompression -
i have been trying find out how game engines deal asset compression. compress assets when building game. how decompress them during runtime. thing think of decompressing memory, must memory intensive. if decompressed onto hdd folder filling while game playing? doesn't sound efficient.
using library zlib (or other) c++, how runtime decompression done?
david
it's kinda this, have game data won't fit in reasonable amount of memory, can't load of them @ once in memory, define buffers data use caches.
now memory in order of speed lowest highest such:
- dvd
- hard drive
- ram
ideally won't have stream data dvd, it's take account if have make console game instance. each of these available storage spaces define buffer used cache.
when game engine decides might need asset, should first in fastest cache see if asset loaded. if you're in luck, can send drawn. if it's not in fastest cache, have go down level hard drive cache. file keep assets decompressed , ready loaded memory. if fastest cache isn't occupied can start loading data , use when it's ready. if there isn't enough space, have unload other assets first, recommend removing least used assets until have enough space load new one.
now if hard drive cache doesn't have data loaded have go down 1 more level archive, want use zip format compress because zip file format doesn't force decompress entire archive have access 1 file have find offset of said file within archive , decompress hard drive cache. again if cache full you'd have unload other assets first, again i'd recommend removing least used can try other algorithms if think improve performance.
john karmack had keynote @ quakecon 2011 explained whole process maybe little bit better can in post (among other awesome things), can find here
Comments
Post a Comment