FinderScope
- 2 Devlogs
- 10 Total hours
A constellation identification game.
A constellation identification game.
finderscope v2: camera + neighbours
I wanted the zoom to actually feel like looking through a scope rather than a bounding-box crop, so this session was about two things: a fixed camera FOV, and pulling in neighbouring constellations so there’s context around whatever you’re meant to be naming.
v1 fit the canvas to the target constellation’s own bounding box, which meant every constellation filled the frame regardless of its real size on the sky. Crux and hydra looked the same scale, which defeats the point of a “how much can you see” difficulty system.
So, I fixed it by switching to a constant angular field of view instead. stereographic projection has a neat closed-form relationship between angular separation from centre and projected radius: rho = 2 * tan(theta / 2). so i just pick a FOV in degrees, work out what radius that maps to, and scale the canvas to that instead of to the data.
for each constellation, check every vertex’s angular separation from the target’s centre (reused the same cosc term from the projection maths, just wrapped in acos instead). anything with at least one vertex inside a 55° radius gets pulled in and drawn dim, target stays bright and thicker so there’s no ambiguity about what to actually guess.
I tested both of these in node before touching canvas, specifically against Oct and UMi since anything near the celestial poles is where stereographic maths tends to fall apart.
octans pulls in 37 neighbours at the current radius because it’s so close to the pole. Everything nearby just looks angularly closer than it would elsewhere on the sky. That’s fine for now, but medium/hard difficulty will look like a mess down there unless i either shrink the include radius near the poles specifically or cap how many neighbours actually get drawn.
Firstly - yes, I have 6 hours on this, because I switched ideas midway (so essentially 2 hours of work gone lol)
i was mid-attempt at memorising all 88 constellations using some app, got through easy mode fine, then hit a paywall the second i wanted the other two difficulties. so, obviously, I’m building my own cause nobody should have to pay for something as simple as this.
the idea is a constellation naming quiz. it zooms into a random constellation somewhere in the sky, you guess what it’s called, and there’s three difficulties depending on how many of the surrounding constellation lines you get to see (all of them, just the neighbours, or none). eventually there’ll be a learn mode too that splits northern/southern sky and gives you the actual mythology name alongside the IAU one.
started with v1 today: just getting one constellation to render and project correctly, no game logic yet.
turns out there’s no NASA-style API for “here’s every constellation’s star positions and line segments,” so i pulled from d3-celestial, an open source star chart project on github. grabbed:
constellations.lines.json — RA/dec coordinates for every line segment in all 88 constellationsconstellations.json — names, including an en field with the actual mythology name (canis major → “great dog”, that kind of thing)wrote a python script to slim both down into one dataset per constellation: id, name, en, a precomputed centre point, and the line coordinates. centre point was its own small problem — you can’t just average RA values because of the 0°/360° wraparound, so i averaged everything as unit vectors on the sphere instead and converted back. way cleaner.
the actual hard part. “zoom into a random constellation” means taking a patch of sky centred wherever that constellation sits and flattening it onto a canvas. went with a stereographic projection, standard formula, centred on each constellation’s precomputed centre.
tested the maths in node before touching canvas at all — ran orion through it and checked the projected bounds didn’t blow up or do anything weird near the pole. glad i did that first, would’ve been a nightmare to debug visually.
canvas side just auto-fits whatever bounding box comes out of the projection, so it works whether the constellation is tiny (like crux) or sprawling.
some of the constellation names/lines from the dataset are a little wrong — going to go through and fix those manually rather than trying to patch it in code.