In a riot, people damage the environment of themselves and others. Due to the difficulties of measuring violent behaviour, the roles of factors thought to lead to rioting are hard to discern. We investigated the psychological roots of rioting using innovative experimental techniques. We created a game, ‘Parklife’, that co-present participants played using smartphones. In two teams, participants tapped on their screens to grow trees and flowerbeds on separate but adjacent virtual parks. Participants could also tap to vandalize the other team’s park. In some conditions, we surreptitiously introduced inequality between the teams so that disadvantaged teams had to tap more for each reward. The experience of inequality caused disadvantaged teams to engage in more destruction, and to report higher relative deprivation and frustration. Our lab-based experiment provides direct insight into the psychological mechanisms underlying collective violence, and supports previous observations that relative deprivation plays a role in riots.