From The Mana World
m
(clarification and more description)
Line 54: Line 54:
|}
|}


The physics engine would only need some minor changes. A layer height (''h'' either map layer or action layer) needs to be defined. Particle processing would need to be move to before map drawing. Instead of immediately drawing each particle, they'd be moved into queues depending on their height, one queue for each (action) layer. Particles whose z-pos are between 0 and ''h'' are in the first queue, between ''h'' and 2 * ''h'' are in the second queue, etc. Negative heights are in a another queue and drawn before any layer. After each (action) layer is drawn, all particles in the queue are drawn as well. If the queues are per action layer, they could be drawn in one of three ways:
The particle engine would only need some minor changes. A layer height (''h'' either map layer or action layer) needs to be defined. Particle processing would need to be move to before map drawing. Instead of immediately drawing each particle, they'd be moved into queues depending on their height, one queue for each (action) layer. Particles whose z-pos are between 0 and ''h'' are in the first queue, between ''h'' and 2 * ''h'' are in the second queue, etc. Negative heights are in a another queue and drawn before any layer. After each (action) layer is drawn, all particles in the queue are drawn as well. They could also be drawn interspersed with the tiles, though this could cause problems. If the queues are per action layer, they could be drawn in one of three ways:
*After the fringe layer
*After the fringe layer
*After the collision layer (and therefore after the action layer itself)
*After the collision layer (and therefore after the action layer itself)
*After a new special layer
*After a new special layer
*:This layer  would be named particle and could include other tiles so the particles are drawn interspersed with them. This option could be combined with one of the other two as a fall back for when this layer isn't specified. Particle effects would also need an initial height (either in engine units or in layers).
*:This layer  would be named particle and could include other tiles so the particles are drawn interspersed with them. This option could be combined with one of the other two as a fall back for when this layer isn't specified. Particle effects would also need an initial height (either in engine units or in layers).
Doing the particles per action layer is preferred over per map layer to prevent particles from being hidden (see [http://mantis.themanaworld.org/view.php?id=188 Mantis 188] for a similar effect) and to reduce the number of queues and math involved.

Revision as of 01:09, 11 March 2008

This is a proposal to resolve Mantis 21 and Mantis 188 and implement Action layers.


Some definitions:

Layer
A layer in the map file
Action Layer
Multiple layers in a logical group of map layers where beings can walk:
Action layer 0 is the lowest
Action layer 1 is the next one
etc


Maps can have an unlimited number of layers, each one drawn in order by the client. There are two (or three, see below) special layers: fringe and collision. The fringe layer is where beings are drawn, intermixed with the layer's content. The collision layer isn't drawn, but defines where beings can walk and move between action layers. To allow more complex mapping, we must allow for multiple fringe/collision layer pairs, each pair defining a distinct action layer. To tell which layers are fringe/action layers, we could use either the layer name or set a layer property. If we use the name method, each pair could use a different number to define it's action layer or (more preferred) we use their relative positions to define their action layer. The second method is preferred as it's more intuitive and the first could cause situations where, for example, layer 1 is below layer 0. An action layer would consist of every map layer between the previous collision layer (if there is one) and the next collision layer). To make it easier for the players, action layers above them could be drawn with increasing transparency. Example:

Map Notes Action
... ... ...
10 2
9 Collision 1
8
7
6 Fringe
5
4 Collision 0
3
2 Fringe
1
0

The particle engine would only need some minor changes. A layer height (h either map layer or action layer) needs to be defined. Particle processing would need to be move to before map drawing. Instead of immediately drawing each particle, they'd be moved into queues depending on their height, one queue for each (action) layer. Particles whose z-pos are between 0 and h are in the first queue, between h and 2 * h are in the second queue, etc. Negative heights are in a another queue and drawn before any layer. After each (action) layer is drawn, all particles in the queue are drawn as well. They could also be drawn interspersed with the tiles, though this could cause problems. If the queues are per action layer, they could be drawn in one of three ways:

  • After the fringe layer
  • After the collision layer (and therefore after the action layer itself)
  • After a new special layer
    This layer would be named particle and could include other tiles so the particles are drawn interspersed with them. This option could be combined with one of the other two as a fall back for when this layer isn't specified. Particle effects would also need an initial height (either in engine units or in layers).

Doing the particles per action layer is preferred over per map layer to prevent particles from being hidden (see Mantis 188 for a similar effect) and to reduce the number of queues and math involved.