Building a test street of every look and finding why 180 buildings were slow
The test street now holds thirty buildings of every look, up to 180, and two settings made them playable instead of a slideshow.
The test street for the buildings now has a district of thirty for every look: steampunk, house, fantasy, eldritch, cyberpunk and meat. That is 180 buildings once all six are installed. Today only steampunk and house are, so 60 are laid. Laying all 180 first ran at 4 to 10 frames per second, and two causes, neither of them the number of buildings drawn, were behind most of it.

How is the street laid out?
Each district is the same thirty recipe requests in five rows of six, with its own look and its own seeds. Every plot is one building cell, set on the highest ground under its footprint, with a label, and each district has a tall sign naming its look. The districts sit 24 m apart on flat ground. The code finds that ground by sampling the height on an 8 m grid, sliding a window the size of a district across it, and measuring the best windows again every 3 m.
The keys 1 to 6 go to a district, 0 looks over all of them, 9 goes to the nearest, and Page Up and Page Down step through every plot. I wanted thirty of each style, to play and not only to watch a film.
A look with nothing installed is skipped whole with one printed line. A plot whose look lacks a member is tried with a dry lay before its cell is built, and skipped with a line naming what is missing. So fantasy, eldritch and cyberpunk, which are being installed, and meat, which is in revision, will each appear on their own.
Why were 180 buildings so slow?
I measured with steampunk members standing in for every look, so there were 180 real buildings. The first build ran at 4 to 10 fps over a district. Hiding districts beyond 420 m and switching off their processing gave only about 10%, so the cost was not mostly in what was drawn.
The first cause was the shader instance buffer, which overflowed at 65,536 with this many buildings. I raised rendering/limits/global_shader_variables/buffer_size in the project settings to 524,288, which costs about 8 MB.
The second cause was in flying. The exploring controls ask WorldScene.waters() for the sea level on every physics step, and that function walks every mesh under the world node. With the buildings under that node, every building mesh was in the walk. Moving them under the level node took flights from 5 fps to 35 to 65 fps.
What is left?
The doors still update every frame however far away they are (LV-197). A batch merge of the building meshes would help if towns grow (LV-198). The sea-level call is avoided and not fixed (LV-199).
Numbers
- Standing in the street: 32 to 71 fps. Over a district: 43 to 68. Over all of it: 66. All measured with steampunk members standing in for every look.
- The scene is ready in 28 s.
- Hiding far districts: about 10%.
- 6 districts of 30 buildings, 24 m apart, hidden beyond 420 m. Laid today: 60 of 180.