As part of our effort to pull back the curtains and show what happens behind the scenes I have asked Reto.Injection to explain a bit about what he is currently working on. And as you might have noticed in the last few Intelligence Bulletins, he is working on a new and much improved resource system.
The resource system handles resources – resources? I hear you ask! Yes! Resources. Resources are everything the game loads into the engine; characters, weapons, textures, vehicles, materials and so on. – Reto.Robotron3000
Hi, I’m Reto.Injection.
I’m going to tell you about the new resource system, I’ve been working on for quite some time now.
The resource system is the part of the engine that keeps track of which resources is loaded and communicates with the other components.
The old system works like this:
- A scene node Resource is requested by someone, do some initialization
- The scene node will request the render primitives, and collision data and do some initialization
- The render primitives will one by one request materials, the materials will request textures and so on…
This is a rather time consuming process, and it is very brittle, if a resource is missing it normally constitutes a crash.
The new system works like this:
At our pack stage objects are arranged the way, the engine expects it at run-time.
This means that when the resource is loaded it’s ready for use, no initialization needed.
This is true for most resources, however render and audio resources will need to be installed in the appropriate subsystem.
So if a special entry-point exists in the resource it will call the subsystem itself when loaded, it also has an unload-entry-point.
This means that a resource can be loaded and unloaded while the engine is running, and it’s the resource that controls the sub system.
So this makes it very easy to make a cache that can in turn control the resources.
Example: If the render needs a texture resource and it’s only available on disk, the cache will make room by unloading the oldest used resource
until there is enough space, then it will load the texture resource into memory and it will register itself to the render.
Another side effect is that our development team is able to reload resources without the need to restart the engine, this is currently what they do.
The new resource system will be available sometime in 2013.