PIXELFALLS
  • Docs
  • Hardware
  • News
  • Roadmap
  • Pricing
  • Schools
SchoolsHardwareTerms of ServicePrivacy Policy

© 2026 PIXELFALLS

Documentation

System

Runtime clocks, logical screen size, and engine performance readouts.

APIs

APIReturnsNotes
time() / t()secondsWall clock since cart boot; keeps advancing while the pause menu is open
gameTime()secondsSimulation time; advances only when update() runs (pauses with the menu)
fps()intEngine-reported frames per second
screenWidth()intLogical framebuffer width in pixels
screenHeight()intLogical framebuffer height in pixels

Wall clock vs simulation time

APIPauses on menu?Typical use
time() / t()NoAnimations (sin(time())), ambient motion
gameTime()YesCountdowns, cooldowns, spawners tied to gameplay

Both clocks reset on cart reload or Restart from the pause menu. Values are rounded to millisecond precision.

For gameplay logic that must stay on the fixed timestep, you can still use update(dt) — gameTime() advances by the same dt steps when update() runs.

Examples

-- Ambient wave (keeps moving while pause menu is open)
local wave = math.sin(time() * 2)

-- 10-second countdown that pauses with the menu
local remaining = math.max(0, math.ceil(10 - gameTime()))
drawText(remaining, 58, 58, 7, 2)

-- HUD: size and FPS
drawText(screenWidth() .. "x" .. screenHeight(), 0, 0, 6, 1)
drawText("FPS " .. fps(), 0, 8, 6, 1)
Functions

time

Return seconds since the cart booted (PICO-8 compatible). Uses wall-clock time and keeps advancing while the pause menu is open. Resets on cart reload or restart. Returned values are rounded to millisecond precision.

  • time() -> number

Returns

  • number

Examples

-- Seconds since the cart started, even while the pause menu is open.
local seconds = time()

t

Alias of `time()`.

  • t() -> number

Returns

  • number

Examples

-- The same clock as time().
local seconds = t()

gameTime

Return seconds of simulation time since the cart booted. Advances only when the main `update()` runs (fixed `dt` steps), so it pauses while the engine pause menu is open. Resets on cart reload or restart. Returned values are rounded to millisecond precision.

  • gameTime() -> number

Returns

  • number

Examples

-- Seconds the game has actually been running. This pauses with the pause menu.
local seconds = gameTime()

fps

Get the engine-reported frames-per-second value.

  • fps() -> int

Returns

  • int

Examples

-- The frames per second the engine is reporting.
local frames = fps()

screenWidth

Return the logical framebuffer width in pixels for the current cart resolution preset (e.g. 128 Classic, 160 Game Boy, 256 Demake/SNES, 320 Mega Drive).

  • screenWidth() -> int

Returns

  • int

Examples

-- Width of the game screen in pixels, such as 128.
local width = screenWidth()

screenHeight

Return the logical framebuffer height in pixels for the current cart resolution preset (e.g. 128 Classic, 144 Game Boy/Demake, 224 SNES/Mega Drive).

  • screenHeight() -> int

Returns

  • int

Examples

-- Height of the game screen in pixels, such as 128.
local height = screenHeight()