The Ghost in the Machine: Tracking Player Chaos with Verse Analytics
Tutorial beginner

The Ghost in the Machine: Tracking Player Chaos with Verse Analytics

Updated beginner

The Ghost in the Machine: Tracking Player Chaos with Verse Analytics

So, you’ve built the ultimate deathmatch arena. It’s got trap floors that spawn when you blink, loot goblins that steal your shield potions, and a storm that moves at the speed of light. But here’s the million-dollar question: Is anyone actually playing it? Or did everyone just spawn, look at the map, and immediately quit because the jump pad was broken?

This is where Analytics come in. Think of Analytics as the invisible security camera system of your island. It doesn’t stop the player from getting eliminated, but it tells you where they died, what killed them, and how long they stuck around. In Verse, we don’t just guess what’s happening; we ask the game to "submit" a report whenever something interesting occurs.

In this tutorial, we’re going to build a simple "Chaos Counter." We’ll create a Verse device that watches a specific zone. Every time a player enters, it sends a signal to Epic’s servers saying, "Hey, a player just entered the 'Danger Zone'!" You’ll learn how to hook up devices, handle player data, and send those crucial reports.

What You'll Learn

  • The Concept of an "Agent": Why players are special data packets in Verse.
  • The "Submit" Button: How to tell an Analytics device to record an event.
  • Device Linking: How to make a Verse script talk to a standard Creative device.
  • Event Listening: How to trigger code when a player moves.

How It Works

Before we touch the code, let’s map this to something you already know.

Imagine you’re in a Battle Royale. You have a Scoreboard. The scoreboard doesn’t care why you got an elimination; it just needs to know that it happened so it can update the number. In Fortnite Creative, an Analytics Device is that scoreboard’s data collector. It sits in the world, waiting for a signal.

However, the Analytics device is lazy. It won’t record anything unless you tell it to. It needs a Command. In Verse, that command is called Submit.

But who is the command for? The Analytics device needs to know who is being tracked. In programming terms, this "who" is called an Agent.

  • Agent: Think of an Agent as a player’s "digital twin" or their specific ticket to the game session. It’s not just the character model; it’s the unique ID that tracks that specific person’s stats. When you pass an Agent to the Analytics device, you’re saying, "Record this event for this specific player."

Finally, how do we trigger this? We use a Trigger Volume (or a custom Verse event). When a player crosses a line, our Verse code wakes up, grabs that player’s Agent ID, and hands it to the Analytics device’s Submit function. It’s like a bouncer at a club: the player (Agent) arrives, the bouncer (Verse) checks the list, and stamps their hand (Submit) so the DJ (Analytics) knows they’re inside.

Let's Build It

We are going to build a "Welcome to the Pit" tracker. When a player steps into a specific zone, the game logs their entry.

Step 1: Set the Stage

  1. Open UEFN and drop an Analytics Device onto your island. Let’s call it Analytics_Dev_01.
  2. Drop a Trigger Volume nearby. Make it big enough to walk into.
  3. Create a new Verse file. Go to the Verse tab in the toolbar, click New File, and name it ZoneTracker.verse.

Step 2: The Code

Copy and paste this code into your ZoneTracker.verse file. Don’t worry if it looks scary; we’ll break it down line by line.

# Import the necessary Fortnite devices
using { /Fortnite.com/Devices }

# This is our Verse Device. It will live inside the Trigger Volume.
ZoneTrackerDevice : verse_device = {
    # We need a reference to the Analytics device.
    # Think of this as the 'wires' connecting our script to the device.
    AnalyticsRef : AnalyticsDevice
    
    # This function runs when the game starts or the device is initialized.
    OnCreated():void= {
        # Optional: Print to console to know it loaded
        print("ZoneTracker is online and watching!")
    }
    
    # This is the magic part. 
    # This function is called automatically by the Trigger Volume 
    # when a player enters.
    OnAgentEntered(Agent:agent):void= {
        # We take the 'Agent' (the player) and tell the Analytics device to record it.
        # It's like handing the bouncer the player's ID card.
        AnalyticsRef.Submit(Agent)
    }
}

