Darkplaces virtual file system

From Blood Wiki
(Difference between revisions)
Jump to: navigation, search
m (4. Not fully integrated with map editor)
 
(17 intermediate revisions by one user not shown)
Line 1: Line 1:
Darkplaces virtual file system is overlay file table that combines real file system and files stored in game archives.
+
{{TOCRIGHT}}
 +
Darkplaces virtual file system is overlay file table that combines real file system and files stored in [[PK3]] and [[PAK]] game archives.
  
 
The goals it provides:
 
The goals it provides:
  
* opaque access to separate gamedir storing all writeable files (My Documents/My Games)
+
* transparent access to separate gamedir storing all writeable files (My Documents/My Games)
 
* access files in archives just like they were stored on HDD
 
* access files in archives just like they were stored on HDD
 
* mod support (mods can override files, add new files)
 
* mod support (mods can override files, add new files)
 
* safety (gamecode cannot damage game files)
 
* safety (gamecode cannot damage game files)
  
= How file table is maked =
+
== How file table is maked ==
  
 
# First gamedir is processed
 
# First gamedir is processed
Line 16: Line 17:
 
# Next gamedir is processed
 
# Next gamedir is processed
  
= Quirks =
+
== Quirks ==
  
 
Since virtual file system is, effectively, an abstraction layer, it has its own quirks.
 
Since virtual file system is, effectively, an abstraction layer, it has its own quirks.
  
=== 1. Homedir may be different than gamedir ===
+
====1. Homedir may be different than gamedir====
  
 
This means config.cfg, screenshots etc. are stored in different directory, like in "My Documents/My Games/gamedir"
 
This means config.cfg, screenshots etc. are stored in different directory, like in "My Documents/My Games/gamedir"
  
=== 2. For written files, "data/" are automatically added ===
+
====2. For written files, "data/" are automatically added====
  
When QC writes any files, system automatically adds 'data/' to the path, so gamecode cannot damage game files, maps etc. But file read is not the same. It could read files from base directory, open maps etc.
+
When QC writes any files, engine automatically adds 'data/' to the path, so gamecode cannot damage game files, maps etc. But file read is not the same. It could read files from base directory, open maps etc.
  
So if you write, for example, foo.txt (which will be written to data/foo.txt) and have foo.txt in gamedir, you should set path "data/foot.txt" when reading the file, and set path "foo.txt" when writing. If you dont, you will write to file under "data/", but read file that is in gamedir.
+
So if you write, for example, foo.txt (which will be written to data/foo.txt) and have foo.txt in gamedir, you should set path "data/foo.txt" when reading the file, and set path "foo.txt" when writing. If you dont, you will write to file under "data/", but read file that is in gamedir.
  
=== 3. "./" and "../" is no allowed ===
+
====3. "./" and "../" is not allowed====
  
To protect gamecode from damaging files, any use of "." and ".." directory operators is forbidden.
+
To protect gamecode from damaging files, any use of "." and ".." path operators is forbidden.
  
=== 4. Not fully integrated with map editor ===
+
====4. Not fully integrated with map editor====
  
Map editor do not support Virtual File System in model selection dialogue (entity inspector), it only can select real files.
+
Map editor do not support Virtual File System in model selection dialogue (entity inspector), it only can select real files. This is not a problem with developed version of Blood Omnicide (SVN working copy with test installation), but release verson SDK should make sure all game models is unpacked in order to make editor see them in model selection dialog box.
  
= Launch keys =
+
[[Category:Darkplaces engine]]
 
+
{{finished}}
{| width=500 cellspacing=0 cellpadding=4 border=1 style="border-collapse: collapse"
+
! width=20% | Key
+
! width=80% | Description
+
|-
+
| align=center | -nohome
+
| Disables homedir support, all use files will be written to gamedir (a must-have option for using internal editors).
+
|-
+
| align=center | -game
+
| Sets new gamedir (for mods).
+
|-
+
| align=center | -basedir
+
| Sets new basedir (a first gamedir).
+
|}
+
 
+
__NOTOC__
+

Latest revision as of 14:33, 13 December 2012

Contents

Darkplaces virtual file system is overlay file table that combines real file system and files stored in PK3 and PAK game archives.

The goals it provides:

  • transparent access to separate gamedir storing all writeable files (My Documents/My Games)
  • access files in archives just like they were stored on HDD
  • mod support (mods can override files, add new files)
  • safety (gamecode cannot damage game files)

[edit] How file table is maked

  1. First gamedir is processed
    1. Archives processed sequentally (by alphabetical order), files with same name gets overlapped
    2. Files with empty contents overlapping other files, makes them 'deleted' to the file system
    3. Real files stored in gamedir is processed and overlap files in archives
  2. Next gamedir is processed

[edit] Quirks

Since virtual file system is, effectively, an abstraction layer, it has its own quirks.

[edit] 1. Homedir may be different than gamedir

This means config.cfg, screenshots etc. are stored in different directory, like in "My Documents/My Games/gamedir"

[edit] 2. For written files, "data/" are automatically added

When QC writes any files, engine automatically adds 'data/' to the path, so gamecode cannot damage game files, maps etc. But file read is not the same. It could read files from base directory, open maps etc.

So if you write, for example, foo.txt (which will be written to data/foo.txt) and have foo.txt in gamedir, you should set path "data/foo.txt" when reading the file, and set path "foo.txt" when writing. If you dont, you will write to file under "data/", but read file that is in gamedir.

[edit] 3. "./" and "../" is not allowed

To protect gamecode from damaging files, any use of "." and ".." path operators is forbidden.

[edit] 4. Not fully integrated with map editor

Map editor do not support Virtual File System in model selection dialogue (entity inspector), it only can select real files. This is not a problem with developed version of Blood Omnicide (SVN working copy with test installation), but release verson SDK should make sure all game models is unpacked in order to make editor see them in model selection dialog box.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox