ID:2790156
 
Resolved
In situations where appearances were recycled frequently, their reuse could screw up animations and other situations that used them.
BYOND Version:514
Operating System:Windows 10 Home
Web Browser:Firefox 100.0
Applies to:Dream Seeker
Status: Resolved (514.1584)

This issue has been resolved.
Descriptive Problem Summary:
Animation of objects with images attached to clients has odd behavior for specific animations. Parallel animations that use a transformation matrix with a fractional Turn() or Transform() result in momentary reverting of the Image() back to the initial() state of the atom it is based on. Issue seems to be made worse by more of these images present at once.

Numbered Steps to Reproduce Problem:
http://files.byondhome.com/Azrun/animate_client_images.zip

Code Snippet (if applicable) to Reproduce Problem:
obj/arrow
dir=SOUTH
var/image/img

New()
dir=NORTH
img = image(src.icon, src, src.icon_state)
sleep(2)
for(var/client/C)
C.images.Add(img)
world << "\ref[img] added to client"
icon_state = null
alpha = 180
color = "#000"

obj/arrow/e
maptext = "E"
New()
..()
pixel_x = 16
pixel_y = 16
while(1)
var/matrix/M = matrix()

//M = M.Turn(rand())

M = M.Translate(rand(),rand())

animate(src, transform = M, time = 2, loop = 0, flags = ANIMATION_PARALLEL)
sleep(3)


Expected Results:
Client images to maintain direction, pixel_x, pixel_y, color, and alpha.

Actual Results:
Client images momentarily flash to previous state

Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:

Boy this is a weird one.

I can tell right off the bat the issue isn't related to the fact of the transforms being fractional but because of appearance churn. If you use rand(-4,4) then there isn't enough churn to cause a problem because there aren't enough permutations. Although garbage collection is called often on the client as a result of this churn, it doesn't seem to be the culprit either.

Extending the time of the animation also doesn't appear to fix anything. Once a few of the arrows show this problem, on subsequent changes all of them will show the problem, but only intermittently. The problem persists until the next animation, which is also weird.
Lummox JR resolved issue with message:
In situations where appearances were recycled frequently, their reuse could screw up animations and other situations that used them.