Every day, more people are interested in learning computer science (CS), either to improve their skill set to apply for new jobs or just for personal growth. The sector of the population looking for instruction on these subjects has increased and diversified. We need new tools that appeal to this wider audience, and game-based learning is one of the most promising approaches at the moment. There is a need for more scalable game-based instruction paradigms that can be easily adapted to different levels of complexity and content related to CS (different programming languages, different programming paradigms, and so on). Throughout this paper, we present a flexible and scalable architecture to create videogames for learning CS languages. The architecture is based on the idea that students control the game using small pieces of text written in some CS language. The keys of the scalability of our approach are: 1) it separates the CS language used to write the programs from the game design and 2) the game model provides a system of levels that allows incremental learning of CS language structures. As validation and implementation of our approach, we developed Lost in Space, an educational videogame to teach the XML markup language. In this game, the player travels through several levels, guiding a spaceship by introducing small pieces of XML in a text console. Players can move and rotate the ship among other power-ups that get unblocked as they advances in the game. The game was tested with undergraduate students from CS and social sciences, by comparing it with traditional instruction (i.e., a teacher with a slides presentation). Students who played the game were much more engaged than those who attended the lecture, showing a more active attitude throughout the whole experience and also spent more time practicing after class. Findings also suggest that the game was effective for instruction, regardless of the background of the students. However, the educational gain observed with the game-based instructional approach, although effective, was not significantly higher than traditional instruction. We think that our approach is adequate to introduce CS languages in general, as well as new programming languages, and seems to be more appealing to new comers than traditional instruction.