Re: [nbos] [FM] Layer control (Part 1 of 2)Christopher Rodrigues Macias Tue Mar 20th, 2007
> I believe that one is gone. I've been looking for it for the
scripting for said layer pattern. When I found it he had a post
saying he was
> shutting it down due to lack of interest. Unfortunately I lost
where I stored the code, and when I went to look again, it wasn't there.
Yes, the fan site referred to was pulled down a few months back, so
you can't access the material there.
I'm the author of the article on layering and the associated script.
I'd thought I'd lost the article text when the fan site owner took
everything down, but Don Ziegler, who began this particular thread I
believe, sent me his copy. (Thanks, Don!) Don suggested I post the
article to the NOX downloads section, and if I can ever locate my
'access code' for the site, I'll do just that.
However, for the sake of anyone who is interested, I'm posting the
text of the article at the end of this email. It's too long for the
40K message limit, so I've split it into two parts. Part 2 will
follow in a moment. Feedback on the article and script is most
welcome. However, if you have a comment or question that isn't likely
to be of general interest to the community, feel free to send it
directly to my email rather than to the nbos list.
P.S. If you're curious as to *why* anyone would go to all this
trouble with layer manipulation, you can download my FM7 map of the
D&D setting Eberron from the NOX site and have a look at how it is
constructed. Go to http://www.nbos.com/nox/ click on the Fractal
Mapper category and look for "Eberron Core" in the list below. I
developed the layering technique described in the article and the
associated script as I struggled with this map. Frankly, a map of
this complexity is simply impossible to manage in FM7 without these
Controlling Layering (Z-order) in Complex FM7 Maps
by Christopher Rodrigues Macias
If you are working on large, complex maps in FM7 you may run into
problems with some objects hiding (or being hidden by) other objects.
This article describes a way of automatically controlling the
layering (z-order) of objects by symbol type so that you get the
layering effect that you want.
If you attempt to create highly detailed maps in FractalMapper—by
which I mean a map that has many different types of terrain,
vegetation and symbols on it—eventually you will start to experience
problems with z-ordering. ‘Z-ordering’ refers to the implied third
dimension on a map, and the way in which the various objects are
layered on top of each other.
[Why “z-ordering”? If you can remember back to your high school
geometry class, a flat surface—or ‘plane’—was defined by an x and y
coordinate system, where the ‘x’ axis ran left-to-right and the ‘y’
axis ran bottom-to-top. If you added in the third dimension, then you
needed a third ‘z’ axis which defined how far ‘above’ or ‘below’ the
x-y plane something was. Hence, in modern two-dimensional drawing
programs, such as FM, the problem of determining what is on top of
what (“Should that river appear to be on top of that road, or should
the road appear to be on top of the river?”) is known to programmers
Why will z-ordering cause you trouble? Trust me on this one. If your
maps are relatively small, or use only a few different symbol types,
then keeping the right things ‘on top’ is not going to be a big deal.
You can fix it by hand if something ends up accidentally hidden by
something else. However, as the size and complexity of your map
increases, eventually you reach a point where manually maintaining
the z-order of all the different symbols is more and more difficult
and eventually becomes completely unmanageable.
If you ever run into this, you’ll discover that there is no obvious
solution. If you’re familiar with sophisticated image editing, page
layout or drawing software, you’ll probably look to use FM’s layers
to deal with the problem. This will not work out-of-the-box, though,
as FM’s layers are purely a ‘grouping’ thing—they have nothing
whatsoever to do with z-ordering. That is, putting things on a given
layer has no effect whatsoever on whether they appear in front of or
behind things on other layers. You can have something on layer x that
is ‘on top of’ everything else on the map, and something else on that
very same layer that is ‘behind’ everything else on the map. Got it?
However, using the ability of layers to implicitly group objects (so
that you can easily select all the things on a layer or set of
layers), plus some careful planning and a little scripting wizardry,
will allow you to use layers to get control of z-ordering problems.
The overall process is as follows. First you have to figure out
exactly what you want to appear in front of what on your map. You
then separate out each different type of object/symbol onto its own
layer, with the layers ordered in the way you want the symbols to
layer over each other. Then you have to place (or move) all symbols
of a given type onto their designated layer. The last piece of the
puzzle is a script that, when run, will set the z-order of all
objects on the map based on what layer they are assigned to.
Let’s go through things in some more detail.
The first order of business is determining exactly which symbol types
should appear on top of (or below) which other symbol types. If this
sounds like a lot of work and planning, well, it can be. However,
I’ll give you a pre-canned layering pattern (below) that you can
adapt to your own needs, which can make things much easier. And, as I
said, this is only something you have to do for large, complex maps.
If you aren’t experiencing z-ordering problems, then you don’t need
to worry about all this. However, if you do need to manage it (and I
definitely did) then the work involved in planning and placing
symbols is going to save you eons of time trying to “fix” things when
an ill considered “move to back” command suddenly screws up your map.
One ‘trick’ of layering things so that they work properly is to place
all text labels (that is, the displayed names of things) on a
separate set of layers at the very ‘top’ of the order. Why? Well,
except in rare cases, you will probably want your labels to always
appear on top of all your map symbols. If you place the names of your
forests on the same layer as the forests themselves, then place the
‘roads’ layer ‘on top of’ the forests layer, than the road lines will
end up running over the names of your forests, which is probably not
what you want.
Another hint with regard to text labels: if you are only planning on
using your map in printed form, then you can probably get away with
only a single layer for all text labels, with perhaps one other for
the labels of “GM secrets” that you don’t want to appear on the
printed map. However, if you want to use the map in its electronic
form (say, by having your laptop at the gaming table with you) you
may decide you want to have fine-grained control over what items are
displayed at any given time. For example, you may want to be able to
hide all the small town symbols (along with their names) because they
are cluttering things up too much. In this case you have to go the
extra mile and create a matching ‘label’ layer for every symbol
layer, and place all of these label layers above all the symbol
layers. You’ll see how I did this in the example below.
[ Continued in the next email ]
Nbossoftware mailing list