From The Mana World
Revision as of 11:23, 6 March 2015 by Cassy (talk | contribs) (Cassy moved page Dev:Map layers proposal to Archive:Map layers proposal: outdated)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This article is currently only a proposal

The features or design guidelines described in this article are only a proposal made by one or some persons. It has not been evaluated or accepted by the core development team yet. Feel free to add your personal opinion about them or make counter proposals.

People who approve this proposal People who oppose this proposal
Example of map layers
Map (Name) Action
...
10 2
9 (Collision) 1
8
7
6 (Fringe)
5
4 (Collision) 0
3
2 (Fringe)
1
0

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
...

Basics

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).

Particle Engine

The particle engine could be left as it is, but that prevents lower actions layers from using the engine to it's fullest. To resolve this, I have outlined some changes that could be made below.

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 amount of math.

Drawing

To make it easier for the players, action layers above them could be drawn with increasing transparency. This also makes the changes outlined above for the particle system more worthwhile and taller maps (with more action layers) more interesting.

Battle

Normal battle should be restricted to the action layer the player/monster is on and action layer transition areas that lead to/from the layer they're on.

Flying monsters need to identify an action layer range where their bodies are located. Along with a width, this creates an ellipsoid that contains their entire body. They can be attacked if the player's position and weapon range create an intersection of it.

Magic

Magic spells have a horizontal range (which controls how far the spell goes on the caster's current layer), one or two vertical ranges (that control how many layers the spell goes up or down; these directions can be specified separately, as needed), and a description of how the horizontal range changes as the attack changes layers.