Work / 2048 Drop
I gave a puzzle game
real ray tracing.
2048 Drop is a drop-and-merge game where the pieces are glass. You drop a cube into a recess in a sunlit wall, and when two of the same number touch, they merge into the next one. They’re solid things, too. They bounce, tumble and lean on each other, and one merge can tip the pile into the next.
On iPhone 15 Pro and newer, all of that glass is ray traced, every frame. It’s coming to iPhone and iPad. No date yet.
Then one day you make 2048.
And time slows down so you can watch it happen. That’s not the end, either. Keep going and you get to find out what an 8192 does.
- How it plays
- Drag to aim, let go to drop. One finger. Chain merges and the score multiplies.
- Daily Drop
- One run a day where everyone in the world gets the same cubes in the same order. You get one scored attempt.
- Sound
- Every clink and every merge is a recording of real glass. Headphones help.
- Game Center
- Seven leaderboards and 14 achievements, some of them hidden.
- Devices
- iPhone and iPad. On the iPhone Duo it follows the hinge: stand it up like a laptop and the pile reflects in the half lying on the table.
- Price
- Free, with no ads, ever. One optional purchase adds two more themes and two more icons.
- Privacy
- No account, no tracking, nothing collected. The details are on the privacy page.
Three times of day.
A theme is the same wall at a different hour. Golden Hour is the one you start with. Sunset warms the whole thing up. Obsidian keeps the daylight and swaps the sill for polished black stone, so the pile gets a reflection.
The cubes aren’t meshes.
The refraction is computed per pixel on the iPhone’s ray tracing hardware. Light bends through each cube, picks up its color on the way through (Beer–Lambert absorption), and lands on the wall behind it as a colored shadow.
Each cube is a signed distance field, and the ray marches along it to find the true rounded surface. So the edges are mathematically round instead of faceted, and the code knows exactly how far light traveled inside the glass.
At the edges and corners, a six-wavelength spectral fan splits the light into visible prism fire. Only there, because that’s the only place real glass does it.
For a while the cubes looked like they had square corners, which is not great on a game whose whole bit is realistic glass. I went after the geometry twice. Didn’t fix it either time. So I built a debug mode that paints every bounce of every ray its own color, and the edges came back perfectly round. The geometry had been fine the whole time. Right at the edge of a cube, glass basically turns into a mirror, and there was nothing off to the side for it to reflect, so the rims went black. And a black outline looks exactly like a hard corner. The fix was hiding a couple of studio lights just out of frame, which is the same trick product photographers use to give glass clean edges.
- Renderer
- Metal, hardware RT
- Ray traced on
- iPhone 15 Pro and newer
- Older phones
- Full SceneKit path
- Physics
- SceneKit