As an experiment, I made a real-time-based idle / clicker game in Twine (Harlowe)

I am always trying to test the limits of what is possible in Harlowe, so I gave myself the challenge to create a simple, real-time-based idle / clicker game (like Cookie Clicker) using Twine and little to no extra JavaScript.

Personally, I find Twine lends itself perfectly to incremental games as long as they’re turn-based, but for an idle game based on real-time-progression with a global clock, Twine in general and Harlowe in particular probably won’t be the first tool that comes to mind.

As an experiment and proof of concept I’ve just released “Idle Judgment Day” for Halloween, a very simple and short idle game with real-time progression, created in Harlowe (with the only extra JavaScript being the Harlowe Audio Library). As a parody of idle games, the big numbers go down, instead of up. Anyway, here it is and I’m very excited to share the results of my experiment with you:

I am not claiming this is the best way to make it work, but it definitely is a way. I’m sure someone will say “that would’ve been easy / easier in SugarCube”, which probably is true, but a) I don’t really know my way around SugarCube, and b) the challenge was to make it in Harlowe, and the possibilities Harlowe has never cease to amaze me.

0.9.0

  • functional on all devices and browsers, except iOS Safari
  • 15 levels and 20+ automation & one-time upgrades
  • real-time-based progression (global clock)
  • Multiple timed events
  • save functionality (browser local storage)
  • on desktop: Plays idle in background if browser tab is open (including in separate browser window if it’s the open tab)
  • audio FX and music (both mutable, thanks to @Chapel 's Audio Library)

Obviously, there are some limitations, some inherent to Twine, like: Offline progress doesn’t work (which makes it impractical for mobile). There is some input lag due to the refresh rate.

In terms of bugs: For a reason I haven’t been able to figure out yet it doesn’t work in Safari in iOS (the Twine debugger doesn’t return an error, and I couldn’t find it manually, and it works just fine in MacOS Safari).

Some background on development:

The biggest challenge was the global clock. Not even counting seconds, minutes and hours, that was the easy part – but getting it to count days + 1 after 24 hours proved to be a bit of hassle. I will be sharing my code for the global clock in a separate post for better searchability, but here’s sneak peek of what I did to get the day counter work based how many hours, minutes and seconds had passed:

<!-- I defined the "sum of time" which is quite literally the sum of 23 hours, 59 minutes and 59 seconds = 141 -->

(set: $sumoftime to ($hours + $minutes + $seconds))

<!-- Somewhere inside the code I check whether the sum of time is 141 -->

(if: $sumoftime is 141)[(set: $hours to 0)(set: $minutes to 0)(set: $seconds to 0)(set: $days to it +1)

This actually works, and with this method I was able to get a global clock that not only counts hours, minutes, seconds but also days.

It just turned out that I don’t really need the Day counter for this project due to the length of playtime (around 5 to 6 hours), but I was still happy to make it work, and as mentioned, I’ll be sharing the full code for the global clock and how to implement it in a separate post, as I’ve seen a recurring demand for a global clock.

7 Likes

I love this idea, and have implemented it before (though in AXMA which works similarly to Twine and had real-timers built in, alas!) - In Cursèd Pickle of Shireton, combat is a click game where you have a limited amount of time to charge up your attacks - do you want to take time to click all the parts of the spell you want to cast, or should you spend some of that time clicking to power up your defense first in case you fudge the spell?

It provides a sense of grind for things like picking a lock - how badly do you want to click this link? and works great if there’s a random chance of failure, such as someone walking in on you obsessively clicking the “pick lock” link before it succeeds.

6 Likes

Thanks! And what a great idea to implement that in a battle context, I like that.

3 Likes

Thanks, that was interesting. I know it’s just an experiment, but some of the upgrades seem rather useless, and they slow down your exponential progression to a crawl. (Unless I misunderstand them.) The evangelist is extremely underpowered. I think all the ‘fixed amount of one time cleansing’ makes almost no difference. And the 5s boost also seemed to make little difference.

Thanks for the feedback. For context: This was primarily a technical proof of concept, I added everything else pretty late and quickly to have something ready for Halloween, so it isn’t entirely fleshed out. But I will be trying to improve some things over the next weeks. If you have the time your feedback is appreciated: Which updates felt like bringing it to a halt in your opinion? I am happy to take a look at them. In regards to the one-time-upgrades: That was kind of the point to be honest. They were intended to contrast with the other upgrades in that regard.

3 Likes