ID:2081757
 
(See the best response by Lummox JR.)
Code:
            big_tree //http://www.woodweb.com/cgi-bin/calculators/calc.pl
icon = 'Tree.dmi'
icon_state = "base"
density = 1
layer = OBJ_LAYER
New(_x,_y,_z)
weight = rand(500,1200)
src.overlays += new/obj/item/organic/big_tree_top
src.loc = locate(_x,_y,_z)

big_tree_top
icon = 'tree_top.dmi'
icon_state = "base_right"
density = 0
pixel_y = 32
pixel_x = -64
layer = MOB_LAYER+1
New()
src.pixel_y = 32
src.pixel_x = -64


Problem description:



When I move around on the map the overlays seem to flicker... I'm not sure if i'm using the correct layer? how do I keep the overlays on the objs from popping in and out so that it's a static view?

Thanks!
Try putting them on different planes. Put the ones overlapping on a higher level. Should fix your problem.
I'm generating them on the fly on world creation when the turfs are made, so that I can have a randomly generated world every time... so I dont think I can do that... unless I set the overlay layer to be MOB_LAYER+1000-src.y ??
I would change up your creation setup into a process and make it create the tree tops by plane, from bottom to top. What I mean is, first create trees on a lower plane, giving them a modest spacing. When they're done, create more trees on a higher plane, shortening the spacing, repeat until satisfied.
Sorry for the dumb question, but do you mean plane as layer?
In response to Mitchy
No. I mean the game-changing variable introduced in 510.
Best response
The problem is, you're asking the engine to layer overlapping objects or overlays consistently when they're on the same layer, not only up and down--which SIDE_MAP is generally capable of--but left to right.

With the exception of the fact that its sort is topographical and therefore not perfect, SIDE_MAP should generally handle this pretty well, at least vertically. Horizontally, you may still have issues.

I think your easiest solution for the time being is TOPDOWN_MAP--which chances are you're already using--with some thought given to layering the trees differently from one another. The engine has a built-in concept called micro-layering, which would probably be enough to help you normally, except the micro-layer is so small that it can start to get drowned out by high regular layers. (IMO, it needs some revamping to account for floating point limitations.) You could however adopt a similar system yourself, where the layer is augmented by x*tiny_multiple and y*tiny_multiple, x's multiplier being slightly tinier.
In response to GreatPirateEra
GreatPirateEra wrote:
No. I mean the game-changing variable introduced in 510.

The plane var was introduced in 509. But it's really not appropriate to this situation.
In response to Lummox JR
Oops. But I thought planes were capable of handling this?
In response to GreatPirateEra
Planes can be used as a layering tool, but using them in this particular way makes no sense. Planes are meant more for separating out conceptually different elements, like effects, lighting, etc. All of those trees are conceptually on the same plane as the other map elements, and most importantly each other. Planes are also technically a limited resource.

All that's really needed here is for the trees to be on slightly different layers from one another, which solves the problem. Basing that on their map position is a pretty good solution.
Got it! Thanks for the idea of Microlayering!

            big_tree_top
icon = 'tree_top.dmi'
icon_state = "base_right"
density = 0
pixel_y = 32
pixel_x = -64

New(_x,_y,_z)
src.pixel_y = 32
src.pixel_x = -64
src.layer = MOB_LAYER+(10000-_y)+(src.x*0.15)


http://imgur.com/9umT8yp
Bear in mind, if you can you're better off doing all that in a single proc rather than in New(). Otherwise your startups will take longer.