Ender's Game
(2013)

Ender (Asa Butterfield) is told to run one last simulated battle against the Formics before he will be promoted to Commander of the Fleet and launch a real attack.

Unbeknownst to Ender or his team, this battle is in fact real, not a simulation. When Ender "wins" by destroying the Formics' home planet, the kids rejoice at their success until they are told the truth. Ender is devastated that he has caused the destruction of an entire species, despite Graff's (Harrison Ford) reassurance that it had to be done.

There is one Formic queen left in the pupal stage, being guarded by the last surviving member of the race. Ender, promoted to admiral and given his freedom and a ship, takes the unborn queen with him to find a new home planet where it can repopulate.

Thanks Ellen!