Runelite: XP Tracker briefly shows negative total XP/hr sometimes

Created on 20 Apr 2018  路  22Comments  路  Source: runelite/runelite

Each of the following screenshots shows the total xp/hr displayed as roughly MIN_INT for a signed 32-bit integer. I was able to reproduce them each the following ways, with the issue being present for one or two game cycles before it corrected itself. With no other skills being tracked (that is, after "Reset All" is chosen):

  • Check the health of a tree patch, then start chopping logs from that patch
  • Pick herbs from an herb patch, then clean those herbs
  • Teleport to Trollheim, then use the agility shortcuts to traverse down the mountain (not sure about this one; have not tested in isolation)

2018-04-20_00-25-00
2018-04-20_00-40-46
2018-04-20_00-41-38

bug

Most helpful comment

Cause: Divide by zero result = Max Integer.
Adding max integer to another integer results in negative integer due to signed integer behavior.

FISHING Time in seconds: 0
FISHING Value: 90
FISHING Result: 2147483647
...
FISHING Time in seconds: 1
FISHING Value: 90
FISHING Result: 324000

When I add FLETCHING Result: 2147483647 to FISHING Result: XXX, I get -214748XXXX

I'll write up a PR for this. I think I have a solution for it.

All 22 comments

Check if this is still present post #1367

I'll check with the coming release :+1:

1367 is now on master. I believe this fixes that issue as I also noticed it while redoing the internal data structure.

I'll try to do a farm run on master's code to check if I remember.

Not fixed. This is from current master branch code.
2018-05-01_22-37-29
Edit: Same thing happened after teleporting, cleaning herbs, and using agility shortcuts, so same bug as before.

I noticed that XpTrackerPlugin subscribes to both ExperienceChanged and GameTick events. Which order do they come in on a tick where XP is updated?

The client ticks every 20ms, it can change the xp during those ticks. The gametick event happens every 600ms so your answer is that it can happen in any order.

Still not solved?

Okay, got a couple questions:

  1. Are you world hopping?
  2. Are you switching between accounts?
  3. How much XP do your actions provide and to what skills?
  4. How much time happens between actions?
  1. No, this happens without world hops.
  2. No, this happens without logging out.
  3. Small amounts; I noticed this most frequently when first introducing a new skill to the list of tracked skills--like cleaning herbs after picking them, or climbing down an agility shortcut (which gives experience) after teleporting.
  4. Variable amounts--in the original post, the first screenshot happens significantly before the others (5-10 minutes before).

A simple way I was able to reproduce this was by doing the following:

  1. Clean a grimy herb of any kind (in this example, Guam leaf)
  2. Fletch a bow of any kind (in this example, magic longbow)
  3. Observe the bug (see screenshot)
  4. Reset fletching experience tracker and repeat 2 & 3

2018-05-02_11-13-24
2018-05-02_11-13-31

I was easily able to reproduce something similar using one of the steps @Nightfirecat mentioned (only thing my total exp not showing -max_int)
image

But i don't think this is a bug, since its somewhat accurate if i could repeatedly gain that exp in such short time. (few millisec)

Are you sure you're on the latest snapshot @Nightfirecat ?

The recent two screenshots were from last week's release, but I was seeing the same behavior last night when I did a farm run on master's code.

It going into the minus just means that the integer overflows the max value, so I'm not exactly sure if there actually is a bug here aside from it briefly displaying such a huge amount (because first time you gain exp is "instant" so the the calculation would use for example 3ms = 1 action)

I have reproduced it and saw it for a few seconds.

Cause: Divide by zero result = Max Integer.
Adding max integer to another integer results in negative integer due to signed integer behavior.

FISHING Time in seconds: 0
FISHING Value: 90
FISHING Result: 2147483647
...
FISHING Time in seconds: 1
FISHING Value: 90
FISHING Result: 324000

When I add FLETCHING Result: 2147483647 to FISHING Result: XXX, I get -214748XXXX

I'll write up a PR for this. I think I have a solution for it.

Yeah thats exactly what I was saying. Maybe we could assume time always being 0.5 seconds at the least, which seems reasonable.

@Kamielvf I tried low second values and it was still crazy. It worked well with 60 seconds in my testing.

Makes sense, you could get an xp drop each tick which is why I suggested 0.5 seconds but if that happens your Xp tracker will update accordingly anyway.

@Nightfirecat @Kamielvf
Wanna try on master to confirm?

Will do later today.

Yup, problem solved. :+1:

Unfortunately, it looks like this isn't fixed after all--just saw it again today... :confused:

2018-05-04_19-10-04
2018-05-04_19-10-10

Video of a simpler repro case: https://www.youtube.com/watch?v=afAqr3EATvs (wind striking, meleeing, pickpocketing NPCs and burying bones in Lumbridge)

https://github.com/runelite/runelite/pull/1419 fixed in here, in case you want to wait.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Tehterokkar picture Tehterokkar  路  28Comments

tyboyd picture tyboyd  路  20Comments

tylerjameshurst picture tylerjameshurst  路  31Comments

MagicfTail picture MagicfTail  路  19Comments

DoctaDread picture DoctaDread  路  29Comments