# Perspective

*706*pages on

this wiki

The freeciv drawing code is rather monolithic and hard to change. However within that framework there is a lot of flexibility to allow for different perspectives. Most of these have never been tested (there are only 3 perspectives that we've ever used AFAIK), but I believe they should all be possible.

All perspectives must be orthogonal. This means there is no dimension of distance; things far away look just the same size as things close. By comparison a true 3d game usually does not have an orthogonal perspective, it presents a "true" perspective where far away things are smaller.

There are two basic perspectives.

- Overhead perspective. Here the perspective is orthogonal (of course) of an observer directly above the tiles. In this case the graphics are usually drawn as from a side view (since an overhead view of a unit, for instance, would be pretty useless).

- Isometric perspective. Here the perspective is orthogonal (of course) of an observer a a 30-degree (pi/6) angle above the ground (60 degrees away from on overhead view). The effect of this perspective is that things are quashed by a factor of 2 in the vertical direction. Of course angles other than 30 degrees are possible...in theory we could give any angle and simply take the sine of it to find the quashing factor for the Y direction.

And there are four basic tile shapes that we can support (really these are just different rotations of 2 different tile shapes, and triangles - the third possible shape - are ignored).

- Square. Each tile is a square, view head-on. (It could be a rectangle as well). This will look best in overhead view because, well, it's a square.

- Diamond. Each tile is a diamond - a rotated square with all 90-degree angles and all sides equal. (It can be squashed in one direction to make it a rhombus with equal angles along opposite corners.) This will look best in isometric view because there's a lot of vertical overlap between tiles (each tile is wide but not very tall along most of its width, so an isometric perspective allows 3d effects of one tile to cover just the extremeties of the adjacent tiles behind it).

- Hex 1, aka "hex", aka "flat hex". Each tile is a hexagon with flat edges along the top and bottom and two angled edges along each side. The hexagon can be regular or it can be not-quite-regular. A regular hexagon will have irrational dimensions (which will just be rounded off of course). Good choices for irregular hexagons have their top/bottom "base" edges taking up either 1/3 (as in isophex) or 1/2 (as in wesnoth) of the total width of the hexagonal area. A wider base is better for an overhead perspective (as in wesnoth and isophex) since it makes the hexagon more square-like. A narrower base is better for an isometric perspective since it gives more vertical overlap between tiles.

- Hex 2, aka "hex", aka "iso-hex". Each tile is again a hexagon, but now there are vertical edges along the left and right and two angled edges each on top and bottom. Again there is the choice of regular or irregular hexagons. Because there is more vertical overlap it is better for an isometric perspective.

Now, what can we do with this information? Currently we have three different "views" (combinations of perspective and tiling).

- Classic view is a rectangle with overhead perspective.
- Iso-view is a diamond with isometric perspective.
- Hex-view (isophex) is an irregular hex1 with an overhead (?) perspective.

First of all, I think hex-view (isophex) should not use the 1/3 base width (hex_side is 1/4 of tile width). It should either have a 1/2 base width like in wesnoth (hex_side is 1/3 of tile width) or it should be a regular hexagon. Possibilities for a 1/2 base width are a 54x36 tileset with a hex_size of 18 (972 pixels/tile, comparable to trident), a 72x48 tileset with hex_side or 24 (1728 pixels/tile) or a 108x72 tileset with hex_side of 36 (3888 pixels/tile, same as wesnoth). For a regular hexagon the tile width must be 3w and the height is sqrt(3)w and the hex_side is w. This is made complicated because width and height "should" be a multiple of 4. Possibilities here include a 48x28 tileset with a hex_side of 16 (672 pixels/tile, bigger than tinydent), a 56x32 tileset with a hex_side of 19 (896 pixels/tile, equivalent to trident), or a 96x56 tileset with a hex_side of 32 (2688 pixels/tile, equivalent to freim96).

Next, I think a new view using hex2 tiles should have isometric perspective. This means the exact same logic is followed as in the hex-view but at the end we halve the tile height - units and such are then drawn with an isometric (3d) perspective.