Build a Deathrun Island with Verse
Unverified — this example may not compile as-is.
The Verse code below did not pass our automated compile check, so it isn't marked verified and is hidden from the guide listing. The explanation may still be useful, but treat the code as a draft and adapt it before use.
Build a Deathrun Island with Verse
Do you love jumping over lava? Do you enjoy tricky obstacle courses? A Deathrun is a game where you race through levels. You must jump, climb, and dodge traps. If you fall, you restart the level. Let’s make one!
What You'll Learn
- What a Deathrun game is.
- How to track levels using Verse.
- How to use devices to count progress.
- How to build your first obstacle course.
How It Works
Think of a Deathrun like a video game level. You start at Level 1. You jump to Level 2. Then Level 3. Each level is harder.
In UEFN, we use devices to make this happen.
- Player Checkpoint: This is like a save point. When you touch it, you know you passed that part.
- Mutator Zone: This is a special area. It changes how the game works. We use it to signal the next level.
- Analytics Device: This is a counter. It keeps score. It counts how many levels you finish.
We will link these devices together. When you hit a checkpoint, the counter goes up. When you enter the next zone, the game knows you are ready for the next step. This is called Direct Event Binding. It means Device A talks to Device B.
Let's Build It
We will write a small script. It will watch for players. It will count their levels.
Copy this code into a Verse file in your project.
using /Fortnite.com/Devices
using /Engine/Systems
using /Verse.org/Sim
# This is our main script.
# It runs when the game starts.
deathrun_script := class(creative_device):
# This is a variable.
# It stores the current level number.
current_level := 0
# This function runs when the game begins.
OnBegin<override>()<suspends>: void =
# Print a message to the debug screen.
print("Deathrun Started! Level 1.")
# Wait for the player to hit a checkpoint.
# We will bind this later in the editor.
# For now, we just set up the logic.
pass
# This function runs when a level is completed.
OnLevelComplete(): void =
# Add 1 to the level counter.
current_level += 1
# Print the new level number.
print("Level Complete! You are on Level:", current_level)
# Here you would trigger the next level.
# We will do this with devices.
Walkthrough
deathrun_script: This is the name of our script. Think of it as a label on a box.current_level: This is a variable. It is a container. It holds the number 0 at first.OnBegin: This runs once. It says "Hello" to the player.OnLevelComplete: This runs every time a player finishes a stage. It adds 1 to the counter.
Connecting Devices
Now, go to the Editor.
- Place a Player Checkpoint. Name it "Checkpoint 1".
- Place a Mutator Zone for Level 2.
- Place an Analytics Device.
- Bind the Analytics Device to the Mutator Zone.
- Select the Analytics Device.
- Click "Bind".
- Choose "Submit" as the function.
- Choose the Mutator Zone.
- Choose "On Player Entering Zone" as the event.
Now, when a player enters the zone, the counter goes up!
Try It Yourself
Can you add a second checkpoint?
Hint:
- Place another Player Checkpoint after the first Mutator Zone.
- Name it "Checkpoint 2".
- Try to bind a second Analytics Device to the next Mutator Zone.
- See if the counter goes to 2!
Recap
- A Deathrun is a jumping obstacle course.
- Variables store changing numbers, like your level.
- Devices talk to each other using events.
- Analytics devices count your progress.
References
- https://dev.epicgames.com/documentation/en-us/fortnite/how-discover-works-in-fortnite
- https://dev.epicgames.com/documentation/en-us/uefn/using-analytics-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-analytics-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/using-analytics-devices-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite-creative/create-a-free-for-all-game-in-fortnite-creative
Verse source files
- 01-device.verse · device
Turn this into a guided course
Add Deathrun 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.