From UFOpaedia
Jump to navigation Jump to search

Danial or BombBloke - thanks for making this. I am curious about how these files work...

"There are 112 entries, each of which are 32 bytes long. ... In Binary, the file creates 16x16 bitmaps, where 1 is solid and 0 is empty. These are then layered using the 12 loft references in the MCD files to create a 16x16x12 3D object."

I can see how 16x16 bits = 32 bytes for a 16x16 bitmap. But why are there "112" entries? How does this fit in with the "12 loft references" from MCD? (112/12=9.33... does it mean there there can be up to 9 "whole" 12-high objects in LOFTEMPS.DAT?)

Also: We're talking about the battlescape map, I presume... How does the "112" fit with the total number of objects in the game and/or max that can be on the battlefield at any given time? Is there any relationship?

And, BB you've said LOFT probably = Line Of Fire Table. What might EMPS mean?

As you can see, I know almost nothing about how the graphics are set up. So I have questions. :) If either of you can fill in any, please do so. If all the above can be addressed, delete this comment. Thanks! ---MikeTheRed 12:27, 17 Nov 2005 (PST)

Each MCD entry has 12 LOFT references, with each one pointing to the 16x16 bitmaps (the 112 entries on the LOFTEMPS.DAT file. The shape of the tile is thus built from the entries on the LOFTEMPS file. Those entries can have several shapes, like this: | . _ (I'm using punctuation marks that resemble it). Those are very simple shapes: if you want to 'draw' a wall you would use something like this: | | | | | | | | | | | | (the 12 LOFT references on the MCD file, each refering to an entry on the LOFTEMPS). When the game stacks them one over the other it produces a wall.

For a very technical explanation check this post by BladeFireLight: Map Control Data (MCD)

Also, check the end of that post. There's a link there to Koralt's MCD Editor. That is what I use for modifying the terrain files and it is easier to understand how it works with it, I think.

And the LOFTEMPS has nothing to do with the objects limit on the battlefield. I have no idea why there's only 112 entries though.

Hobbes 13:24, 17 Nov 2005 (PST)

They probably just kept adding to the file when needed, and 112 just happened to be the number they ended on.

I think, with the 112 lofts, by the 12 elevations, there's a possible 1344 "3D" objects in the game...

I've just added a graphic that should help you (and everyone else) understand a little better.

--Danial 9:16, 18 Nov 2005

P.S. I figured that loftemps was "Loft Elevation Maps" myself.

Thanks everybody! Wow, that's a lot of info. Cool... I (or anybody else) will copy over to the Article anything in this Discussion that's not yet there (looks like most of it is), then delete this Discussion ---MikeTheRed 16:38, 17 Nov 2005 (PST)

I get the impression that you could add to the loftemps.dat file, if you wanted to allow for more shapes... I see no reason why 256 different indexes would be a problem.

--Bomb Bloke 04:20, 18 Nov 2005 (PST)

LOFTemps visibility VS MCD visibility

The article says "These are used for Line of sight (LOS) and line of fire (LOF) purposes." But in the MCD record, offset 31, there is a flag "Can see through?"... This makes me think LOFTEMPS are not used for LOS?

--Daiky 19 Nov 2010

If you try this patched version of the Lightning, you should find that the thing has no "cracks"; that is to say, you can't see out of it unless you step out of it. However, the walls have that MCD flag set to 1, while the floors/ceiling have it set to 0. Both are obviously blocking visibility, hence the MCD article is either wrong, or at the very least misleading.
I know for a fact that tiles with an MCD[31] value of 0 will block visibility according to their LOFTemps records. It may be that tiles with a value of 1 block all visibility regardless of their LOFTemps records. -  Bomb Bloke (Talk/Contribs) 13:10, 19 November 2010 (UTC)
Tried setting UFO floor tiles to 1 tonight, didn't affect the vision of either my soldiers or the aliens. Still not conclusive, mind you - it may only work on walls or other "non-floor" tiles. -  Bomb Bloke (Talk/Contribs) 10:32, 20 November 2010 (UTC)

I have another possible theory, but not tested it yet. 1) MCD[31] is used for scanning the static terrain and reveiling fog of war. The LOFTemps are used only to test on visibilty between units. The reason why I think this, is because using LOFTemps to test on the visibility of all tiles in the field of view would take a lot of calculations, because the resolution is so much higher. 2) floors/ceiling tiles always block LOS. MCD[31] is ignored for floor type tiles. There are no floor tiles that I know of in the game where you can see through. By the way other types of blocking (HE, smoke, fire) are 0 too in the MCD, but I believe HE/smoke/fire is not going through roofs like they don't exist? So they must have some seperate hardcoded block value (I guess 1 in all cases). Anyway, this is the way it'll be implemented in OpenXcom, until a better theory shows up. --Daiky 01 Feb 2011

Floor/ceiling tiles do not always block LOS - they only block what their associated LOFTemps records tell them to block. For example, the red gravlift tiles present in UFOs and alien bases don't block sight at all.(Edit: Scratch that, they DO block LOS, but not LOF - making them a good tile to investigate!)
I strongly recommend testing the patched version of the Lightning I linked above, and comparing it to the original version. ALL the changes made to alter the way it blocks vision were applied to the LOFTemps record indexes, whereas attempts to mess with MCD[31] did nothing we were able to discern. It would also be a good idea to read this thread, which discusses the redesign process.
It does seem to be true that the game uses slightly more advanced calculations to determine whether you can see an alien, as opposed to whether you can see a given tile. If you have a soldier standing inside the Skyranger, for example, and tell him to turn around, he'll be able to see terrain outside the craft that shouldn't be visible EVEN IF you account for the diagonal gaps in the LOFTemps - and yet, if you block these gaps, the tiles in concern would otherwise be hidden. Whether an alien can be seen, on the other hand, seems to depend entirely on whether there's a line going from the head of the unit to the center of the alien's LOFTemp object (Seb located the firing point-of-origins and noted them here (they're adjusted according to unit Height, presumably the sight point-of-origin uses the same co-ords but located at the very top of the unit instead of partway down - this seems to be the case, given how LOS is affected by soldiers standing on haybales in barns for eg), while you can get some info on the use of LOFTemp objects by units here).
I've since done some further tests with MCD[31] and found it doesn't seem to affect "object" tiles either. I'm beginning to strongly suspect it has nothing to do with vision at all. -  Bomb Bloke (Talk/Contribs) 06:20, 1 February 2011 (EST)

I have done testing myself on this topic. I set the mcd[31] to 0 (= see through) of a ufo wall, and I can see the inside of the ufo, but not the aliens in it. And my theory is confirmed. Visibility of tiles and units are calculated in two ways: visibility of tiles uses mcd[31], visibility of aliens uses loftemps.dat. I will update ufopaedia accordingly.

--Daiky 01 March 2011

Righto, I must've managed to mess up in my tests, thanks for clearing it up. It'll be helpful for the MudRanger project too! :) -  Bomb Bloke (Talk/Contribs) 06:56, 2 March 2011 (EST)