Skip to content

Step 3: Time Limit Guide

Can TATAR edited this page Feb 23, 2026 · 1 revision

Time Limit & Endless Mode - Quickstart Guide

Overview

Time Limit system provides stage time limits and endless mode support for Vampire Survivors-style roguelike games.

Features

  • ✅ Configurable time limit (default: 30 minutes)
  • ✅ Endless mode (unlimited game duration)
  • ✅ Blueprint events (OnTimeLimitReached, OnGameTimeUpdated)
  • ✅ Runtime changeable (SetEndlessMode, SetTimeLimit)
  • ✅ UI-friendly (events for timer display)

Quick Start

Step 1: Game Director Settings

Add Game Director actor to level and configure:

Time Limit:
  ✓ Endless Mode: false (time limit active)
  ✓ Time Limit: 1800.0 (30 minutes = 30 * 60 = 1800 seconds)

Time Limit Examples:

  • 15 minutes: 900.0 seconds
  • 20 minutes: 1200.0 seconds
  • 30 minutes: 1800.0 seconds (default)
  • 45 minutes: 2700.0 seconds

Step 2: Listen to Events

In Game Mode or Player Controller Blueprint:

Event BeginPlay
  ↓
Get Actor of Class (URFGameDirector)
  ↓
Bind Event to OnTimeLimitReached
  ↓
[Custom Event: Handle Time Limit Reached]
    Input: Total Game Time (float)
    ↓
    Show "Time's Up!" message
    ↓
    Trigger end game sequence

Step 3: Create Timer UI

To display timer in Widget Blueprint:

Event Construct
  ↓
Get Actor of Class (URFGameDirector)
  ↓
Bind Event to OnGameTimeUpdated
  ↓
[Custom Event: Update Timer Display]
    Input: Current Time (float), Time Remaining (float)
    ↓
    Format Time (MM:SS)
    ↓
    Set Text (Timer Text Block)

Easy UI Functions

Easy UI functions provide access to timer information without finding Game Director reference.

Time Functions

Get Current Game Time (Easy UI)

Returns current game time in seconds.

Get Current Game Time (Easy UI)
  ↓
Returns: 1250.5 (seconds)

Get Time Remaining (Easy UI)

Returns remaining time in seconds.

Get Time Remaining (Easy UI)
  ↓
Returns: 549.5 (seconds) or -1.0 (endless mode)

Is Time Limit Reached (Easy UI)

Has time limit been reached?

Is Time Limit Reached (Easy UI)
  ↓
Returns: true/false

Is Endless Mode (Easy UI)

Is endless mode active?

Is Endless Mode (Easy UI)
  ↓
Returns: true/false

Format Functions

Get Timer Display String (Easy UI)

Returns complete timer display string (ready for UI).

Get Timer Display String (Easy UI)
  ↓
Returns: "20:50 / 30:00" or "20:50 (Endless)"

Format Game Time (Easy UI)

Converts seconds to MM:SS format.

Format Game Time (Easy UI)
  └─ Time In Seconds: 125.5
  ↓
Returns: "02:05"

Control Functions

Set Endless Mode (Easy UI)

Enables/disables endless mode.

Set Endless Mode (Easy UI)
  └─ Enabled: true
  ↓
Returns: true (success) / false (director not found)

Set Time Limit (Easy UI)

Changes time limit.

Set Time Limit (Easy UI)
  └─ New Time Limit: 1200.0 (20 minutes)
  ↓
Returns: true (success) / false (director not found)

Time Limit Configuration

Game Director Settings

Endless Mode (bool)

  • false: Time limit active (default)
  • true: Unlimited game duration

Time Limit (float)

  • Time limit in seconds
  • Minimum: 60.0 seconds
  • Default: 1800.0 seconds (30 minutes)
  • Only visible when Endless Mode = false

Runtime Changes

Change settings at runtime in Blueprint:

// Enable endless mode
Get Game Director
  ↓
Set Endless Mode (true)

// Change time limit (20 minutes)
Get Game Director
  ↓
Set Time Limit (1200.0)

Endless Mode

What is Endless Mode?

Endless mode allows game to continue indefinitely without time limit.

Features:

  • No time limit
  • OnTimeLimitReached event never triggers
  • GetTimeRemaining() returns -1
  • Waves continue infinitely

Enabling Endless Mode

In Editor (Game Director)

Time Limit:
  ✓ Endless Mode: true

In Blueprint (Runtime)

Get Game Director
  ↓
Set Endless Mode (true)

Endless Mode UI

Display endless mode in timer UI:

Event: Update Timer Display
  Input: Current Time, Time Remaining
  ↓
  Branch: Time Remaining == -1?
    ├─ True: (Endless Mode)
    │   ↓
    │   Format Text ("Time: {0} (Endless)")
    │     └─ {0}: Current Time (MM:SS)
    │   ↓
    │   Set Text (Timer Text)
    └─ False: (Normal Mode)
        ↓
        Format Text ("Time: {0} / {1}")
          ├─ {0}: Current Time (MM:SS)
          └─ {1}: Time Remaining (MM:SS)
        ↓
        Set Text (Timer Text)

Blueprint Events

OnTimeLimitReached

Triggered when time limit reached (only when Endless Mode = false).

Event: On Time Limit Reached
  Input: Total Game Time (float)
  ↓
  Show "Time's Up!" notification
  ↓
  Play sound effect
  ↓
  Trigger end game sequence
  ↓
  [Optional] Spawn Reaper enemy

Usage Scenarios:

  • Show game over screen
  • Spawn Reaper enemy (Vampire Survivors style)
  • Give bonus gold (500 gold)
  • Save statistics

OnGameTimeUpdated

Triggered every second (for timer UI).

