Saturday, November 6, 2010

Why fish (sometimes) won't eat

I've been getting e-mail reports off and on for months about how people's fish wouldn't eat, and though I've sat down and looked at it several times I could never figure out how in the world to get that to happen, and nothing I ever changed seemed to change it.

Well, this evening I was attempting to replicate a completely unrelated bug, and noticed my fish wouldn't eat anymore!  Not only that, but I noticed there were some fish flakes floating in the middle of the tank, uneaten.  That's it!

Here's how the fish eat:

1) User double-taps on the screen
2) This calls a function, which checks if there's fish food in the tank already.  If there's no food already present, it drops some fish flakes from the top of the tank, one for each fish.
3) We then check on each of the fish, and assign each fish a fish flake to eat.
4) The fish home in on their assigned food, and when they're close enough they eat it.
5) The fish then go back to wandering.

Now, it generally takes a couple seconds for the fish to get to their assigned food.  This is your opportunity to break it.  BEFORE the fish gets there, bring up the wallpaper settings.  This means the wallpaper goes to sleep, since it's not visible anymore.  Time is paused.

While in the settings screen, change your fish population.

When you exit the settings screen and return to the home screen.  Time starts again.  The preference changed, so the fish are removed and respawned from the new list.  The detail here is that the list of entities isn't cleared -- only fish are cleared/replaced.  Plants, toys, etc are left alone.  This includes the food.

We now have orphaned fish flakes, with no fish assigned to eat them!  These will slowly drift off-screen, so you won't even see them after 30 seconds or so, but they're still there.  Up in step 2, you can see it doesn't do anything if there's already food in the water.  Therefore, no more fish feeding until you reboot the phone or reapply the wallpaper from scratch.

The two-line fix here is to have the flakes remove themselves if they're left alone too long.  That will be in the next update.  You have no idea how long I've been wondering about this one!

No comments:

Post a Comment