In order to facilitate analyzing video games as learning systems and instructional designs as games, we present a theoretical framework that integrates ideas from a broad range of literature. The framework describes games in terms of four layers, all sharing similar structural elements and dynamics: a micro-level game focused on immediate problem-solving and skill development, a macro-level game focused on the experience of the game world and story and identity development, and two meta-level games focused on building or modifying the game and on social interactions around it. Each layer casts gameplay as a co-construction of the game and the player, and contains three dynamical feedback loops: an exploratory learning loop, an intrinsic motivation loop, and an identity loop.