Hey there, in this tutorial I'll be explaining how dungeons/raids work and how you can create your own. (Bosses and scripting is not included, this is only to make your map act like an instance.)
An actual map. (WDT & ADT files...)
Basic knowledge about editing DBCs and packing MPQs.
DBC Editor (Preferably Taaliis)
I'm going to assume that you already have a map and that you've made a row for it in Map.dbc. The first thing you'll need to do is to change the AreaType of the map. Simply head into your map.dbc, find the row corresponding to your map and then take a look at column 3.
Change column 3 to any of these depending on what you're after.
Example: I'll be making a basic 5-man dungeon, so I'll set AreaType to 1.
That's it for Map.dbc. Once you've saved and closed it, locate and open up MapDifficulty.dbc. Make a new row or copy an existing one and edit these values to your liking:
#0 - ID (Unique Identifier)
#1 - MapID (The MapID of your map, in my case 725.)
#2 - Difficulty Flag (0: Normal, 1: Heroic)
#20 - Reset Timer in seconds(This is the duration until the instance is reset, AKA lock-out duration. 86400 = 24 hours etc...)
#21 - Max Players (Basically how many players that are allowed in the instance. 5, 10, 25, 40 etc...)
#22 - StringDifficulty (This should match the amount of players and normal/heroic flag. See table below for more information.)
1 = RAID_DIFFICULTY_40PLAYER
77 = RAID_DIFFICULTY_10PLAYER
102 = RAID_DIFFICULTY_25PLAYER
127 = DUNGEON_DIFFICULTY_5PLAYER
198 = DUNGEON_DIFFICULTY_5PLAYER_HEROIC
232 = RAID_DIFFICULTY_20PLAYER
1327 = RAID_DIFFICULTY_10PLAYER_HEROIC
1359 = RAID_DIFFICULTY_25PLAYER_HEROIC
This is my example of a 5-man dungeon with both normal and heroic difficulty:
That's it for the DBC part. The last thing you need to do is to open up your database and add a row to world.instance_template. (I'm using TrinityCore. I'm not sure how it works with other emulators, but I doubt it's difficult.)
INSERT INTO instance_template
That's it! Your map should now be a proper dungeon/raid.
If anyone is interested, I'll make an additional tutorial on how to implement your dungeon into the 'Dungeon Finder UI'.