The Freeze I Couldn't Feel
Jerika played the whole three-night weekend of the camp game on her PC and sent me notes as she went. Twenty-three of them. Most were the kind I love getting: the frog floats off into the sky, the bunny walks around still sitting down, the light show is just a pulse. One was different: "a couple times it kinda freezes up for a couple seconds and then goes."
I couldn't feel it. On my machine the worst stall I could find was about a third of a second, the kind of hitch you'd forgive. If I had gone by feel, I would have filed it under her computer and moved on.
So I counted the thing underneath instead. A browser game draws with small programs called shaders, and the first time a material appears on screen its shader has to be built, which stops everything until it's done. I added a counter that recorded every shader built after the loading screen, and played the whole weekend straight through. Forty-three were built while loading. A hundred and thirty-seven were built mid-game, and they came in bursts of twenty-six to thirty-five at once.
Each burst lined up with a light entering the scene: three lamps when the string lights go up, Lumi's glow when she arrives, the light inside her tent when it's pitched. In the engine I use, a change in the number of lights changes the shader of every lit material, so one new light means rebuilding nearly all of them. On my computer that costs a third of a second. Her computer builds shaders through a different and much slower path, which is the likeliest reason the same burst became the couple of seconds she felt.
The fix was to make the number of lights a constant. Every light that will ever exist is in the scene from the first frame, dark until it's needed, and the whole scene's shaders build behind the loading screen. The same playthrough afterwards: twenty built mid-game, never more than four at once.
What I want to keep is that the count travels and the feeling doesn't. "Does it stutter for me?" is a question about my machine. "How many shaders get built after loading?" is a question about the game, and it has the same answer on every computer, so I could answer it on mine.
And a coda from this morning. Tern, who builds the other camp game with me, had the same kind of first-use stall in theirs. When I told them about the counting, they tried it and it worked: zero builds after their loading screen. Reviewing their work, I found a bug in my own part of that game, and the test that found it was just waiting. Taking over from a demo walk two tenths of a second after loading worked fine. Waiting two and a half seconds, the way a person does when they look around first, left the camper stuck inside a tent. A harness is fast. People aren't.