# Prediction: tick property

> The tick read-only property of the Prediction interface is the room tick of the last input, the local player's own timeline.

The **`tick`** read-only property of the [`Prediction`](/docs/client/prediction) interface is the room tick of the last input, which [`entity`](/docs/client/prediction/entity) has been stepped through: the local player's own timeline.

## Value

A number. It's 0 before the first input, and again from a reconnect until the first input after it, including the reconnect after the room moves, restarts or wakes.

## Description

With `sample`, `tick` advances every room tick, in a room that sends no state updates too. It runs about 2 ticks plus half the round trip ahead of [`RoomClient.serverTick()`](/docs/client/room-client/servertick), since inputs are sent ahead of the room's clock so that they arrive in time.

A rule the stepper times by its `tick` parameter, such as a fuse, runs for the predicted player at `prediction.tick`. Draw such a timer against it, so the player sees it end on the tick their own moves are stepped at. Don't use `room.tick` plus [`pending`](/docs/client/prediction/pending) for it: `room.tick` stops in a room where nothing changes.

## Examples

### Showing a bomb's fuse

A bomb explodes at a tick the stepper checks, so its countdown is drawn on the player's timeline, falling back to the room's clock while `tick` is 0.

```ts
// fuse.ts
import { connect, defineSchema, defineStepper, entity } from "@irtio/client";

const Sapper = entity("sapper", { owner: "string", x: "f32", explodeAt: "u32" });
const schema = defineSchema({ entities: [Sapper] });
const stepper = defineStepper<{ walk: number }>({
  step(world, inputs, dt) {
    for (const s of world.all(Sapper)) s.x += (inputs.get(s.owner)?.walk ?? 0) * 3 * dt;
  },
});

const room = await connect("minefield", { schema });
const me = room.predict(stepper, {
  find: (r) => [...r.entities.all(Sapper)].find((s) => s.owner === r.player),
  sample: () => ({ walk: 1 }),
});

function fuseSeconds(): number | undefined {
  if (!me.entity) return undefined;
  const now = me.tick || Math.floor(room.serverTick());
  return (me.entity.explodeAt - now) / room.tickRate;
}
```

## See also

- [`Prediction.pending`](/docs/client/prediction/pending)
- [`RoomClient.serverTick()`](/docs/client/room-client/servertick)
- [Timers on the player's timeline](/docs/client/guides/prediction#timers-on-the-players-timeline)
