Difference between revisions of "LOFTEMPS.DAT"

From UFOpaedia
Jump to navigation Jump to search
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{tocright}}
 
{{tocright}}
  
'''LOFTEMPS.DAT''' is found in the [[GEODATA]] folder. It contains "Line of Fire Templates", used to create 3D representations of the creatures and objects within the battlescape. These are used for [[Line of sight]] (LOS) and line of fire (LOF) purposes.  
+
'''LOFTEMPS.DAT''' is found in the [[GEODATA]] folder. It contains "Line of Fire Templates", used to create 3D representations of the creatures and objects within the battlescape. These are used for [[Line of sight]] (LOS) (to see units, terrain uses MCD[31]) and line of fire (LOF) purposes.  
  
 
The file is made up of multiple 16x16 bitmaps (32 bytes each, one bit per pixel, where 1 is solid and 0 is empty). These are then double layered using the 12 LOF references for tiles defined in the [[MCD|MCD files]], to create 3D 16x16x24 objects for each.
 
The file is made up of multiple 16x16 bitmaps (32 bytes each, one bit per pixel, where 1 is solid and 0 is empty). These are then double layered using the 12 LOF references for tiles defined in the [[MCD|MCD files]], to create 3D 16x16x24 objects for each.
Line 81: Line 81:
  
 
[[Category:Game Files]]
 
[[Category:Game Files]]
 +
[[Category:Enemy Unknown/UFO Defense]]
 +
[[Category:TFTD]]

Latest revision as of 04:47, 23 July 2013

LOFTEMPS.DAT is found in the GEODATA folder. It contains "Line of Fire Templates", used to create 3D representations of the creatures and objects within the battlescape. These are used for Line of sight (LOS) (to see units, terrain uses MCD[31]) and line of fire (LOF) purposes.

The file is made up of multiple 16x16 bitmaps (32 bytes each, one bit per pixel, where 1 is solid and 0 is empty). These are then double layered using the 12 LOF references for tiles defined in the MCD files, to create 3D 16x16x24 objects for each.

Units are represented by a single LOF template, usually a round one, which is defined by offset 48 of the UNITREF.DAT record for that unit. This is stacked according to the unit's height (offset 49 or 50, depending on whether the unit is standing or kneeling), to create a cylinder shape. Note that "large" units, which cover four tiles, are made up of four such cylinders.

In UFO there are 112 entries, 3,584 bytes in total (or, in TFTD, 114 entries spanning 3,648 bytes). TFTD stores the LOFTEMPS tables in the TERRAIN folder, but also keeps a copy of UFO's version in its original location - though this old version is unused.


Template Usage

An example of a 3D tree made up of stacked LOF templates. Click for a larger view.

Both UFO and TFTD are presented as 2D games, that is to say, all the images on the screen are made up of sprites. In the battlescape, everything is shown from an isometric perspective.

However, the games are only presented in 2D - much of the actual processing is done on 3D objects (albeit primitive ones). These are defined by stacking the LOF templates stored on this file on top of each other.

When a soldier crouches next to a short wall, for example, he may no longer be able to see over it if his head is now below the top. Likewise, he may or may not be able to see through the slats of a picket fence, depending on what angle he views it from.

Likewise, these 3D objects also come into play when bullets fly though the air. If a unit is hiding behind a tree, the thick foliage will likely protect his head from a bullet aimed high - but a low flying shot may easily go past the thin trunk and get him in the legs.

A soldier's head is positioned slightly higher then the barrel of his gun. For this reason, it is possible for him to be able to see an alien (that is, he has a valid "line of sight"), but not shoot it (because he has a blocked "line of fire").


Template Oddities

Diagonal Processing

If two "solid" points of a template are placed next to each other, horizontally or vertically, then there will be no way to see/shoot between them. This is not the case, however, if they are only connected diagonally. This is why no diagonal "lines" of a single pixel in width exist within the template tables (as they would be very ineffective at blocking sight/bullets).

However, a problem occurs when placing two templates next to each other on the diagonal: You can't "widen" them at the meeting point, so at that exact spot there'll be two "solid" template points that only touch on the diagonal. Units can see/shoot right through these! Quite a few examples of this occur in the wall layout of the Lightning craft, while in (most) other cases such gaps are blocked off using additional tiles.

The below images show the contrast between the Lightning's design, and that of the Medium Scout. Putting aside for now the rather large gap in the north-facing wall of the Lighting's LOFTemps diagram (refer below for more on that), note that the diagonal "holes" (marked in red) do not exist in the Scout, due to the placement of pillars in the gaps. Click the images for a larger view.

(Note that despite this, it is still possible to see/shoot through most of those points if a unit stands in the same tile as a pillar - though the mechanics as to how that works really belongs on the Line of sight page. Some parts of this article may get moved over there later, for now I consider both to be a "work in progress"). - BB

Lightning LOFTemps wall layout; top-down view.
Lightning as presented graphically.
Medium Scout LOFTemps wall layout; top-down view.
Medium Scout as presented graphically.

Just as sight/shot lines can pass between diagonally adjacent points placed side-by-side, the same thing can happen when the upper or lower edges of these points only meet on the diagonal. This is a far more common situation (for example, it applies to every single staircase in the entire game), and is the reason why soldiers can "look out" through the (apparently solid) walls of their drop ships. Here are two side-on cross sections, one of the Skyranger's troop bay, and one of the small two-story house from urban terror missions (map module 15):

SkyRanger cross-section view.
Two-story house cross-section view.

This sample save game for TFTD demonstrates how these diagonal joins can be "peeped" through. Turn the lone trooper to face the Triton, and she will be able to see inside it.


Blatant LOFTemps Bugs

While the game developers showed a large amount of attention to detail in constructing the 3D objects used in the game, there exist a number of errors. Here we have some of the more notable "gaps" in supposedly solid shapes, going beyond those caused by the diagonal joins mentioned above.

These images were created using Bomb Bloke's "LOF Terrain" program, which allows you to see the 3D shapes using the game engines themselves. Although still viewed in 2D (hence making it impossible to see all the details without "cutting away" certain tiles), this still shows many such problems at a glance.

The central northern wall of the Lightning floats out into space. Note that the soldiers can walk through the diagonal walls due to another bug completely unrelated to the LOF templates.
The Supply Ship has a hole in its hull, circled in yellow in the center image. It's even possible for units equipped with Flying Suits to hover up through this gap and walk directly into the UFO.
A large hole under the Triton's wing reveals the aquanauts inside.


Template Tables

UFO

Here are the 112, 16x16 bitmaps (white is solid):

Loftemps.png

TFTD

Here are the 114, 16x16 bitmaps (white is solid):

Loftemps TFTD.png


See Also