Each level is called a 'world'. The terrain of the outside worlds are made of one-sided polygons (called 'terrain'). The entire world is contained in a large hollow polygon -- usually a rectangular polygon -- and the image of the sky is usually projected onto that. The terrain shouldn't touch the bounding box for technical reasons so that it's possible to walk off the edge. Invisible walls are used to prevent this, but sometimes gaps are left or one can get over them. It sounds like you did the latter.
Most cities are surrounded by walls, but the inside of these cities are run as separate worlds. This was done so the levels would run faster since there'd be fewer things to draw and keep track of.