Documentation/Articles/Overview of File System

From NeoAxis 3D Engine Wiki

Jump to: navigation, search
Go to higher level


TO DO: MOVE INFO ABOUT Deployment.config TO DEPLOYMENT TOOL ARTICLE



Contents

Overview

File system is an engine component used for managing files of a project. It includes a unified file structure and general rules of file access.

All files of a project are stored in the Data folder.

The file system enables file-archiving (for example in .zip files). Working with archives does not differ from working with ordinary files.

Note: You always have to specify the path from the Data folder of the project you are working on. (E.g.: "Sounds\Beep.ogg")

Data folder

The Data folder contains all files of a project.

It is strongly recommended not to change files in this folder while the application is still running.

The Data folder has the following structure:

  • Data
    • _Tests – contains files used for engine testing (Available from Resource Editor). Some interesting physical models can be found in the "Data\_Tests\Physics" folder.
    • Caches - contains engine precomputed data (e.g. shader cache).
    • Cursors – contains mouse cursors.
    • Definitions – contains engine settings.
    • Effects - contains examples of the particle systems.
    • Fonts – contains fonts.
    • Gui – contains files and textures of user interface.
    • Languages – contains project localization files.
    • Maps – contains maps created with Map Editor.
    • Materials – contains shaders, basic materials and post-processing files.
    • Models – contains models of various types.
    • Sounds – contains project sound files.
    • Types – contains game object files.
    • Utils – contains utilities for editors.

These folders are not binding for the corresponding file types. You can save files to any folder irrespective of their type. However, it is better to stick to the given structure. You can also save all files of a project to a single folder. (e.g. "Data\MyProject").

UserSettings (user settings and temporary files)

You can find the UserSettings folder in the "Game\Bin" directory. This folder is used for storing user settings and temporary files including: general engine settings, savegames, logs and screenshots. A fully accomplished project usually makes file changes only in this folder.

Switching to the "Users" system folder

Since Windows denies file changes in the Program Files folder, all user files should be stored in the "C:\Users" system folder (for winXP in the "C:\Documents and Settings" folder). You can change user data save path from the UserSettings folder to the "C:\Users" system folder.

To do this, add the Data\Definitions\Deployment.config file with the following code:

userDirectory = YourGameDirectory

By doing so you will make your application save files:

  • for Windows Vista/7 to "C:\Users\%username%\AppData\Local\YourGameDirectory".
  • for Windows XP to "C:\Document and Settings\%username%\Application Data\YourGameDirectory".
  • for Mac OS X to "/Users/%username%/Library/Application Support/YourGameDirectory".

Deployment Tool automatically creates the Deployment.config file.

Accessing UserSettings from code

To access user settings from code you have to add a prefix to the path. E.g.: "user:Logs\Game.log".

Archives support

For the file system it is possible to store files in archives (e.g. in zip files). Working with resources in archives is in all things the same as working with ordinary files.

Currently only .zip archives are supported.

You can also create your own achieve type (e.g. in order to encrypt resources data).

You may examine the "Data\_Tests\ZipArchive" folder in the Resources Editor as an example.