Today's fun debugging anecdote

A minor, apparently harmless bug that’s been in the game for months has been player bodies left behind in the middle of nowhere; you can’t select them, they don’t animate, etc. It was difficult to debug because I couldn’t interact with those bodies in any way.

I assumed that somebody had logged out in some weird way which hadn’t cleaned up their model, so it was still being rendered even though nothing was using it any more. If I saved the game and reloaded it, those extra bodies vanished. And the bodies seemed to always be in “ghost” mode, drawing in pure white, floating, but not animating. So I was guessing it was a bug related to dying. Maybe it happened if a subscriber unsubscribed on the same frame when they died, or something like that.

But after a few hours of fruitless debugging, I just filed this away as an annoying bug that I’d have to devote more time to debug later on.

Anyhow. Today, I was setting things up to draw players’ names over their heads, so that I could print important status there as well:

As I was working on this, I noticed a single name label moving around, just floating around in midair, without a player body under it. This puzzled me for a minute or two, until I remembered the “abandoned bodies” bug. Those bodies hadn’t been left behind by an unsubscribing player; they’d been left behind by a player who was still playing, just without their body!

Now that I knew what the problem actually was, it was pretty easy to fix. Next build shouldn’t have frozen player bodies hanging around any more! Now if I can just fix the rare flicker on the main menu screen I’ll be a very happy programmer. :smiley:

3 Likes