ID:114358
 
Resolved
Calling flick() on an atom that is deleted before ever being seen by the client could sometimes cause new atoms to display the flick instead.
BYOND Version:485
Operating System:Windows XP Pro
Web Browser:Opera 9.80
Applies to:Dream Daemon
Status: Resolved (488)

This issue has been resolved.
Descriptive Problem Summary:
I've noticed that objects will occasionally be drawn with the wrong icon. In this image the pickax icon is incorrectly being drawn to represent an object.

The object is of type /obj/water. The icon var of that type is set to 'water.dmi' and is never changed at runtime. water.dmi doesn't have an icon state that's the pickax icon. I'm sure its icon_state is never changed at runtime because:

* the water object only exists for 5 ticks, then is deleted (its loc is set to null)
* it's created and no reference to it is kept
* there's no code that sets an object's icon_state to be the pickax
* there's no unnamed state that's the pickax icon (so it's not the case that the object's icon is being changed and the pickax image is defaulted to because its icon_state doesn't exist in the new icon)

I've also seen this happen in some other projects.

My best guess is that objects are being recycled and their properties are somehow not being updated. Maybe the internal bits that handle this are designed to do things 10 times per second and because of the increased framerate (I've only ever seen this happen in games that use lower-than-default values for world.tick_lag) there's a chance for a glitch to happen when objects get recycled. Or it could just be a problem on the client end. The client retains information even after an object ID has been recycled, so it's applying old information to a new object because the new object has an ID that was previously used.

The reason I suspect this is the case is because the pickax and water icons are used by objects that exist only as visual effects. They only exist for 5-10 ticks, then are deleted (their loc is set to null) so the game will accumulate a lot of these deleted objects. There are other objects used like this, but the pick ax and water objects are the most common, so if the glitch is rare, odds are it would occur this way.

Numbered Steps to Reproduce Problem:
I have no idea how to reproduce this.

Code Snippet (if applicable) to Reproduce Problem:


Expected Results:

Actual Results:

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.)
I first saw this problem a while ago. I forget exactly when, but a few months at least.

Workarounds:

This seems to me a duplicate of the image resource problem you brought up earlier, it's likely icons are drawing themselves wrong due to a messed up cache file that's not keeping itself straight so when it goes to fetch the icon the wrong one is gotten.

if you use browse_rsc() in the current state this may make the issue more prominent especially if using the fix you found of using it twice.

EDIT:This may not be the issue but w/e I didn't read it all before replying due to the nature of the problem but if it has been going on a few months maybe there is another problem here, but it seems to me there should be no good reason this should ever happen.

If it was the first problem though it seems to me that due to increased tick lag its just easier to see the problem that always happens in every game because more data is sent all the time to update the client due to the increased tick lag.
When I was working on a fire system for Hazordhu a long time ago, there were tons of fire and smoke images on the screen at the same time. Strangely enough, someone far away from the fire reported that their item was a different icon.

I know it's not very specific or detailed, but it could help. Bottom line is, there was a lot of images being displayed at a time.
Were the objects being deleted too? Or were there just a lot on the screen?

A Miner Adventure has both things, I suppose. Every turf has an overlay for lighting and for water (though the water overlay usually isn't used).
I've had this happen a few times before as well. The most common occurrences I've had players tell me about is when they have a grid that contains objects open and a new object is created on the field. Usually it was the effect created when the player attacked. One or more of the icons for the objects in the open grid would be redrawn with the incorrect icon.
I've been trying every which way I could to reproduce this, but so far no luck. I had an old demo from back when we used to have this kind of issue a lot more often, before I introduced a new concept that basically eliminated the object reuse problem. Back then it was easy to trigger the issue.

Now I'm not seeing a problem at all with multiple variations of that same demo, even if I host remotely and with tick_lag turned way down.

One thing I'm curious about: Where else does that pickax icon get used? Did you have another object with that image being deleted a while (or a short time) before the water object showed it incorrectly? Is that icon used on the map or in a HUD, or both?

Also, does this show up in local tests or only when you join a remote server?
Where else does that pickax icon get used? Did you have another object with that image being deleted a while (or a short time) before the water object showed it incorrectly? Is that icon used on the map or in a HUD, or both?

The pick ax icon is used whenever a player digs. The water objects are used to show water flowing from one tile to another. Both of these effects happen frequently. I'm not sure that the timing (pick ax being deleted right before the water icon showed incorrectly) happened that way, but its certainly possible.

There is no HUD so the icons only appear on the map.

Also, does this show up in local tests or only when you join a remote server?

I'm pretty sure I've only seen this when I've connected to a remote server, but that may just be because when I run it locally I don't dig enough to create enough pick ax objects. When I've experienced it remotely, I'm not sure if the host experienced it too.

I'm not sure if this matters, but the pick ax icon state is being flicked.
The flick is likely to be highly relevant. I'll take that into account in further tests.
5 years later this bug started to happen in my game, out of nowhere...
Like these: http://i.imgur.com/pryJpFT.png
(those rp bubbles at the hotbar)
and these: http://prntscr.com/9ms9sz (that skeleton out of nowhere)

And wellp, I tried replacing the .rsc files and updating byond version and even asked players to clear cache, it didn't fix.
However some players was fixed after constantly reloging .-.
wich is really weird...
And ah, after a reboot some players appears without their base icon; I had to manually edit their icon back (even while in its savefiles said "basemale.dmi" I had to re-upload the icon to fix o.o
the other cases shows only at the said client screen
test for yourself at the Roleplay server: http://www.byond.com/games/Inutaishos/Azusa
In response to Inutaishos
This needs to be a new bug report, not tacked onto one that was closed years ago. Also, are the RP bubbles made to appear via flick(), like in this issue? Is the skeleton something that was flicked? If not, then this is a completely different issue altogether.

You should post a new report, and if you have a copy of the savefiles that got broken that would actually be very helpful toward investigating. A broken savefile indicates the issue is on the server side, not mostly the client like the last one was.