A game-based learning team exercise was specifically designed as a teaching tool which aimed to unlock the black box of cultivating student engagement in an online learning environment. In the exercise, online distance learning students were divided into police and prisoner groups whereby they were required to use different resources for catching the prisoners or for escaping from the police on a virtual map. The team exercise helped to create an innovative online learning environment that was active, cooperative, and encouraged student engagement, these being some of the key elements to enhance the quality of student experience. To evaluate the effectiveness of this exercise, an experiment was conducted using survey data from undergraduate students in an online learning environment. Results showed that the online class with a team-based activity had significantly higher scores in students' behavioral engagement than the other online class without a team-based activity while the differences in cognitive and emotional engagements were not significant.