Namespace OmegaEngine.Foundation.Storage
The storage subsystem provides a flexible filesystem abstraction that combines multiple content directories into a unified view.
Content Manager
The ContentManager locates and loads files from the overlay filesystem.
Directory names
Asset loading methods automatically prepend directory names based on the asset type:
| Asset Type | Method | Directory |
|---|---|---|
| Textures | XTexture.Get(engine, "texture.png") |
Textures/ |
| Mesh textures | XTexture.Get(engine, "texture.png", meshTexture: true) |
Meshes/ |
| Meshes | XMesh.Get(engine, "mesh.x") |
Meshes/ |
| Particle systems | CpuParticlePreset.FromContent("fire") |
Graphics/CpuParticleSystem/ |
Example:
// Loads from "Textures/texture.png"
var texture = XTexture.Get(engine, "texture.png");
// Loads from "Meshes/mesh.x"
var mesh = XMesh.Get(engine, "mesh.x");
// Loads from "Meshes/texture.png" (texture associated with a mesh)
var meshTexture = XTexture.Get(engine, "texture.png", meshTexture: true);
// Loads from "Graphics/CpuParticleSystem/fire.xml"
var particles = CpuParticlePreset.FromContent("fire");
Filesystem
The filesystem combines multiple directory structures into a single view used to load assets.
Search order:
- Mod
- Directory specified via the
/modcommand-line argument
(only if implemented by the game) - Directories specified in the
OMEGAENGINE_CONTENT_MODenvironment variable
(only if the/modcommand-line argument was not used)
- Directory specified via the
- Base
- Directory specified in game settings
(only if implemented by the game) - Directories specified in the
OMEGAENGINE_CONTENTenvironment variable
(only if not overriden by game settings) - The
contentdirectory next to the game's executable
(only if not overriden by theOMEGAENGINE_CONTENTenvironment variable or game settings)
- Directory specified in game settings
Base directory
The base directory is usually located in the directory of the application EXE and named base. This location can be overridden in the engine configuration.
Mods
A game modification (mod) is a set of changes based on an existing game used to modify existing gameplay, add additional content or create an entirely new game.
API
Classes
- ContentManager
Provides a virtual file system for combining data from multiple directories (useful for modding).
- FileEntry
Describes a file returned by GetFileList(string, string).
- XmlStorageConfig
Global configuration for XmlStorage.
- XmlZipStorage
Provides easy serialization to XML files wrapped in ZIP archives.
Structs
- EmbeddedFile
Information about an additional file to be stored alongside an ZIP archive using XmlStorage.