---
title: "Discussion on \"Idle Is Not a Timer.\" | Hashnode"
description: "Discussion on \"Idle Is Not a Timer.\". Let Your Rust Game Progress While You Are Away"
url: "https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Idle Is Not a Timer.](https://journeytocode.hashnode.dev/idle-is-not-a-timer?utm_source=hashnode&utm_medium=feed)

Let Your Rust Game Progress While You Are Away

Oct 23 · 22 min read · journeytocode.hashnode.dev  
Read the article

-   [#rust](https://hashnode.com/tag/rust)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#webassembly](https://hashnode.com/tag/webassembly)
-   [#idle-game](https://hashnode.com/tag/idle-game)
-   [#game-development](https://hashnode.com/tag/game-development)

## Written by

[Mikey Nichols](https://hashnode.com/@mNix)

@mNix · West Virginia

  
[View profile](https://hashnode.com/@mNix)

Web Developer

Web developer building full-stack applications with JavaScript, React, Node.js, and modern web APIs.

## Responses 8

Markdown supported · ⌘↵ to post

[Indie Ship Log](https://hashnode.com/@indieshiplog)

[Oct 25](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6addb08303f6b5700ad9ce22)

Treating time as just a number is the move. I kept a little side project stuck on real timers for tests and it was painful. Being able to call tick(3600) and also check that one long tick matches a bunch of short ones is the kind of boundary that keeps the rules honest when you add more later.

[Mikey Nichols](https://hashnode.com/@mNix)

[Oct 25](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6addb08303f6b5700ad9ce22#reply-6adde2a15089f809a540d067)

Thanks for commenting! I’m happy that it resonated =) I think having that short-tick vs long-tick test is going to save me later too.

[Mahdi Jabinpour](https://hashnode.com/@mahdi-lumowp)

[Oct 24](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6add124e838a42a2d61b85be)

Pulling resolve\_hit into one shared transition is the most useful refactor in this step. I would add a mixed-input test where a click leaves an enemy one idle hit from defeat, then tick advances into the next stage. That checks the boundary between the two input paths and helps catch double rewards or a missed transition when the rules grow.

[Mikey Nichols](https://hashnode.com/@mNix)

[Oct 24](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6add124e838a42a2d61b85be#reply-6add3eb4ab6b68458e938229)

That’s a really good test case. It hits the exact boundary `resolve_hit()` is supposed to unify, instead of testing clicks and ticks separately.

A click leaving the slime at 1 HP, then a one-second tick finishing it, would be a nice guard against missed transitions or double rewards as this grows. I’m probably adding that one.

[YouBeyond](https://hashnode.com/@youbeyondai)

[Oct 24](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6adc5a23a6d3c5bbf618f122)

The long-tick equivalence test becomes especially interesting when you add the away-time cap you mention. If the cap is applied independently inside every tick call, tick(7200) could award less than two tick(3600) calls for the same absence. Would you model one away session separately, apply its credit limit once, then pass the credited seconds into the deterministic simulation? That would preserve the chunking test while giving the cap its own tests. AI-assisted comment.

[Mikey Nichols](https://hashnode.com/@mNix)

[Oct 24](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6adc5a23a6d3c5bbf618f122#reply-6adc90dbe793b4d3c46079c5)

Yeah, I think that’s the cleaner way to handle it. Keep `tick()` deterministic, apply the away-time cap once per session, then pass the credited seconds into the simulation.

That also keeps the cap and the simulation easy to test separately. Good catch.

[Abhinav Sharma](https://hashnode.com/@abhinavs1920)

[Oct 23](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6adbcb85b7a32220bb790348)

Time as a plain tick count is what makes the whole design testable - an hour away becomes game.tick(3600) and the suite never waits on a clock. It is the same reason engines separate the simulation step from render frames: determinism in the core, wall time only at the edges.

[Mikey Nichols](https://hashnode.com/@mNix)

[Oct 24](https://hashnode.com/posts/idle-is-not-a-timer/6adb8a81c414037f963495f9/comment/6adbcb85b7a32220bb790348#reply-6adc4945b78c78953a30b7c0)

Exactly! That separation ended up being one of my favorite parts of this step.

I started from the much smaller problem of “how do I test an hour away without waiting an hour?” and `game.tick(3600)` fell out of that. But it also creates that nice boundary you described: whatever is running the game can measure wall time, while the Rust side only has to care about what that amount of elapsed time means for the game state.

I like the comparison to separating simulation from render frames too. That is pretty much where this series is heading next — pulling the game rules away from the environment that happens to be running them.
