ID:139995
 
Code:
proc/make_dark_mark(mob/M,objtype,cx,cy,cz,xsize,ysize)

set background = 1

var/obj/Z
var/xl = 0
var/yl = 0

while(1)
Z = new objtype(locate(cx+xl,cy+yl,cz))
Z.icon_state = "[xl],[yl]"
Z.pixel_x = 6 // THIS CAUSES THE PROBLEM

yl+=1

if(yl>ysize-1)
yl = 0
xl += 1

M.ObjGrid += Z

if(xl<xsize) continue

break


Problem description:

The above proc works perfectly fine, but to control the exact position of the final image (and align it as i wanted) i added a pixel_y / pixel_x arguments. This is when some funky visual artifact showed up.

Its not an out of place object or something. It's a series of lines that follows you around over the object, and makes parts of it vanish.... and im wondering if this is an error with my code (and if it is im confused as to what exactly i did wrong....) or a bug with BYOND itself.

I have made a video to demonstrate this properly, as its hard to explain fully. BYOND issue or somethign im doing wrong?

http://www.youtube.com/watch?v=qkiGsWe0S3k
Wow, your code and your video simultaneously failed.
In response to Zecronious
Um?

EDIT: Anyway don't want to post this in the Bug Reports if its my fault. So just wanted a second opinion.
The little line artifacts you're seeing are 6 pixels wide. That's no coincidence.

Visually, it looks like the lines are based on the turfs below the objects. This suggests a layering problem. You did not list what you're using for objtype, so this code is incomplete, but I would suggest a likely explanation is that your objtype is on the exact same layer as other turfs or objs on the map. Broken up into individual tiles, this is presenting a challenge to the layering engine that it can't solve in a consistent way.

Give your objects a higher layer and see if the problem disappears. If not, I'd need to see more of the code in question to tell what was wrong.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
The little line artifacts you're seeing are 6 pixels wide. That's no coincidence.

Visually, it looks like the lines are based on the turfs below the objects. This suggests a layering problem. You did not list what you're using for objtype, so this code is incomplete, but I would suggest a likely explanation is that your objtype is on the exact same layer as other turfs or objs on the map. Broken up into individual tiles, this is presenting a challenge to the layering engine that it can't solve in a consistent way.

Give your objects a higher layer and see if the problem disappears. If not, I'd need to see more of the code in question to tell what was wrong.

Lummox JR

I did not think of the layer's being the issue, since it worked fine until i introduce that 'nudge'.

obj/ebi/geoglyph

layer = MOB_LAYER -2

spider
name = "Spider Geoglyph"
icon = 'spider.dmi'


I set it to -1 and it went away :/ ... now I feel dumb for not doing something so obvious in the first place lol. Oh well, live and learn.

Strange since im pretty sure the MOB_LAYER is 4, which would make the OBJ layer 2. The Turf layer (for the floor) is 1.... so i dont see why it would cause any layering issues. I doubled checked the vars in game and the image was indeed Layer 2 and the Turfs below it 1...
In response to EternalDuelistSoul
TURF_LAYER is 2; OBJ_LAYER is 3. AREA_LAYER is 1.

MOB_LAYER - 2 was TURF_LAYER, hence the layering issue. If you want the mark to appear below objs though, I would suggest either setting objs and mobs to higher layers by default, or setting the mark to a layer of OBJ_LAYER - 0.5 or something. I would make sure actually that layer isn't used by anything else, for consistency.

In SotS II, I set up a special file with const vars for the different layers I would use. Regular space turfs are still on the default TURF_LAYER (2), but this is how the others look:

var/const/BLOOD_LAYER=3
var/const/LADDER_LAYER=4
var/const/BONE_LAYER=5
var/const/MOBJ_LAYER=6
var/const/MMOB_LAYER=9
var/const/CLOUD_LAYER=11
var/const/WALL_LAYER=7
var/const/ZONE_LAYER=8
var/const/OVER_LAYER=15
var/const/CUSTOMIZE_LAYER=50


Then when I'm defining the different things, I just apply the layer const I want. I set the defaults here:

obj/layer=MOBJ_LAYER
mob/layer=MMOB_LAYER


If you're going to have a lot of objects on potentially different layers, this is a very good idea. If this is only for a few cases, you can at least set up custom layers like so:

var/const/MARK_LAYER = TURF_LAYER + 0.2


Keep in mind you may see two overlapping marks conflict, so you might want to add a small number to the layer so it has some consistency. Layer differences over 0.001 are usually safe, but below that you run into a chance of interfering with "microlayers" used when objects move from place to place on the map. Still, if you know you'll never have more than 100 marks at a time, you can add 0.01 for the first, 0.02 for the second, etc., and just reuse any values for marks that get removed.

Lummox JR
In response to Lummox JR
Yeah thats a good idea, I was attempting to do something like this before as i really need to sort out layers for other reasons too.