[File Guide] - LvlTypes.txt [v1.1x]

Post here about all aspects of D2 mod making whether it's information, problems or whatever. Please specify whether your post is relating to Classic D2 or the Expansion.

Moderator: Nizari

Post Reply

No votes
Total votes: 0

User avatar
Retired staff
Posts: 589
Joined: Tue Sep 24, 2002 2:24 am
Location: Nowra NSW, Australia

[File Guide] - LvlTypes.txt [v1.1x]

Post by Drac0 » Mon Oct 10, 2011 7:46 am

LvlTypes.txt File Guide [v1.1x]
By Drac0
v1.0, 09 Oct 2011

LvlTypes.txt is the file that specifies the graphic tile sets (dt1 files) used for creating maps (ds1 files). Each dt1 file contains numerous single tile images of floors, walls, cliffs, waypoints etc. As such, it is a file mainly used by those who wish to change & add maps to the game. For more information on dt1 & ds1 files visit the Mapping forum.

It is referenced by Levels.txt & LvlPrest.txt.

Name: (comment only) A descriptive name of the general ds1 type the row is used for.

ID: The index number of the row. This is the number used in the ‘LevelType’ column of Levels.txt to identify which row of tile sets should be used for each level.

File 1 – File 32: Each level type can use up to 32 different tile sets for each map, the outdoor areas in Act 5 after The Bloody Foothills actually use 31. The dt1 files listed here are referenced by the ‘Dt1Mask’ column of LvlPrest.txt. This mask specifies which files in this row are used by each map. See Appendix A for details on how the Dt1Mask works.

Beta: (comment only) Was this row used in the D2 Beta.

Act: Which act of the game is this level type usually associated with. One of the few areas in the text files where the number here is actually the act number!

Expansion: (comment only) Is this row from the expansion or not? 0 = D2C, 1 = LoD. Just another form of the EOL column in other files.

Appendix A: Dt1Masks Explained!
A new Dt1Mask for LvlPrest.txt usually needs to be calculated for all maps using the level type any time you add or remove a file from the File [x] columns. If you only change a file, the Dt1Mask is unaffected. Note that if you ADD a file to an empty File column to be used only for a specific map/s, you should not need to change the mask for other maps. The simplest way to calculate the mask is to use one of the apps designed for it, available from the File Center. But it sometimes helps to know how to do it manually.

The Dt1Mask tells LvlPrest.txt which columns in this file to use for the tiles of a particular map. But how can these numbers, which range from 1 up to the 1000’s of millions, do that? Quite easily actually.

Each File column is assigned a value, starting with 1 for File 1, then DOUBLING for each column after that. So you have:
File 1 = 1
File 2 = 2
File 3 = 4
File 4 = 8
File 32 = 2147483648

The Dt1Mask is calculated by simply adding the relevant column values together. So if you only have File 1, the mask is 1. If you use the first 3 files, then the mask is 1 + 2 + 4 = 7. If you actually wanted to use ALL 32 files, the mask would be 4294967295.

Generally it’s easiest to use a mask for all files in a row, but if you wish you can use these numbers to specify particular tile sets for a map! For example you may only want to use the dt1’s in File 3, 7 & 10. Simply add the value of the columns together:
File 3 = 4
File 7 = 64
File 10 = 512
Dt1Mask = 4 + 64 + 512 = 580

The beauty of this system is that NO TWO GROUPs OF FILES CAN HAVE THE SAME VALUE! No matter which files you choose or how many, you will not get another combination that adds up to 580. So the game always knows exactly which files to use.

Another method of calculating the Dt1Mask when using only selected files is to use Windows Calculator in scientific mode. See this post by PureRage for details on how to do this.

So despite the foreboding looks, a Dt1Mask is actually quite simple.

Thanks to:
Paul Siramy for his mapping tools & information.
Everyone from the Mapping forum where most of this information can be found.
PureRage for the tip on using Windows calc for Dt1Mask calculations.

Comments & corrections welcome.

*** EDITS ***
11 Oct 2011 - added info on using Windows calc to work out the Dt1Mask.
Last edited by Drac0 on Tue Oct 11, 2011 5:57 am, edited 1 time in total.

User avatar
Forum Regular
Posts: 570
Joined: Fri Jan 08, 2010 9:02 am
Location: Newcastle, England
Great Britain

Re: [File Guide] - LvlTypes.txt [v1.1x]

Post by PureRage » Mon Oct 10, 2011 11:43 pm

For dt1mask:
I find it easier to open calculator on windows and change to scientific and set it to "bin". For each Dt1 you want the map to use, add a 1 and each one you dont want to use, add a 0.
1010101010101 will use dt1 columns 1,3,5,7,9,11, and 13 and ignore the rest. Once you enter that in calculator and switch to "dec" it will output your dt1mask.
Like so:
In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as "A bad move".
Douglas Adams

Post Reply

Return to “General Mod Making”