It was a dark and stormy night...
No, not really. Although the morning certainly started off cold!
Bugs, Bugs, and um... Bugs
Today was full of bug fixing, which I expected going into it. The day started off with implementing the final part of the "grabber dragged along" mechanic: Slowing the speed of the target's movement.
Things were going quite well, until this happened:
I spent most of the morning fixing this fun little bug, and part of my lunch break too! The problem wound up being related to storing the grabbing direction and the movement direction as two separate states.
Storing them separately wasn't the problem, necessarily. However, the code that handles dragging the grabber behind his target was using the wrong one!
To recreate the problem, you had to first grab another character. Let's say that you grab them while facing north, like in the animation above. You then press the down arrow key to "move" south. Because you are grabbing another character, you don't move. But! Your character's movement direction is still updated. When the character you grabbed tries to move, you'll be "dragged" in the direction you are "facing"... South!
The Internet Destroys Everything
The latter half of the day consisted of lag testing. This involved deploying to the staging site, and then seeing how badly latency would affect the new grabbing mechanics.
Sadly, it was pretty bad. One bug which I spent four hours solving was allowing characters to run right by grabbers. If there was enough lag, you could run right by another character who was trying to grab you.
This was being caused by some code in the server which would correctly grab the character, but then immediately cancel the grab! I added some additional checks, and the glitch seems to have been resolved.
The last bug I ran into, and the one which I didn't manage to fix, is demonstrated here:
If you have three characters, with two of them grabbing two others in a row, the last one in the chain will disappear when switching maps! I suspect the "caboose" is being teleported into the map's border, but I have yet to prove that theory.