In The Sims, a roof would automatically be generated when an area enclosed by walls was open at the top. Players could select a roof pitch and roof texture, which would be applied to all buildings on the lot. Roofs in The Sims are mostly aesthetic, since there is no weather in the game.
The Sims 2Edit
In The Sims 2, there are several types of roof to choose from. The base game has hip, gable, 3-Hip and Half-Hip roofs, and flat roofs. Other expansions add domes, cones, octagons, pagoda-style roofs, and mansard roofs. All of these, except for the mansard roof, are available in the Roof section of Build mode. Mansard roofs are made by using pieces found in the Architecture section. Flat roofs use flooring.
Roof pitch for non-flat or mansard roofs is set at 45 degrees, but can be adjusted to between 15 and 75 degrees using the roofslopeangle cheat (if The Sims 2: Nightlife or a later expansion is installed). With Mansion and Garden Stuff, roof angles can be changed individually without the use of cheats.
Roofs are particularly important in The Sims 2: Seasons, as they keep the elements out.
The Sims 3Edit
The Sims 3 re-introduces auto-roofing, though it can be disabled. The roof tool in The Sims 3 mostly expands on the roofing options from The Sims 2, and allows the adjustment of roof pitch without the use of a cheat, a feature previously available in The Sims; The Sims 3: Ambitions (as well as an update for the base game)  allow the adjustment of pitch of individual roof segments. The Sims 3: World Adventures allows a roof type with pagoda-style eaves. Roofs, like in The Sims 2: Seasons, is essential to keep the out the elements from the weather in The Sims 3: Seasons.
The Sims 4Edit
The Sims 4 revamps the roof system completely. Auto-roofing has been removed, and instead roofs can now be pushed and pulled to the size and shape the player wants it to be. The base game has gabled, half gable, hipped, and half hipped roof styles, along with their diagonal versions. With the push and pull mechanic, roofs can also be shaped into different styles such as domed, pagoda, awning, and gambrel. Pentagonal, hexagonal, octagonal, and round roofs were added in Patch 57 along with an advanced curvature mode, eaves for the gabled and hipped roofs, and other customization options. Patch 68 also added six different glass roofs.
In The Sims 4: Seasons, roofs are now more important for houses, as they keep out the various elements of weather.