Joining and merging sectors
Joining and merging sectors are two different ways of combining multiple sectors into a single sector.
In the process of designing a map, it is not unusual to find a situation in which sectors that were originally intended to have different properties need not in fact be distinct from one another. Rather than simply setting all the sectors to have identical properties – for example: flats, heights, etc. – it can often be convenient to replace them with a single sector. This resulting sector can then be manipulated more easily.
The simplest way to combine two sectors is to join them. This simply sets all the sidedefs for the specified sectors to refer to a single sector, which in most map editors will be the first selected sector. All other sectors that previously existed become obsolete and may be automatically removed by the map editor.
Often the sectors that are to be combined will share a boundary at one or more linedefs. Following a join, those linedefs will remain, despite the fact that their front and back sides face into the same sector. Merging the sectors rather than joining them avoids this problem: It begins by joining them as before, but then removes any linedefs that have become redundant in doing so. In the case where sectors share no linedefs, joining and merging are equivalent.
Note that it is not sufficient simply to delete the linedefs between the sectors in order to merge them. Deleting linedefs does not cause sector references on sidedefs to be recalculated, and so not only will the sectors not be combined, but unclosed sectors will also result.
Merging for optimization
Since merging sectors reduces the number of sectors, it also reduces the size of the resulting map. Examining a map and merging sectors which share all their properties is therefore one method of optimizing a map. SRB2 Doom Builder can find sets of identical sectors automatically. Furthermore, if Ctrl and Shift are held while selecting the option from the menus, all sets of identical sectors will be merged in a batch operation, but this is potentially dangerous: If the properties of one of the sectors is modified at runtime based on the linedefs it shares with a control sector (rather than by tag, in which case this would be sufficient to distinguish it from the other sectors), merging the sectors will cause the other sectors also to experience these runtime changes. Rising FOFs cause such behavior.
It is inadvisable to attempt to optimize a map in this way before it is complete, as then it becomes impossible to set the properties of what used to be separate sectors independently of the new merged sector without first separating them again.