Elder Game: The flying animal fiasco

From Project: Gorgon Wiki
Jump to: navigation, search

This Blog Post was part of the Elder Game blog. It was posted by Citan on April 24, 2013.

Previous Post: Elder Game: Grab Bag Update: Web Player, Skill Swapping, Languages
Next Post: Elder Game: What is Lag?

Additional Blog entries can be found on the Developers page or in Category:Game Blogs

Thought I’d do a short post about an amusing bug. It’s actually been happening occasionally for a while, but after a recent update it became pretty much 100% of the time: certain monsters, like great cats, would charge at you, ready to attack, then leap forward — and instead of landing, they would simply fly right over your head, and keep on going up into space.

Wait, panther, we were fighting! You can't just fly away!

This took an entire day to track down, but here’s what happened. First, the panther’s physical body is really just a sphere-ish kinda shape:

The green circle is the cat's physics -- where it can collide with things.

When it comes time to move the monster around, the graphic of the cat is unimportant. The invisible sphere is what moves around, and the graphics are just drawn on top so you can tell where the heck it is.

The problem came on the server. The server doesn’t bother with the cat graphics at all — why should it? But without any graphical shape, it’s extremely hard to debug. So when I was first debugging the server, I made it draw a little capsule overtop each creature.

This is that same cat, as seen by the server's debug-viewer

So what went wrong? Somewhere along the way, I must have mis-clicked in Unity, and I gave that little white capsule physics — it became tangible. This meant the cat had two physical forms: the sphere and the capsule. They were both “the cat.”

When the cat wanted to pounce on someone, it moved the green sphere toward them. But then it noticed it was “bumping into” the capsule representation of itself. It decided “oh, I’m standing on something,” not realizing that it was standing on itself! So then it tried to climb over the capsule, which is impossible since they were connected. As soon as the sphere moved, the capsule moved with it.

So the poor cat just kept climbing up its own capsule, often for miles, until it would twist and turn in a way that didn’t register as being “on top of” the capsule for a moment. At that point, it would plummet out of the sky. This is why some players reported seeing monsters hurtling toward them like meteorites.

As soon as I made the capsule intangible, everything was fine again. It just took hours to find the problem.

Well, on the bright side, at least some cats and pigs got to see outer space.