Heartbeat and tick prediction

Since version 0.6.14, GgrTF provides an experimental feature for predicting heartbeat duration and ticks. This can be useful if you wish to time your regen breaks nicely, or when to enter combat again (heartbeat factors in with the so-called initial battle round, or so called "zero round").

The usage of this feature is simple: There is one new field displayed on the statusline, the value labeled as "T" shows number of heartbeats from last tick, next tick usually occurs at 9 or 10. It should always be 10, but due to how we "force" simulated HBs and interaction with fast metabolism, they will not always match the real ones. First tick after leaving battle will not usually be predicted correctly, but the situation should normalize after it.

Note

You can also utilize a stethoscope, and it should, at least theoretically make the HB and tick prediction accurate, but who knows... fastmeta is a bitch.

Stethoscope is an item, available from Arelium's tinkerer's toolshop. You can use it by applying, 'apply stethoscope to ggr'. Easiest way is to add that to your eqset swapping commands.

Technical details

One might ask, how does this all work? This is where it gets a little bit murky, because we are largely working on assumptions on how things like heartbeat work in BatMUD. So it might not be correct, there may be things that have been overlooked, etc.

First of all, here are some things that the predictor code assumes:

  • Heartbeat duration (delta) is 3.0 seconds to start with, we adjust slowly towards the player's "real" average heartbeat frequency.

  • One tick is always 10 heartbeats.

  • Battle rounds are always around ~3s, not withstanding +/- lag and slight variation due to driver issues.

  • Spell rounds, cast and skill finishes occur on heartbeat. Thus we can use these to time heartbeats, when filtering out fastmeta.

Basically what we do in the code is as follows:

  1. Start a TF timer that runs gheartbeat_timer() at ~20Hz.

  2. In gheartbeat_sc (ran on each 'sc') we check if we seem to have ticked by checking sp/ep deltas against threshold values. We also try to discard 'sc' events caused by things that may not be heartbeats (fires, crystals, heal alls, etc.)

  3. In gheartbeat_timer() we check for:

    • Ongoing battle, check when last round went off, disable battle if it was "too long" ago.

    • Check when last hb was, simulate / force a hb if it was too long ago.

    • Check if we need to "force" a tick, and do that.

Based on these, we keep a running average of heartbeat duration to predict incoming heartbeats and ticks. The average starts at 3s, which is the basic BatMUD heartbeat without fast metabolism or such.

Note

If you are interested in some debug-spam produced by the predictor, you can enable it via /set hb_debug=1