Hazel

Core Concepts

A handful of words come up on almost every page of these docs. Here is what each one means, in plain terms.

If it helps, think of making a game like putting on a play. The project is the theatre company: everything you own. Each scene is a stage set. The entities are the actors and props on that set, their components are their costumes and abilities, and assets are the wardrobe and prop store backstage. Play mode is opening night.

Projects

A project is one game, and it is just a folder on your disk. Inside it are your scenes, models, textures, sounds, scripts and settings.

You can tell a folder is a project because it has a project.toml file at the top. That file holds the game's settings: its name, which scene it starts in, its window size and so on. You rarely open it by hand; Settings edits it for you.

A brand new project looks like this:

my_first_game/
├── project.toml
└── scenes/
    └── main.bsn

More folders appear as you add things: scripts/ when you make a script, materials/ when you make a material, and whatever folders you import art into.

Because a project is only a folder, you can back it up, zip it, or put it in version control like any other folder.

Scenes

A scene is one place in your game: a level, a room, a title screen, a menu. It is saved as a .bsn file, usually in the scenes/ folder.

A game can have as many scenes as you like. One of them is the boot scene: the scene your game starts in. A new project's boot scene is main. You can make a different scene the boot scene from the scene switcher in the top bar, or from the Inspector with nothing selected.

The scene switcher in the top bar shows which scene you are editing, and lets you jump to another.

Entities

An entity is one thing in a scene: the player, a tree, a light, a camera, a sound, an invisible trigger zone. Everything you can see in the Hierarchy is an entity.

The Hierarchy listing a small scene

Every entity has a name, which must be unique in its scene. Names are lowercase with underscores, like player or front_door, and the editor tidies whatever you type into that form. Scripts can find an entity by its name.

Entities can be nested: drag one onto another in the Hierarchy and it becomes a child. A child moves, turns and scales with its parent. That is how an imported car keeps its wheels attached, and how a torch carries its light around.

On its own, an entity is just a name. What it is comes from its components.

Components

A component is one piece of an entity: one ability, or one set of settings. Stack a few together and you get something real.

ComponentWhat it gives an entity
TransformA place in the world: position, rotation and scale. Nearly everything has one.
A mesh and a MaterialA shape you can see, and what its surface looks like.
A light, such as Sun or Point LightLight.
A cameraA view the game can be seen through.
PhysicsWeight, collisions, gravity.
ScriptsBehaviour you write yourself.

The Inspector for a selected crate, with its Transform, Scripts and Material sections

Select an entity and its components appear in the Inspector, each in its own section. Change a value and you see the result straight away. The Add button at the top of the Inspector attaches another component; the bin icon on a section removes one.

A lamp, for example, could be: a Transform (where it stands), a mesh and Material (the lamp post you see), a Point Light (the glow), and a script (flicker at night).

Assets

An asset is a file your game uses: a 3D model, a texture, a sound, a material, a script, a scene. Assets live in your project folder, and the Assets tab in the bottom panel is a window onto that folder.

The Assets tab showing a project's folders and files

Entities use assets. Drop a model from the Assets panel into the viewport and you get an entity that shows that model. Change the asset, and every entity using it changes too.

To bring in files from elsewhere on your computer, use Import in the Assets panel or the main menu. See Assets.

Scripts

A script gives an entity behaviour: spin, follow the player, open when touched, count the score. Scripts are written in Rust, are attached to entities, and run while the game is playing. Renzora compiles them for you whenever you save one.

You do not need to be a Rust expert to start: a useful script can be five lines. See Your First Scene for one, and Rust Scripts for more.

Play mode

Press Play (or F5) and your game runs, starting from the boot scene. In the editor it shows up in the Game tab.

A game running after pressing Play

Three things are worth knowing:

  • Play saves first. The game reads your scene from disk, so the editor saves the scene you are editing before it starts.
  • The game is its own program. Whatever happens while it runs (things fall over, get destroyed, move around) does not change your scene. Stop it and everything is exactly as you left it.
  • Scripts only run while playing. In the editor, your scene sits still so you can work on it.

If you want to watch things move on the scene you are editing without starting the game, use Simulate from the arrow beside Play. It runs physics (and your scripts) right in the editor, and puts everything back when you stop.

The editor and the game are the same engine

The viewport is not a preview. It is the engine drawing your scene exactly as the game will, with the same lighting and the same materials. When you export, your game ships with that same engine, minus the editor.

What's next