ID:732222
 
This issue has been marked as a duplicate of id:154682
BYOND Version:493
Operating System:Windows 7 Pro 64-bit
Web Browser:Firefox 12.0
Applies to:Dream Seeker
Status: Duplicate

This issue has been marked as a duplicate of id:154682
Descriptive Problem Summary:
For a while now some objects in a second map all but disappeared from visibility.

Numbered Steps to Reproduce Problem:
  1. Load objects onto second map via screen_loc and add to a client's screen.
  2. Some, but not all of them mysteriously don't appear.


Code Snippet (if applicable) to Reproduce Problem:
// Please excuse the terrible code
client/proc
loadselfpokeimg(pokemon/P)
if (!battleimg)
battleimg = new
for (var/i = BSELFGAUGE; i <= BSELFEXP; i++)
if (battleimg.len < i)
battleimg.len = i
else
del battleimg[i]
battleimg[BSELFGAUGE] = battleobj('self.png', , 9, 1, 8, 5, 2)
battleimg[BSELFIMG] = \
battleobj(getbackanifile(P.shiny), P.bstateb, 1, 1, -32, 0, 2)
battleimg[BSELFHPBAR] = battleobj('hp.dmi', hpstate(P), 13, 2, 6, 6, 3)
if (P.gend == pFEMALE)
// Doesn't appear:
battleimg[BSELFGENDER] = battleobj('female.png', , 14, 2, 6, 15, 3)
else if (P.gend == pMALE)
// Doesn't appear:
battleimg[BSELFGENDER] = battleobj('male.png', , 14, 2, 6, 15, 3)
if (P.status)
battleimg[BSELFSTATUS] = battleobj(batstatus_img(P.status), , 10, 2, 14, 3, 3)
battleimg[BSELFNAME] = new/screentxt(src, P.name, 10, 2, 6, 12)
// Doesn't appear:
battleimg[BSELFLEVEL] = new/screentxt(src, num2text(P.level), 15, 2, 6, 15, 'text_nums.dmi', 8)

// Doesn't appear:
battleimg[BSELFMAXHP] = new/screentxt(src, num2text(P.stats[HP]), 15, 1, 6, 11, 'text_nums.dmi', 8)
var/hptext = num2text(P.statC[HP])
battleimg[BSELFHP] = new/screentxt(src, hptext, 14, 1, 14 - length(hptext) * 8, 11, 'text_nums.dmi', 8)

battleimg[BSELFEXP] = battleobj('exp.dmi', expstate(P), 11, 1, 6, 6, 3)

battleobj(icon/icon, state, xloc=1, yloc=1, px, py, layer=1)
var/atom/movable/object = new
object.icon = icon
object.icon_state = state
object.layer = layer
object.screen_loc = "battle:[xloc][px ? ":[px]" : ""],[yloc][py ? ":[py]" : ""]"
screen += object
return object

'screentxt' creates an obj, puts it on the screen and then adds overlays to itself.

Expected Results:
All of the objects added to the screen appear.

Actual Results:
A few of them don't appear.

Does the problem occur:
Every time? Or how often? Always.
In other games? I'm not sure.
In other user accounts? Yes.
On other computers? Yes.

When does the problem NOT occur?
Always does. See below.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? I tested with several old versions, and the last version that this did not happen in was 490.1105.
Some screenshots:
Here's the expected output as it occurs in version 490.1105 and previous versions: Expected output
Here's the actual output as it occurs in version 490.1106 and later: Actual output
(Pay attention to the white box on the lower-right of the map screen.)
I should note, it does not matter what version of Dream Maker/Daemon I compile or host with. Only the Dream Seeker version effects it.

Workarounds:
None known yet.

Thank you for your time.
I'll need a test case in order to look into this, especially since you did not post some relevant pieces of code (like the screentext datum or its constructor).

