ID:2379470
 
Resolved
Visual contents on turfs sometimes got mixed up when the map position changed.
BYOND Version:512.1430
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Firefox 60.0
Applies to:Dream Seeker
Status: Resolved (512.1432)

This issue has been resolved.
Numbered Steps to Reproduce Problem:

1. Move the mob at a steady, rapid pace in some direction
2. Suddenly reverse the direction of the mob's movement
3. vis_contents which were previously out of view are now appearing on the wrong turfs

In SS13, ghosts and AI cameras can move at a speed sufficient to trigger the bug.

Code Snippet (if applicable) to Reproduce Problem:

The following code snippet has been placed in an example project: https://wombat.platymuus.com/dl/minimal.zip

In SS13, the same object is added to the vis_contents of many turfs; in this test project, many objects are used, in order to assign maptext to make understanding the problem easier.

The turfs are divided into 4x4 groups and a checkerboard pattern is applied, with half of the groups having vis_contents and the other half not.

1. On connect, the mob will begin gliding to the right.
2. Wait a bit and use the "Go Back" verb.
3. The bug should immediately manifest; repeatedly wait and use "Go Back" to make things worse.
4. Use "Toggle Gliding" to pause gliding and examine the maptext.
5. Use "Up And Down" to teleport many screen sizes away, wait a second, and teleport back. The bugged vis_contents do not disappear.

While building this repro case, what appears to be a server hang was also discovered; it has not been witnessed in live games and may have something to do with maptext.

/atom/movable/glide_size = 8
/atom/icon = 'icons.dmi'
/turf/icon_state = "simple"
/mob/icon_state = "guy"
/obj/icon_state = "green"

/world
maxx = 255
maxy = 255
maxz = 1
view = 7

/world/New()
..()

for(var/turf/T in world)
if ((T.x & 4) ^ (T.y & 4))
var/obj/overlay = new
overlay.maptext = "x=[T.x] y=[T.y]"
T.vis_contents += overlay

/client/var/gliding = 1

/client/New()
..()
mob.loc = locate(10, 10, 1)
spawn glide()

/client/proc/glide()
while(gliding)
sleep(1)
mob.loc = locate(mob.x + 1, mob.y, mob.z)

/client/verb/Toggle_Gliding()
gliding = !gliding
if (gliding)
spawn glide()

/client/verb/Go_Back()
var/turf/T = locate(mob.x - 20, mob.y, mob.z)
if (T)
mob.loc = T

/client/verb/Up_And_Down()
var/turf/T0 = mob.loc
var/turf/T1 = locate(mob.x, mob.y + 50, mob.z)
if (T1)
mob.loc = T1
spawn(10) mob.loc = T0


Expected Results:

Visual contents should only appear on the turfs they've been added to the vis_contents of.

Actual Results:

Phantom visual contents appear on turfs where they should not be.

Does the problem occur:
Every time? Or how often? Seemingly at random.
In other games? Yes, in minimal project.
In other user accounts? Yes, received player reports.
On other computers? Yes, received player reports.

When does the problem NOT occur?

When the camera is moved smoothly or slowly (unsure what is the threshold for this), or moved to a completely disjoint location and not immediately returned.

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.)

As far as I know it's been a bug since vis_contents was introduced. I've only just pinned it down reliably.

Workarounds:

Reconnecting will clear the bugged visual contents.

Well, this should be fun to investigate. On a very related note, the turf image hang reared its ugly head again.
Lummox JR resolved issue with message:
Visual contents on turfs sometimes got mixed up when the map position changed.