Finding Pixel Flow levels with a 768-bit RGB pHash visual search
Source: Dev.to
I’m a big fan of the game Pixel Flow, but I often find myself getting completely stuck on specific levels. Because it is a purely visual grid game, you cannot simply search for a solution using text. To solve this, I built a reverse image search engine specifically designed to find level solutions based on a screenshot.
Technical Approach
Multi-Channel pHash (Per-Channel RGB)
- Compute a perceptual hash for each RGB channel separately, preserving color information that is crucial for grid‑based puzzles.
Combining into a 768‑Bit Fingerprint
- Concatenate the three 256‑bit channel hashes into a single 768‑bit fingerprint that uniquely represents the full‑color layout of a level.
Hexadecimal Compression
- Encode the 768‑bit fingerprint as a compact hexadecimal string to reduce storage and transmission overhead.
Fast Hamming Distance Matching
- Use Hamming distance calculations on the compressed fingerprints to quickly identify visually similar levels with minimal computational cost.
Displaying the Top 6 Matches
- Retrieve and show the six closest matches from the database, allowing players to find the exact solution they need.
I’d love to hear your feedback on this! Are there more efficient ways to handle color‑sensitive image hashing for grid‑based games?