Two things I'm particularly interested in are 1) what are the screen_loc values and layers of the objects that don't appear, and 2) what are the screen_loc values and layers of the objects under them that do appear? If the speech bubble is on the same layer as the text for instance, that's a good place to look.
screentxt
var/tmp
atom/movable/object
xloc
yloc
px
py
client/player
proc/settext(txt, icon/icon = 'text.dmi', width = 6)
var/len = length(txt)
if (object)
del object
object = player.battleobj(, , xloc, yloc, px, py, 3)
object.overlays = new
var/image/image
for (var/i = 1; i <= len; i++)
image = image(icon, copytext(txt, i, i + 1))
image.pixel_x = (i - 1) * width
object.overlays += image
New(client/parent, txt, nxloc = 1, nyloc = 1, npx, npy, icon/icon = 'text.dmi', width = 6)
player = parent
xloc = nxloc
yloc = nyloc
px = npx
py = npy
settext(txt, icon, width)
Del()
del object
..()

The objects that don't and do appear on top of the white box all have layer 3. The white box is layer 2.
Some of the screentxt objects are appearing some aren't. I put comments in the original code snippet to point out which ones were'nt appearing.
The screen_loc values are all pretty much the same, though it's possible there's a mix of pixel offsets on one axis with another axis that has no offset. i.e. "battle:5:6,7" The second offset is left off to denote a zero.
I'm going to try forcing it to put a zero and see if that fixes it.
That is, I'm changing the one line to object.screen_loc = "battle:[xloc]:[px || 0],[yloc]:[py || 0]"
Nope, that wasn't it.
I noticed you're not setting the layer for your image overlays, though that may not be an issue. I'll still need a test case in order to look into this.
In response to Lummox JR
Lummox JR wrote:
I noticed you're not setting the layer for your image overlays, though that may not be an issue. I'll still need a test case in order to look into this.

I was running under the assumption that if you don't give them a layer, that instead of appearing over or under the object, they'll appear at the same position depth-wise.
But, this only applies to the numbers that aren't appearing. One of the other symbols isn't there too.
In response to Complex Robot
Complex Robot wrote:
I was running under the assumption that if you don't give them a layer, that instead of appearing over or under the object, they'll appear at the same position depth-wise.

That's only true if you assign them FLOAT_LAYER, or if the overlay is just an icon or icon_state. If the overlay is created via an object, it retains that object's layer. With images, the default is FLY_LAYER.

But, this only applies to the numbers that aren't appearing. One of the other symbols isn't there too.

Right, there's more going on here; I doubt FLY_LAYER (5) is going to cause problems if the highest layer is supposed to be 3.
I may be able to replicate the exact conditions in a test project.
Okay, I've been testing this, and I'm able to get it to work without the bug in a test project that only has the bare minimum for the stuff to be visible. So, the code I've posted is likely not relevant. Something more is happening.

EDIT: It might help to know what updates happened in 490.1106
Okay, so, I noticed changing the horizontal position of the object that wasn't appearing caused it to appear, if I changed its x-position low enough.
// I replaced this line:
battleimg[BSELFGENDER] = battleobj('female.png', , 14, 2, 6, 15, 3)
//with this:
battleimg[BSELFGENDER] = battleobj('female.png', , 13, 2, 15, 15, 3)


This caused it to be visible. Anything at the 14th tile or greater (on the x-axis) caused it to be invisible. And I noticed the three objects that aren't visible are the only ones past that position on the screen.

EDIT: I realized that my map size was set to 6, i.e. 13x13, which means stuff past 6 would be outside of that. Is it possible the second map is using the view of the main map for culling?
Okay, I found the cause of the bug.
The second map is using the view of the main map to cull objects.
Here is a sample project that reproduces the bug.
One of us will have to run your sample project to confirm, but this sounds like a duplicate of a bug that was already fixed in 494. Please retest in 494.
Okay. The bug seems fixed in 494.1133.
Lummox JR marked issue as a duplicate of id:154682