Verse Scripting for Beginners: Your First UEFN Device
What Is Verse?
Verse is Epic Games' programming language designed specifically for UEFN. If you've used Python, you'll find Verse familiar — it uses indentation-based syntax and reads almost like English. But it also borrows ideas from functional programming languages like Haskell, making it powerful for game logic.
Every custom behavior in UEFN that goes beyond basic Creative devices requires Verse. Scoring systems, custom UI, loadout managers, round management, ranked progression — all Verse.
Setting Up Your First Verse Device
In UEFN, create a new Verse device:
- Open your project in UEFN
- Go to Verse menu → Create New Verse File
- Choose Creative Device as the template
- Name it
my_first_device
UEFN generates a boilerplate file that looks like this:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
my_first_device := class(creative_device):
OnBegin<override>()<suspends>:void=
Print("Hello, Fortnite!")Let's break this down.
Understanding the Basics
`using` statements — These import APIs. /Fortnite.com/Devices gives you access to Creative devices. /Verse.org/Simulation provides core simulation features. /UnrealEngine.com/Temporary/Diagnostics gives you Print() for debugging.
Class definition — my_first_device := class(creative_device) creates a new device class that inherits from creative_device. This is your custom device that you'll place in the world.
OnBegin — This function runs when the game starts. The <override> tag means you're replacing the parent class's OnBegin. The <suspends> tag means this function can use async operations (like Sleep()).
Building a Kill Counter
Let's build something useful — a device that tracks kills and displays them. First, you need to reference a UI device in your level:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
kill_counter := class(creative_device):
@editable
EndGameDevice : end_game_device = end_game_device{}
var KillCounts : [agent]int = map{}
OnBegin<override>()<suspends>:void=
# Subscribe to elimination events
GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerAdded)
OnPlayerAdded(Player : player):void=
if (FortCharacter := Player.GetFortCharacter[]):
FortCharacter.EliminatedEvent().Subscribe(OnEliminated)
OnEliminated(Result : elimination_result):void=
if (Eliminator := Result.EliminatingCharacter):
if (Player := player[Eliminator.GetAgent[]]):
if (set KillCounts[Player] += 1) {}Key Verse Concepts
Failable expressions — Verse uses if for operations that might fail. Player.GetFortCharacter[] might return nothing if the player has no character. The [] brackets indicate a failable call, and wrapping it in if handles the failure case gracefully.
Mutability — Variables declared with var can be changed. Without var, values are immutable by default. This prevents accidental state mutations.
Events and subscriptions — Verse uses an event-driven pattern. You subscribe to events (PlayerAddedEvent, EliminatedEvent) and provide callback functions. This is how you react to gameplay without polling.
Maps and arrays — [agent]int is a map type (dictionary) mapping agents to integers. map{} creates an empty one.
Common Patterns
Here are patterns you'll use in almost every Verse device:
Timer/delay:
Sleep(5.0) # Wait 5 secondsLoop:
loop:
DoSomething()
Sleep(1.0)Player iteration:
Players := GetPlayspace().GetPlayers()
for (Player : Players):
# Do something with each playerNext Steps
This guide covers the absolute basics. To go deeper:
- Read Epic's official Verse documentation
- Study open-source Verse projects on GitHub
- Practice by rebuilding existing Creative devices in Verse
- Join the UEFN Discord community for help
Building custom Verse devices is what separates professional UEFN developers from hobbyists. If you need complex custom mechanics for your map, our team specializes in Verse scripting — from custom scoring systems to full game mode frameworks.
Check out our portfolio to see Verse in action with over 4.8 billion minutes played.
Kaio
UEFN Map Developer at Kaio Corporation
Professional Fortnite UEFN map developer. 4.8B+ minutes played. Learn more →
Need a custom map?
Get in touch →