The Last StarfighterThe Last Starfighter is a 1984 science fiction movie or its subsequent novelization that year by Alan Dean Foster, or a video game based on the movie.
The movie was the first major movie to use extensive computer graphics to depict real objects in place of models.
Warning: Wikipedia contains spoilers
Alex Rogan is a teenager living in a trailer park who becomes the best player ever at Starfighter, a stand-up arcade game that has him "defend the Frontier against Xur and the Ko-Dan armada." But the game itself is actually a training device; the night after he beats the game, an alien named Centauri recruits him as a fighter against the enemies mentioned in the game. While serving as a starfighter himself, he's replaced on Earth by a synthetic android known as a Beta unit. Alex is refused the right to fight the first time since he is human and is due to be piloted home by Grig, a reptilian humanoid.
Soon after Alex and Grig have departed the Frontier base, it is destroyed in a sneak attack by Xur and the Ko-Dan. With apprehensions about the armada one day reaching Earth, Alex volunteers after a Ko-Dan operative is spotted in his own town with instructions to kill him, but the Beta unit is destroyed instead. Alex pilots and Grig navigates an experimental Frontier fighter known as a gunstar and defeats the Ko-Dan armada, with Xur escaping to fight another day.
Alex returns to Earth again, but he reveals to his family and friends that he's been recruited to help rebuild and defend the Frontier, and this time his girlfriend Maggie goes with him. The movie and the book end with Alex's younger brother Louis preparing to play the Starfighter game.