Category Archives: Graphics

MTile/GTile edge definition syntax

Though this syntax was developed many months ago, I had forgotten to document this.

Overview

This edge definition refers to the edges that exists in any GTile tile/sprite. This obviously means that edge definition is a Tiled property of the GTile, which is then passed on in C2 to generate MTile edges at runtime.

Note that a GTile refers to a graphics tile which is a bigger-sized tile. An MTile refers to a movement tile which is smaller and forms the grid of possible tiles to move to. Every GTile is subdivided into equal square MTiles.

Edge definition

Below is an image representing one GTile, and the MTile IDs within it:

For every GTile, there can exist any number of edges. Using this image as an example:

That sprite is mapped out as:

Here, we introduce the edge syntax used to define those edges.

<mtile_id>:<gridmove_direction>[,<mtile_id>:<gridmove_direction>...]

Where mtile_id is the id of the MTile that needs an edge definition (because it is neighbouring a GTile edge), and gridmove_direction is the direction where the edge lies on that MTile specified in the GridMove format.

In the sprite above, the edge definition is:

1:0,5:0,8:3,9:3,10:3,11:3

That is, the MTile ID 1 and 5 have a edges at Direction 0 (east), IDs 8, 9, 10, and 11 have edge at Direction 3 (north). Note that it’s possible to have defined other MTiles, such as:

6:1,7:1

…to replace 10:3, 11:3. It doesn’t matter, as long as the same edge is not specified twice.

Tiled

Note that the edge definition is inputted in Tiled in its tilesheet editor. Currently, there are two Tile properties associated with edge: edge and edge4. edge was the original use, which subdivided each GTile into 2×2 MTiles. edge4 subdivided it further (4×4) giving it a maximum of 16 MTiles per GTile (this depicted in the image above).

In the C2 project, only one type is used and can be interchanged or modified depending on final design choices.

Advertisements

How to get height level of tile in iso view

 

pasted-image-at-2016_11_13-09_06-pm
How to get height level of tile in iso view.

The purpose of this graphic is to determine the unit height of an agreed isometric tile. This unit height is important to when modelling 3d objects which feature floor levels. The next height level should always correspond to the tile above.

  • Need the Hypothenus to get the diamond’s upper and lower tips.
  • Knowing the camera angle and the Hypothenus, what is the Opposite.
  • tan θ = O/A (in which case ‘A’ is the Hypothenus)
  • O= tan θ * A (multiply the tangent of the angle by the Hypothenus)
  • In the example above, O = 50.4367359
  • If O and A is known, what is the angle?
  • θ = atand(O/A) (arctan in degrees)

Solve for the camera angle needed to match a 2x2m tile’s height with the grid if the height is 100cm and 200cm.

  • 200^2 + 200^2 = 80000
  • A = sqrt(80000) = 282.8427
  • θ = ( O / 282.8427)
  • if O=100
    • 100/282.8427 = 0.35355
    • atand(0.35355) = 19.471
  • if O=200
    • 200/282.8427 = 0.7071
    • atand(0.7071) = 35.2643
  • if O=250
    • 250/282.8427 = 0.8838
    • atand(0.8838) = 41.4729