The use of game technology for building virtual learning environments is intended to improve the motivation and engagement of the student, borrowing such properties from their entertaining counterparts. Nevertheless, wrapping pedagogical contents in a virtual environment is no simple achievement, and requires a rigorous process of designing and validating the metaphors and mechanics included in the virtual learning system. In this paper we describe such design process exemplified in the construction of consecutive versions of ViRPlay, a 3D role play virtual environment for teaching object-oriented design. We show how main mechanics were transferred from experiments in the real world and how such mechanics were evolved based on empirical evaluations. Copyright © 2011 John Wiley & Sons, Ltd.