KyleDSwarner / puzzles-reloaded

MIT License
5 stars 0 forks source link

BUG: Boats in Boats appear & disappear as you interact with the game #11

Closed themowski closed 1 month ago

themowski commented 1 month ago

iPhone model: 13 mini iOS version: 17.6.1 App version: 1.2.1

When playing Boats, the rendering of the boats on the game grid and in the bottom "available boats" area tend to disappear & reappear as you play. I've noticed this primarily with the size-1 boat indicators while playing on "6x6 size 3 easy" difficulty. Everything still seems to function and the game can still be won, but the constant appearance & disappearance is very distracting.

This is probably an upstream issue, but I haven't built/played the x-sheep puzzles so I can't say for sure.

Here's an example of this type of behavior that I've been able to reliably reproduce:

  1. Tap once to place a boat in the middle of an empty 3x3 area of the grid
  2. Starting with the left-center of the 3x3 grid, working counter-clockwise, and ending at the upper-left, mark the 8 border cells around that boat as water by tapping them twice in a row (first tap turns it "on", second tap makes it water).
  3. Result: The center boat disappears completely after you turn the last tile from "boat" to "water".
  4. While in this broken state, use Menu > Restart. One of the size-1 "available boats" indicators at the bottom of the screen disappears completely.

As noted, there are other scenarios where the "available boats" indicators disappear, typically with the size-1 boat. Based on the steps above, I think it's mainly scenarios where you are marking the border around a size-1 boat as water by tapping twice (instead of long-pressing).

KyleDSwarner commented 1 month ago

Thanks for the report. Confirmed I can reproduce - thanks for the detailed steps!

I suspect this is due in part to upstream code, but could also be a side effect of how I'm rendering the puzzles in the app (I'll spare you the gory details). I'll review a bit more and take a look at the upstream code.

KyleDSwarner commented 1 month ago

OK, this is something that is fixable in app for now with some additional exploration in the future.

Since the puzzles are rendered as a flat bitmap, the app has to build its UI using stacking layers. You can't just erase something - you overlay a box on top of it with the background color.

Typically we'll wait until the puzzle tells a section is done drawing & refresh the bitmap all at once, but some various bugs throughout a few games means I force refresh the entire bitmap (thankfully a very cheap call on iOS) after specific draw instructions

What's happening here is that I'm refreshing the image after the "erasing" square is drawn over one of the boats. After that, the circle is being redrawn - but there's no bitmap update call after that point - so as far as the user knows there was never a circle until we interact with the puzzle again and the puzzle updates properly.

Turns out it's an easy fix - just extend the force update to include the circle drawing method. And added bonus, this will resolve #13 as well. I'll add it to release 1.3 and the next testflight!

themowski commented 1 month ago

Great news, I'm glad that you were able to get these resolved -- will definitely make the experience a lot smoother.

KyleDSwarner commented 1 month ago

These changes (and all the other issues) are live in testflight, if you'd like to help test out: https://testflight.apple.com/join/WTgP9Te4

No pressure! I'll test and if I find no issues get it released to the app store in the next few days.

KyleDSwarner commented 1 month ago

Issue fixed in 1.3 and released to app store. Closing as complete!

themowski commented 1 month ago

I've been using 1.3 since launch, and so far Boats seems to be rendering a lot more smoothly/consistently. I haven't seen any instances of this or any other visual glitches (same with Clusters / #13 ). Nice work, thanks!