# Sky High: Mastering Atmosphere with Verse
# Sky High: Mastering Atmosphere with Verse
Ever drop onto an island and feel like the lighting is just… off? Maybe it's too bright, too gloomy, or just doesn't match the vibe of your killer trap setup. In Fortnite Creative, you used to rely on static devices to tweak the sky, but Verse lets you script the sky itself. We're going to build a "Mood Ring" island where the entire atmosphere shifts based on player actions. We'll turn a sunny day into a spooky nightmare or a neon party just by hitting a button. No more boring, static suns—let's make the sky react.
What You'll Learn
- Variables: How to store the current "mood" of your sky like a scoreboard tracks points.
- Functions: Grouping multiple sky changes into one reusable command, like a combo move.
- Scene Graph Basics: Understanding that the sky isn't just a texture; it's a network of connected parts (the scene) that you can tweak.
- Verse Syntax: Writing actual code to control lighting, fog, and sky color.
How It Works
The Sky is Not Just a Picture
In regular Fortnite, the sky is mostly a background image. In Verse (and Unreal Engine 6), the sky is part of the Scene Graph. Think of the Scene Graph as the island's skeleton and nervous system. Every prop, player, and light is an Entity (a thing that exists) with Components (properties like color, position, or health). The sky is just another Entity in this graph, but it's a big one that affects everything.
Variables: The Sky's Current State
Imagine you're tracking eliminations. You have a number that goes up. A Variable is just a named box where you store data that can change. In our case, we'll store the "Sky Mood."
IsDaytime = true(Bright sun, blue sky)IsDaytime = false(Dark, foggy, scary)
Functions: The Combo Move
You don't want to write 50 lines of code every time the mood changes. A Function is like a pre-set loadout or a combo button. You define it once (e.g., "Make it Spooky"), and then you just call it whenever you want. It takes your input (the trigger) and runs all the steps to change the sky, fog, and lights automatically.
Why Verse?
Devices are great, but they're rigid. Verse gives you logic. You can make the sky change only if a player has a specific item, or only after a timer runs out. It's the difference between a light switch and a smart home system.
Let's Build It
We're building a "Day/Night Cycle Button." When a player hits a button, the sky flips from Day to Night. We'll use a Variable to track the state and a Function to handle the visual changes.
The Setup
- Place a Button: Find the "Button" device in the Creative inventory. Place it on the ground.
- Name Your Button: Click the button, go to the Details panel, and rename it
MoodSwitchin the Name field. This helps us find it in code. - Create a Verse Device: Place a "Verse Device" (or "Script" device) nearby. Open the code editor.
The Code
Copy this into your Verse script. Don't worry if it looks scary—we'll break it down line by line.
# This is a comment. Verse ignores lines starting with #.
# We're making a simple Day/Night switch.
# 1. Define our Script. In UEFN, Verse logic lives inside a creative_device class.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
# mood_sky_script is the container for our logic.
# It inherits from creative_device so UEFN recognises it as a placeable script device.
mood_sky_script := class(creative_device):
# 2. Variables: These are our "state trackers."
# CurrentMood is a boolean (true/false).
# Think of it like a light switch: On or Off.
# 'var' makes it mutable so we can toggle it later.
var CurrentMood : logic = true
# Reference to the skydome device placed on the island.
# Wire this up in the UEFN Details panel after placing the script device.
# skydome_device exposes EnableDayPhase / DisableDayPhase and
# fog controls we call below.
MoodSwitch : button_device = button_device{}
SkyDome : skydome_device = skydome_device{}
# OnBegin runs automatically when the game session starts.
# We use it to subscribe to the button's InteractedWithEvent.
OnBegin<override>()<suspends> : void =
# Connect the button's event to our handler function.
# Every time a player presses MoodSwitch, ChangeSkyMood fires.
MoodSwitch.InteractedWithEvent.Subscribe(OnButtonPressed)
# 3. Event handler: called by the Subscribe above.
# Agent is the player who pressed the button (required by the event signature).
OnButtonPressed(Agent : agent) : void =
ChangeSkyMood()
# 4. Function: This is our "Combo Move."
# It reads CurrentMood and applies the matching sky preset,
# then toggles the variable so the next press flips to the other state.
ChangeSkyMood() : void =
if (CurrentMood?):
# --- DAYTIME preset ---
# Re-enable the normal day phase on the skydome device.
# note: skydome_device is the real UEFN device; tweak its
# Day/Night settings in the Details panel for exact colours.
SkyDome.Enable()
Print("Sky set to: DAY")
else:
# --- NIGHTTIME preset ---
# Switch the skydome to its night phase.
SkyDome.Disable()
Print("Sky set to: NIGHT")
# 5. Toggle the variable for next time.
# 'not' is the Verse boolean negation operator.
# If it was true, make it false. If false, make it true.
if (CurrentMood?):
set CurrentMood = false
else:
set CurrentMood = true```
### Walkthrough: What Just Happened?
1. **`mood_sky_script := class(creative_device):`**
This starts our script. Think of it as opening a new level in the game editor. Everything inside this block belongs to our script.
2. **`var CurrentMood : logic = true`**
Here's our **Variable**. `logic` is Verse's boolean type—it can only be `true` or `false`. `var` marks it as mutable (changeable at runtime). We start with `true` (Daytime). This is like your health bar—it holds the current status.
3. **`ChangeSkyMood() : void =`**
This is our **Function**. `void` means it doesn't give back a value (like a score); it just *does* something. Inside, we have an `if` statement. This is like a decision point in a quest: "If the player has the key, open the door. Else, keep walking."
4. **`SkyDome.EnableDayPhase()` and `SkyDome.DisableDayPhase()`**
These are **API Calls** (Application Programming Interface). An API is like a menu at a restaurant. You don't cook the food (write the complex graphics code); you just order what you want from the menu. Here, we're ordering "Blue Sky" or "Dark Night" from the `sky_dome_device`.
5. **`set CurrentMood = not CurrentMood`**
The `not` keyword means "NOT." If `CurrentMood` is `true`, `not CurrentMood` becomes `false`. `set` is required in Verse whenever you change a `var` after its first assignment. This toggles the state so the next time you press the button, it flips back. It's like reloading a weapon: you're preparing for the next shot.
6. **`MoodSwitch.InteractedWithEvent.Subscribe(OnButtonPressed)`**
This is an **Event**. Events are like triggers in the game world. "When this happens, do that." Here, when the button named `MoodSwitch` is pressed, we run our `ChangeSkyMood` function.
## Try It Yourself
**Challenge:** Make the sky change color *twice* before it resets.
**Hint:**
1. Change your `CurrentMood` variable from a `logic` (true/false) to an `int` (integer, like 1, 2, 3).
2. Use an `if/else if/else` chain to check if the `int` is 1, 2, or 3.
3. Set different colors for each number (e.g., 1=Day, 2=Sunset, 3=Night).
4. Increment the counter (`CurrentMood = CurrentMood + 1`) and reset it to 1 if it gets too high.
**Why this works:** It teaches you how to manage multiple states, not just two. It's like having three different loadouts instead of just two.
## Recap
You've just written your first Verse script to control the sky. You learned that:
- **Variables** store changing data (like the current sky mood).
- **Functions** group actions together (like a combo move).
- **Events** trigger code (like pressing a button).
- The **Scene Graph** is the underlying structure that lets Verse manipulate the world.
The sky is no longer static. It's part of your game's logic. Go make it spooky, go make it bright, go make it weird.
## References
- https://dev.epicgames.com/documentation/en-us/fortnite/using-skydome-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/design-a-speedway-race-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-skydome-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-devices-in-fortnite
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add using-skydome-devices-in-fortnite-creative to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.
References
Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.