Event: On Game Time Updated
  Input: Current Time (float), Time Remaining (float)
  ↓
  Format Current Time (MM:SS)
  ↓
  Format Time Remaining (MM:SS)
  ↓
  Update Timer UI
  ↓
  [Optional] Change color if time < 60 seconds (red warning)

Usage Scenarios:

  • Timer UI update
  • Last minute warning (red color)
  • Sound effect (last 10 seconds countdown)

UI Integration

Creating Timer Widget (Easy UI Method)

Simple Method

Event Tick:

Event Tick
  ↓
Get Timer Display String (Easy UI)
  ↓
Set Text (Timer Text)

Advantages:

  • ✅ Single line of code
  • ✅ No Game Director reference needed
  • ✅ Automatic formatting

Disadvantages:

  • ⚠️ Runs every frame (performance)

Performance Method

Event Construct:

Event Construct
  ↓
Get Actor of Class (URFGameDirector)
  ↓
Bind Event to OnGameTimeUpdated
  ↓
[Custom Event: Update Timer]

Custom Event: Update Timer

Input: Current Time (float), Time Remaining (float)
  ↓
Format Game Time (Easy UI)
  └─ Time In Seconds: Current Time
  ↓
Set Text (Current Time Text)
  ↓
Branch: Time Remaining < 0?
  ├─ True: Set Text "Endless"
  └─ False: Format and Set Remaining Time

Advantages:

  • ✅ Updates only once per second
  • ✅ Performance-friendly
  • ✅ Event-driven

Timer Color Coding

Change color as time decreases:

Function: Get Timer Color
  Input: Time Remaining (float)
  ↓
  Branch: Time Remaining < 60?
    ├─ True: Return Red (warning)
    ├─ Time Remaining < 300? (5 min)
    │   └─ Return Orange (caution)
    └─ Else: Return White (normal)

Example Usage Scenarios

Scenario 1: Vampire Survivors Style (30 Minutes + Reaper)

Goal: Spawn Reaper after 30 minutes, player tries to escape.

Game Director Settings:

Endless Mode: false
Time Limit: 1800.0 (30 minutes)

Blueprint (Game Mode):

Event: On Time Limit Reached
  Input: Total Game Time
  ↓
  Show Notification ("The Reaper has arrived!")
  ↓
  Play Dramatic Sound
  ↓
  Spawn Actor (BP_Reaper)
    └─ Location: Near Player

Scenario 2: Endless Mode (Infinite Waves)

Goal: Player plays as long as desired, no time limit.

Game Director Settings:

Endless Mode: true

Blueprint (UI Widget):

Event: Update Timer
  Input: Current Time, Time Remaining
  ↓
  Branch: Time Remaining == -1?
    ├─ True: Format Text ("Time: {0} (Endless)")
    └─ False: Format Text ("Time: {0} / {1}")

Scenario 3: Stage Selection (Different Time Limits)

Goal: Each stage has different time limit.

Stage Selection Blueprint:

On Stage Selected
  Input: Stage ID (int)
  ↓
  Get Game Director
  ↓
  Switch on Stage ID:
    ├─ Case 0: Set Time Limit (600.0)   // 10 min
    ├─ Case 1: Set Time Limit (1200.0)  // 20 min
    ├─ Case 2: Set Time Limit (1800.0)  // 30 min
    ├─ Case 3: Set Time Limit (2700.0)  // 45 min
    └─ Case 4: Set Endless Mode (true)

Scenario 4: Last Minute Warning

Goal: Warn player in last 60 seconds.

Blueprint (UI Widget):

Event: Update Timer
  Input: Current Time, Time Remaining
  ↓
  Branch: Time Remaining < 60 AND Time Remaining > 0?
    ├─ True: Set Text Color (Red) + Play Animation (Flash)
    └─ False: Set Text Color (White)

Troubleshooting

Timer Not Showing

Problem: Timer not visible in UI.

Solutions:

  1. Is event binding done?

    • Bound to OnGameTimeUpdated event?
    • Check binding code in Event Graph
  2. Does Game Director exist?

    • Is URFGameDirector actor in level?
    • Is Get Actor of Class successful?

Time Limit Event Not Triggering

Problem: OnTimeLimitReached event not working.

Solutions:

  1. Is Endless Mode off?

    • Game Director Endless Mode must be false
    • Was SetEndlessMode(false) called at runtime?
  2. Is Time Limit correct?

    • Time Limit must be > 0
    • CurrentGameTime must be >= TimeLimit
  3. Is event binding done?

    • Bound to OnTimeLimitReached event?

Endless Mode Not Working

Problem: Endless Mode active but time limit still exists.

Solutions:

  1. Is Endless Mode active?

    • Game Director Endless Mode must be true
    • IsEndlessMode() should return true
  2. Is UI updated?

    • Does GetTimeRemaining() return -1?
    • Does UI show endless mode display?

Advanced Customizations

Time Bonus Pickups

Pickups that add time:

Event: On Pickup Collected (Time Bonus)
  Input: Bonus Time (float)
  ↓
  Get Game Director
  ↓
  Branch: Is Endless Mode?
    ├─ True: Skip (no effect in endless)
    └─ False:
        ↓
        Get Time Limit
        ↓
        Set Time Limit (Current + Bonus Time)
        ↓
        Show Notification ("+30 seconds!")

Multiple Reaper Spawns

Spawn Reaper every minute after time limit:

Event: On Time Limit Reached
  ↓
  Set Timer by Function Name
    └─ Function: Spawn Reaper
    └─ Time: 60.0 (every minute)
    └─ Looping: true

Support

If you encounter issues:

  1. Enable debug logging (Game Director)
  2. Check Output Log
  3. Verify event bindings
  4. Check GetTimeRemaining() value

Note: This system is optimized for Vampire Survivors-style roguelike games.

Clone this wiki locally