I've been working on adding schools to 3DWorld's procedural cities on and off for a few months now. I started schools shortly after hospitals, and switched back and forth between working on the two building types. Hospitals got to a semi-finished state first, so I wrote a blog post on them last month. This post will be on the topic of procedural schools. I'm not quite done with schools at this point, but I'm starting to work on other unrelated topics. Maybe reader comments/feedback will give me some ideas on how to finish schools. I definitely got a lot of good feedback on hospitals last month.
As with the hospitals post, I'll describe each new type of room and show at least one screenshot for each of them. Technically, none of the room types is really new, but they're all at least somewhat customized for schools.
School buildings are of the taller and blocky "city" form rather than the strip mall-like one or two floor schools that seem to be more common in areas with more land. I tried my best to fit them into my standard office building templates with a central hallway and optional secondary hallways, with possible vertical stacked parts of progressively smaller footprints. This leads to most of the rooms having similar sizes, which isn't ideal, but I'll try to work with that. I ran into that same limitation with hospitals. Maybe sometime I'll find a better system to create buildings with larger and more complex footprints. I could use that for malls and factories as well.
Classrooms
I actually added classrooms to both schools and hospitals, though they're much more common in schools. In fact most of the rooms in schools are assigned as classrooms. I feel like the classroom discussion belongs in the schools post rather than the hospitals post, so I held off on writing about them until now.
Classrooms have a few requirements. First, there is a minimum room size required to fit at least 3x3 student desks. In order to guarantee most rooms are large enough to be classrooms, I modified the hallway and room generation logic in the office building floor planning step to create fewer larger rooms. One component of this was to increase the threshold or building size needed for adding secondary hallways. Classrooms must also have at least one exterior wall with a window, and no stairs, elevators, or exterior doors.
Most of the space in classrooms is filled with a 2D grid of smaller student desks with chairs, placed in multiple rows and columns as space allows. I copied and customized the code that I used to place rows of shelves in retail rooms. Any desks that are too close to a door or other object are omitted. The placement logic is relatively simple compared to some other room types because I don't need to worry about things like exterior doors, stairs, and elevators. A random assortment of books, papers, pens, and pencils is placed on top of these desks.
A teacher desk is placed against a wall, with preference for the long side of the room and interior walls with no windows. This desk has drawers and the top surface can have papers and an optional cup, which contains coffee 50% of the time. If the wall is windowless, a chalkboard/blackboard is added behind the teacher's desk and covers most of the wall. I'm going to refer to it as a blackboard because I've made them all black rather than dark green. Plus it seems to fit better with "whiteboard" used in offices. I then added an American flag to one side of the blackboard and an analog clock to the other. To finish the room off, I placed a few other objects such as plants, paper and trash on the floor, and room number signs outside the door.
![]() |
A school classroom with student desks and a teacher's desk and chalkboard in front. |
Here's a larger classroom with darker chair colors. The screenshot was taken from inside the doorway to the room, which is why there are no desks or chairs in the foreground.
![]() |
A second classroom with darker chairs. |
Oh! I also changed the titles of most of the books found in schools to match a selection of real school subjects. The list I came up with is: Math, Mathematics, Algebra, Geometry, Trigonometry, Calculus, Science, Biology, Chemistry, Physics, Economics, Computer Science, English, Literature, Language Arts, Social Studies, History, Geography, Government, Sociology, and Visual Arts. Some of these have "I" or "II" suffixes. Unfortunately, I haven't yet found a way to make the subjects match the images placed on the book covers. The textbook subjects found in each classroom are random as well, rather than matching the subject taught in the room.
![]() |
A student desk with a calculus book ... that has a picture of a museum dinosaur exhibit on it? What does that have to do with calculus? |
Blackboards come with chalk and erasers that the player can use to draw on them. I was thinking of adding some existing text and drawings on the boards, but I don't know where to get the images from. Drawing text with normal font doesn't look correct; I need something handwritten. Most of the images I saw in Google image search are artistic drawings rather than something you would find in schools. I was only able to find one image of some math that was high resolution, free, not watermarked, and the correct color and aspect ratio. It's clipped at the edges, but otherwise looks okay. This image is added to the blackboards of 25% of classrooms. If I find more useful images I'll add them later. Sadly, erasers held by the player don't work on these images.
![]() |
Blackboard with some math writing that's somewhat stretched and clipped. |
Hallway Lockers
Most larger building types have hallways, but only schools have lockers placed in these hallways. I added rows of lockers to each side of the primary hallway on each floor, wherever there was space. There are gaps in the rows where doors or other objects such as water fountains and fire extinguishers block their placement. Each school building part chooses a random locker color from a selection of light/bright colors. Some lockers have padlocks added to them.
School hallways also have a random chance of papers and trash on the floor. Otherwise, they're similar to office buildings with restrooms, water fountains, fire extinguishers, and trashcans on each floor.
![]() |
A shorter school hallway with blue lockers and stairs. There is some paper trash visible in the bottom center. |
Some of the larger schools have hundreds of lockers lining the hallway. This is probably too many given the number of desks in the classrooms, but it's fine for now. I'm sure some schools have too few lockers as well.
![]() |
A longer school hallway with red lockers, elevators, and intersecting hallways. There are a few papers on the floor in the back. |
The player can open the lockers without padlocks, and of course they contain items. All locker interiors have a larger bottom section and a smaller top section. Both shelves can have stacks of textbooks. Smaller objects such as cell phones, paper balls, bottles, and cans are placed on these books or on the empty shelf. Some lockers have papers attached to the inside of their doors. The larger bottom shelf also has a chance of a hanging colored tee shirt (which is a bit undersized, so I had to add it at an angle).
![]() |
A school building with light brown lockers. I've opened the ones that aren't locked with a padlock. |
Cafeterias
I added a cafeteria to some schools, though it's generally not large enough to fit many students. The minimum size is set so that there are at least three rows of tables. Each row has either a single long table or two shorter tables with an aisle in between. Most building floorplans contain similar sized rooms, which is a limitation. Maybe I should remove walls and merge two or more adjacent rooms into a single larger room? That way it could be used for cafeterias, auditoriums, gyms, etc. Of course I would probably need to increase the ceiling height of these rooms as well. None of this is particularly easy given the way the floor planning code is written and the fact that room assignment is run at a later time when it's too late to change walls or doors.
Cafeterias are similar to mall food courts and use the same table and chair geometry. The main difference is that cafeteria tables tend to be longer than mall tables. Various food, drink, and school items are placed on these tables. This includes cans, bottles, cups, pizza boxes, bananas, plates, silverware, vases, books, and laptops. There's also a clock on the wall. Now that I'm writing this, I think I'll add larger cylindrical trashcans to the corners of the cafeteria.
Cafeterias always have some type of tile floor texture that's easier to clean than carpeting. The rest of the school has randomly either carpeted or tile floor.
Teacher Lounges
Teacher lounges are basically the same as the lounges found in some office buildings. They have a central table with chairs, one or more couches, and optionally a refrigerator, a vending machine, and a wall mounted TV. Here we have the opposite problem to cafeterias: The rooms are too large. I should probably add more items to make use of the extra space. Or maybe place teacher lounges next to cafeterias and move the wall so that half the lounge size is added to the cafeteria? This won't work in general though because there are multiple teacher lounges and only one cafeteria.
![]() |
Teacher lounge with couch, tables, chairs, bookcase, vending machine, refrigerator, and wall TV. |
Libraries
The final room type I've added to schools is libraries. Well, that's not really true. Schools have restrooms, offices, utility rooms, and server rooms as well. What I really meant to say is the final school-specific room type is libraries. Except that some office buildings have libraries as well. Anyway, this is the final type I'm going to discuss in the current post.
Libraries have the expected stacks of books in the form of bookcases against the walls. They also have normal office furniture such as desks, tables, chairs, and filing cabinets. Sometimes they're small, such as the library in the screenshot below. I'm adding libraries last since they're optional, so they only get assigned to rooms that haven't been set to some other purpose. This means that they don't have much selection based on room size, and some smaller schools have no libraries.
![]() |
A small school library with bookcases, desks, a computer, and a filing cabinet. |
That's as far as I've gotten with schools. There are still some room types that I want to add later, especially if I can get more control over room size and height. It would be nice if I could find a way to add procedural writing on blackboards as well.
The code can be found in my GitHub repo here.