There's a bunch of software planetariums out there. But nothing else you could build a game on as easily, I think... (yay Godot! :3 )
edit: Also, Stellarium is under GNU General Public License, which means you have to use the same licence in your project if you use their code (i.e., you couldn't sell your game).