请问关于资源缓存的功能? #235
-
在学习游戏引擎相关资料的时候,看到了关于资源缓存的部分。了解到常用的缓存算法有lru,mru,nfu,年龄算法等。请问引擎会编写缓存相关的部分吗?如果有的话,会采用什么算法?尤其是希望引擎在资源受限的平台运行时,感觉这个缓存会对运行效率有很大帮助。 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
小引擎中暂时还没有规划做这方面的功能。 |
Beta Was this translation helpful? Give feedback.
-
那请问关于内存管理呢?我看到有说使用各种内存分配器进行快速内存分配与管理,避免内存碎片。还有资料说使用垃圾回收进行管理。请问引擎会考虑加入这些方法吗? |
Beta Was this translation helpful? Give feedback.
-
游戏引擎肯定会管理内存的分配和释放,一般来说也有各种不同的allocator应用在不同的场景,比如Arena,StackAllocator,LinearAllocator等等,另外也会提供配套的分析和检查工具对内存进行Debug和Profiling。 |
Beta Was this translation helpful? Give feedback.
小引擎中暂时还没有规划做这方面的功能。
资源缓存是一个比较特例化的需求,要考虑很多实际因素,比如content budget,gameplay影响,优先级(主角,NPC),lod等非常多的因素,所以游戏中一般根据自己的需求来实现相关功能,很难有一个普适性的实现策略。