Rotunda

A first-person walk through the Pantheon in Rome. Start in the Piazza della Rotonda among the pigeons, climb the cordonata ramp to the portico's raised terrace, pass between its granite columns, and take the seven planetary sigils from the rotunda's niches. One sigil waits on the raised floor of the apse, at the top of a ramp. With all seven, stand in the sunbeam that falls through the oculus. The faster you finish, the higher your score.

Controls:

What to watch for:

How it renders #

The level is a flat plan of wall segments: the rotunda drum with its seven niches, the entrance, the portico, the piazza facades, and 28 columns and the obelisk as small polygons. At startup the component compiles them into a binary space partition (BSP). Each node splits the plan along one wall's line and stores the walls on that line, and walls crossing a splitter are cut in two.

Each frame walks the tree front to back from the eye. At a node, the subtree on the eye's side is drawn first, then the walls on the splitter, then the far subtree. Each screen column keeps the first wall to reach it, so no depth sort is needed, and the walk stops once all 640 columns are filled. Press M twice to see that order on the map: bright walls were reached first, and dim walls faced away or were never needed.

The floors are sectors, as in Doom, each with its own plane, so a floor can be raised, lowered, or sloped. The piazza sits 1.5 m below the terrace, the cordonata slopes between them, and the apse floor is 0.9 m up its own ramp. Two-sided step lines (orange on the map) mark where sectors meet. They go into the same BSP as the walls but never claim a column. Instead, each column records the step lines it crosses on the way to its wall. Drawing the column from the bottom up, each crossing ends the floor in front of it and, where the far floor is higher, adds a step face. Anything hidden below what is already drawn is skipped.

Floors, ramps, the coffered dome, the oculus, and the sky are cast per pixel from each column's ray, intersecting it with the plane of the sector it is crossing. Looking up or down shears the view, as in Heretic and Duke Nukem 3D: the horizon row moves and walls stay upright. One sun direction, worked out each frame from the hour angle, the date's declination, and Rome's latitude, lights everything: the disc and its glare in the sky, the sunlit faces on the piazza, and the beam. A point is in the beam when its line to the sun passes through the oculus. The glowing dust is how far each view ray travels through that slanted column before it hits something, so the shaft shows from the side and still looks right from inside it. Points in the beam check whether a bird sits on their line to the sun, which gives the birds their shadows.

Each pixel also records its depth, so the birds and sigils are drawn behind nearer walls, floors, step faces, ceilings and the dome. A bird above the building shows through the oculus or above the piazza's rooftops and nowhere else. The same tree answers the game's other geometry questions: line of sight and collision. Step lines are ignored there, and the floor height decides instead whether a move is a step up, a ramp, or a drop. A jump raises the player's feet, and with them the height they can step onto. Pigeons walk with the same collision as the player. Every flight is a series of straight legs and arcs planned to stay above the walls or inside the rotunda, and a test follows every bird for three minutes to check that none crosses a wall or roof except through the oculus.

Rain is a few hundred drops falling at about 9 m/s: one set in the column under the oculus, and one over the open piazza within 15 m of the player. The view is sheared rather than tilted, so verticals stay upright and each drop is a short run of rows in one screen column. Like the birds, each drop is checked against the depth of every pixel it covers, so it shows in front of the dome and walls but not through them. Drops landing near the player splash. The column's mist is worked out like the sunbeam's glow, from how much of the column each view ray crosses before it hits something. A single water level stands for the puddle: rain raises it, and the drains take away a share of it every step.

The component simulates fixed 16 ms steps before the events in each update. A late update runs at most eight steps and then drops the rest of the backlog. The title, pause, and end screens request no wakes. Only render writes the 640 by 480 KTX2 frame.