Engine:CVAR base path

From AddOn Studio
Revision as of 22:05, 16 October 2023 by Bear (talk | contribs) (Created page with "{{dev/uicvar}} Path for content and assets. <kua>set base_path './data/'</kua> == Arguments == * name - 'base_path' * value - Full or start folder relative path for base data and assets. Default value is './data/'. == Associations == * Is by default placed in the 'global' context. == Details == Path to the base asset load location. The path is either a full OS file system path to the library location, or a path relative to the launch location, which is the location o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Console commands

Path for content and assets.

set base_path './data/'

Arguments

  • name - 'base_path'
  • value - Full or start folder relative path for base data and assets. Default value is './data/'.

Associations

  • Is by default placed in the 'global' context.

Details

Path to the base asset load location.

The path is either a full OS file system path to the library location, or a path relative to the launch location, which is the location of the executable for the engine.

In some configurations the path is relative to the current directory and not necessarily the actual engine start location. The 'data_path' will be used verbatim to resolve the final library load path.

set lib_path './data/'
with install in: d:\install\engine
effective path: d:\install\engine\data\

Asset loading in the engine is a multi-tier system. This path provides the location of the base lowest tier set of files and archives. If a higher tier location or archive has a file with the same relative path, it will be chosen first. Each tier is either an OS file system location, or an archive.

And archive is any system, like maybe a zip file with assets inside, that is not an OS file system. A single archive could be made of multiple real files, that together form one virtual file system as one tier.

The relative file paths and names inside an archive or location, are the paths and names used to request an asset.

Default precedence: By default, Engine tries to load a single archive file named 'pak0.zip' in the specified 'base_path'. This file will then be asset location tier 0, the lowest. The 'base_path' itself will be asset tier 1.

So for example, on startup Engine will look for a file named 'config.cfg', first in the file system at 'base_path', and then inside the 'pak0.zip' file loded from 'base_path'. If neither are found, will load with static defaults.

Examples

Default values

For the path executable path 'd:\install\engine.exe', and a 'data_path' of './data/':

\install
   engine.exe
   lib
      gamex86.dll
      gamex64.dll
   data
      pak0.zip
         config.cfg
      config.cfg
On start the config file directly in '\install\data' will be loaded. The one in pak0 will not.

Notes