Planning ahead

While working towards the next-gen 3D model renderer, I now have a more detailed step-by-step plan for moving forward.

3D models are stored in packages. Therefore, Doomsday needs to understand packages, where to find them and how they are loaded into active use. This will allow the engine to find the definitions for the model from inside its package, and pass them on to resource management. The model renderer will have a set of ModelDrawable instances that manage GL resources for all the currently renderable models; these are created and destroyed dynamically when needed. ModelDrawable calls back to the file system and to Doomsday’s resource management to find textures and other referenced assets, in cases where the model file itself references other files.

Having Doomsday understand packages has much long-term value, so it has to be done right from the get-go. PackageFolder and its possible subclasses will interpret all the available containter/bundle formats into a single file tree representation. This greatly simplifies how packages are then handled internally, as the “physical” format can be ignored. Each package also comes with a Doomsday Script module: this can be used for variables and functions, e.g., for loading hooks or internal helper routines. In practice, the Info file of the package is parsed using ScriptedInfo. The Info file can then include other scripts or files as needed.

All packages are required to specify their human-readable name, version, tags, and usage license in their metadata: omitting any of these will cause an error message and prevent the package from being loaded. The purpose is to ensure that all the appropriate metadata is provided for each package, so that this information can be relied on for categorization, upgrade control, and copyright notices. The file name of the package is used as its unique identifier, while the human-readable name is the one shown to the user as the name of the package.

I’m leaning towards using reverse domain name notation as the primary way to name packages, as this has been proven to work well. For instance, the built-in packages that come with Doomsday would be called “net.dengine.(something).pack”. For people without domain names, we could simply use “nickname.(something).pack” — this should work unless your nickname is a TLD.