  During their formation and early evolution, rocky planets undergo multiple
global melting events due to accretionary collisions with other protoplanets.
The detection and characterization of their post-collision afterglows (magma
oceans) can yield important clues about the origin and evolution of the solar
and extrasolar planet population. Here, we quantitatively assess the
observational prospects to detect the radiative signature of forming planets
covered by such collision-induced magma oceans in nearby young stellar
associations with future direct imaging facilities. We have compared
performance estimates for near- and mid-infrared instruments to be installed at
ESO's Extremely Large Telescope (ELT), and a potential space-based mission
called Large Interferometer for Exoplanets (LIFE). We modelled the frequency
and timing of energetic collisions using \textit{N}-body models of planet
formation for different stellar types, and determine the cooling of the
resulting magma oceans with an insulating atmosphere. We find that the
probability of detecting at least one magma ocean planet depends on the
observing duration and the distribution of atmospheric properties among rocky
protoplanets. However, the prospects for detection significantly increase for
young and close stellar targets, which show the highest frequencies of giant
impacts. For intensive reconnaissance with a K band (2.2 $\mu m$) ELT filter or
a 5.6 $\mu m$ LIFE filter, the $\beta$ Pictoris, Columba, TW Hydrae, and
Tucana-Horologium associations represent promising candidates for detecting a
molten protoplanet. Our results motivate the exploration of magma ocean planets
using the ELT and underline the importance of space-based direct imaging
facilities to investigate and characterize planet formation and evolution in
the solar vicinity.
