Files in a scene
After creating a new scene using the CLI, the scene folder will have a series of files with default content.
Default files in a local scene #
Scenes include the following files:
- src/index.ts: The entry point of the scene.
- scene.json: The manifest that contains metadata for the scene.
- package.json and package-lock.json: Specify the versions of all dependencies of the scene.
- tsconfig.json: Typescript configuration file.
- .dclignore: Lists what files in your project not to deploy to IPFS.
index.ts #
This is the entry point to your scene’s code. You could fit your entire scene’s logic into this file, although for clarity in most cases we recommend spreading out your code over several other .ts files.
In most cases, you’ll only need to edit this and other .ts files to create your scene. It contains the code that generates the entities, components and systems of your scene.
When running the scene, the contents of your .ts
files are compiled to a single minified .js
file, bin/scene.js
.
📔 Note: You can use another tool or language instead of TypeScript, so long as your scripts are contained within a single Javascript file (bin/scene.js). All provided type declarations are made in TypeScript, and other languages and transpilers are not officially supported.
scene.json #
The scene.json file is a JSON formatted manifest for a scene in the world. A scene can span a single or multiple LAND parcels. The scene.json manifest describes what objects exist in the scene, a list of any assets needed to render it, contact information for the parcel owner, and security settings.
For more information see scene metadata. You can also read the original specification proposal for this metadata.
All of this metadata is optional for previewing the scene locally, but part of it is needed for deploying. You can change this information manually at any time.
package.json #
This file provides information to NPM that allows it to identify the project, as well as handle the project’s dependencies. Decentraland scenes require one main package:
- decentraland-ecs: the fundamental dependency of the Decentraland SDK, including all the definitions and types for the engine, components, systems, etc.
Your scene may include any number of other packages, for example to include libraries that can help make the writing of code easier, or enable special functionalities.
package-lock.json #
This file lists the versions of all the other dependencies of the project. These versions are locked, meaning that the compiler will use literally the same minor release listed here.
You can change any package version manually by editing this file.
tsconfig.json #
Directories containing a tsconfig.json file are root directories for TypeScript Projects. The tsconfig.json file specifies the root files and options required to compile your project from TypeScript into JavaScript.
When installing any additional libraries to your scene, an entry should be added automatically to this file. For installing Decentraland utils libraries, it shouldn’t be necessary to manually do any changes to this file.
Recommended file locations #
Keep in mind that when you deploy your scene to Decentraland, any assets or external libraries that are needed to use your scene must be either packaged inside the scene folder or available via a remote server.
Anything that is meant to run in the player’s client must located inside the scene folder. You shouldn’t reference files or libraries that are installed elsewhere in your local machine, because they won’t be available to the deployed scene.
We suggest using these folder names consistently for storing the different types of assets that your scene might need:
- 3D models:
/models
- Videos:
/videos
- Sound files:
/sounds
- Image files for textures (except for glTF models):
/materials
- .ts definitions for components
/src/components
- .ts definitions for systems
/src/systems
📔 Note: Supporting files for glTF models, like their texture image files or .bin files, should always be placed in the same folder as the model’s .gltf or .glb file.
📔 Note: We recommend using always lower case names for all folders and file names, to avoid possible issues.
The dclignore file #
All scenes include a .dclignore file, this file specifies what files in the scene folder to ignore when deploying a scene to Decentraland.
For example, you might like to keep the Blender files for the 3D models in your scene inside the scene folder, but you want to prevent those files from being deployed to Decentraland. In that case, you could add *.blend
to .dclignore to ignore all files with that extension.
What to ignore | Example | Description |
---|---|---|
Specific files | BACKUP.ts |
Ignores a specific file |
Folders | drafts/ |
Ignores entire contents of a folder and its subfolders |
Extensions | *.blend |
Ignores all files with a given extension |
Name sections | test* |
Ignores all files with names that match the query. In this case, that start with test |