Playing video games may improve your mental health and make you happier, according to a scientific study that used industry data from gaming companies to analyze players' wellbeing.

The research by the University of Oxford analyzed the effects of playing two popular video games: Nintendo's "Animal Crossing: New Horizons" and Electronic Arts' "Plants vs Zombies: Battle for Neighborville."

It found that time spent playing the games was associated with players reporting that they felt happier.

But the study was limited to those two titles, and researchers did not explicitly conclude that increased play time was what caused participants to experience better mental health.

"Our findings show video games aren't necessarily bad for your health; there are other psychological factors which have a significant effect on a person's well-being," Andrew Przybylski, Director of Research at the Oxford Internet Institute and the study's lead author, said.

"In fact, play can be an activity that relates positively to people's mental health -- and regulating video games could withhold those benefits from players."

The study used data and survey responses from 518 players of "Plants vs. Zombies" and 2,756 players of "Animal Crossing: New Horizons."

The games' developers shared anonymous data about people's playing habits, and researchers surveyed those gamers separately about their wellbeing.

The approach marked the first time that developers have shared their own data with academics for a major study on the impact of video games.

Previous research on the issue "has almost exclusively relied on self-reports of play behaviour, which are known to be inaccurate," the authors wrote in the study, which was published on the PsyArXiv Preprints platform.

It comes after years of debate about the impact of video games on the mental health of young people, and amid a pandemic that has caused sales of some titles to skyrocket.