Debug views

Debug views are panels the engine draws over a running game, for the people making it. There's one so far: the profiler, which shows where a frame's time goes, and a tick's.

Turning them on

They're off until the game, or whoever starts it, asks for them:

  • The game asks with a setting (see Settings):

    tide
    settings
    {
        debugViews = true;
    }
  • Whoever starts it asks with --debug-views: tide run --debug-views, or a built game's own command line, like mygame --debug-views. On a web page, it's debug-views in the page's address: https://example.com/game.html?debug-views. This works whatever the setting says, so a build made to ship can be looked into without building it again.

With either, F7 shows the profiler, and F7 again hides it. The profiler measures while it is visible; the stats also measure while their drawer is open. With the profiler hidden and the stats closed, neither asks for timings. The game sees the key too.

Under tide run, changing the setting takes effect at the next reload. A setting is part of the build, so tide build keeps it: take debugViews out before players get the game, unless they may see the profiler too.

The profiler

The profiler has two columns: a frame on the left, a tick on the right. Its numbers are averages over the last half second, so they hold still long enough to read, and each row's bar is its share of its column's first row.

Frame  60 fps, longest 21.4 ms   16.67 ms     Tick  180 a second          0.93 ms
  Input                           0.02          Systems                   0.78
  Match                           3.20            Movement.Integrate      0.23
    Ticks  3.0 a frame, 2.0 again 2.80            Movement.Collide        0.19
    Netcode                       0.40            Combat.ApplyDamage      0.07
  Views                           1.37            3 more                  0.01
    DrawArena                     0.63          Changes, events           0.16
    Hud                           0.23
    GUI, tasks                    0.13
  Render                          0.60
  Other                           0.00
  Swap, idle                     11.48
Memory  162 MB in RAM, 12 MB on the GPU

A frame, in milliseconds a frame:

Row What it is
Frame From one frame's start to the next, with the frame rate and the longest frame of the half second
Input Reading the keyboard, the mouse, gamepads and touches
Match The match's share of the frame: its ticks, and its netcode
Ticks The game's ticks, and how many a frame ran. On a client, again is how many of them were predicted ticks run again, after another player's input turned out not to be what was guessed (see Networking)
Netcode What the match took beside its ticks: packets, snapshots, and hashing and packing worlds
Views Every view, then the six that took longest, by name, and the others together
GUI, tasks What the frame's views took beside the views themselves: the GUI, local tasks, and applying local changes
Render Drawing what the views recorded, as far as the CPU does it. GPU drawing time appears in the stats on backends with a GPU timer
Other The rest of what the frame did
Swap, idle The rest of the frame: waiting for the display, the GPU or the browser
Memory What the program has, as the system counts it, and what its drawing has on the GPU by the engine's own count (every texture, mesh and render target, by what each holds; not the window's framebuffer or the driver's own). No time, so no bar

A tick, in milliseconds a tick:

Row What it is
Tick One tick, and how many ran a second: more than the tick rate when ticks run again
Systems The tick's systems, from the first one's start to the last one's end, then the ten that took longest, by name with their namespace, and the others together
Changes, events What follows the systems in a tick: spawns, destroys and other structural changes, the events' handlers, and tasks
  • A system's time is from the start of its first piece of work to the end of its last. Systems that ran at the same time on several threads add up to more than Systems, which is what the clock says. tide schedule shows which systems wait for which, and why (see The schedule).
  • Outside a match, no tick runs, and the tick's column says so.
  • A view that didn't run, like one that reads the match while there's none, has no row.
  • When Ticks is most of a frame and many of them run again, clients are paying for prediction: see Input delay.

The stats are separate: a line in a corner once they're asked for, which a click or F8 opens to a few numbers and the three systems that took longest on average per measured run over the last half second.

A C host shows the profiler itself with tide/profiler.h (see C hosts).