Engine:CVAR base path: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
Line 25: Line 25:


The relative file paths and names inside an archive or location, are the paths and names used to request an asset.
The relative file paths and names inside an archive or location, are the paths and names used to request an asset.
  data
  data (tier 1)
     pak0.zip
     pak0.zip (tier 0)
       file.txt
       file.txt
       model
       model
           file1.obj
           file1.obj
    model
      file2.obj
     file.txt
     file.txt
    model
      file2.obj


Default precedence:
Default precedence:

Revision as of 22:14, 16 October 2023

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.

data (tier 1)
   pak0.zip (tier 0)
      file.txt
      model
         file1.obj
   model
      file2.obj 
   file.txt

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.

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 loaded 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