Step 3: Connecting the Dots

Now that the brain (Verse) is written, we need to connect it to the body (Creative Devices).

  1. Compile: Click Compile in the Verse editor. If you see green checkmarks, you’re good. If you see red, check your spelling.

  2. Place the Verse Device: Go back to your level. In the Verse tab, find your ZoneTracker device and drag it into the scene. Place it inside the Trigger Volume you made earlier.

  3. Link the Analytics Device:

    • Select your ZoneTracker Verse device in the level.
    • Look at the Details panel on the right.
    • Find the property named AnalyticsRef.
    • Click the Picker (the little box icon) and select the Analytics_Dev_01 you placed earlier.
    • Why? This tells the Verse script: "When I tell you to Submit, use this specific Analytics device, not a random one floating in space."
  4. Hook the Trigger:

    • Select the Trigger Volume.
    • In the Details panel, find Verse Event or On Agent Entered.
    • Link it to your ZoneTracker device’s OnAgentEntered function. Note: Depending on your UEFN version, you might need to ensure the Verse device is listening to the Trigger's output. Usually, placing the Verse device inside the trigger and ensuring the script has the correct event signature (OnAgentEntered) allows the engine to auto-bind if configured, or you manually link the Trigger's "On Enter" to the Verse device.

    Correction for clarity: In modern UEFN, you often attach the Verse script to the Trigger Volume directly via the Verse Script property in the Trigger's details, or you use a Verse Device that listens to the Trigger. The cleanest way for beginners:

    1. Place ZoneTracker Verse device.
    2. Select the Trigger Volume.
    3. In the Trigger's Details, find Verse Script.
    4. Select your ZoneTracker device.
    5. In the Verse code, ensure the function name matches the expected event. The code above uses OnAgentEntered, which is the standard event for agents entering a scope.

Step 4: Test It

  1. Click Launch Session.
  2. Walk into the Trigger Volume.
  3. You won’t see anything happen visually (good, it’s supposed to be invisible!).
  4. Check your Console (if you enabled print statements) or look at the Analytics Dashboard in UEFN after the session ends. You should see an event logged for that player entering the zone.

Try It Yourself

You’ve got the basics down. Now, make it more interesting.

Challenge: Modify the code to track multiple zones.

  1. Create a second Trigger Volume and a second Analytics Device (or reuse the first one, but you’ll need a second Verse script).
  2. Create a new Verse script called ExitTracker.
  3. Use the OnAgentExited event (instead of Entered) to log when players leave the zone.
  4. Hint: You’ll need to copy the ZoneTrackerDevice structure, rename it, and change the function name to OnAgentExited.

Bonus Hint: What happens if you put two Verse devices in the same trigger? They both fire! Try stacking a "Welcome" message and an "Exit" message on the same zone to see how the events stack up.

Recap

  • Analytics Devices are the record-keepers of your island.
  • Submit(Agent) is the command that sends a player’s data to those record-keepers.
  • Agents are the unique identifiers for players.
  • Verse acts as the bridge, listening for game events (like entering a zone) and triggering the Submit command.

You just built the foundation for data-driven game design. Next time, we’ll look at how to use that data to change the game in real-time. Until then, keep tracking, keep building, and may your analytics be ever in your favor.

References

  • https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-analytics-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/devices/analytics_device/submit
  • https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/analytics_device/submit
  • https://dev.epicgames.com/documentation/en-us/fortnite/using-analytics-devices-in-fortnite-creative
  • https://dev.epicgames.com/documentation/en-us/fortnite/speedway-race-with-verse-persistence-template

Verse source files

Turn this into a guided course

Add Submits an event for `Agent` to generate analytics. 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.

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.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in