The Portal video games have been revolutionary not just for their puzzle-based, narrative-driven gameplay, but additionally for his or her distinctive physics engine, which let gamers open portals wherever and preserve momentum and course by way of them. They’re extensively considered among the finest video video games ever made, however even past that they’ve some additional options that aren’t talked about as a lot. Particularly, there are a variety of degree editors and mods that permit the in-game parts for use to construct issues like logic gates and computer systems, and this undertaking goes even additional by constructing a working NES emulator, all inside Portal 2.
The principle limitation right here is that Portal 2 can solely help a sure variety of in-game objects with out crashing, far decrease than what could be wanted to instantly emulate NES {hardware}. The creator of the undertaking, [PortalRunner], as an alternative turned to Squirrel, the Portal 2 scripting language, and set about porting an current NES emulator referred to as smolnes to this scripting language. That is simpler mentioned than completed, as every thing within the code must be transformed eight bits after which all the pointers in smolnes should be transformed to make use of arrays, since Squirrel doesn’t help pointers in any respect. As could be simply imagined, this led to quite a lot of bugs that wanted to be sorted out earlier than the sport would run in any respect.
For these curious about code {golfing}, porting, or cross-compatibility, this undertaking is a grasp class not solely within the intricacies of the Portal 2 scripting language however in the way in which the NES behaves as effectively, to not point out the coding talent wanted to acknowledge distinctive behaviors of the C language and the Squirrel scripting language. However ultimately [PortalRunner] is ready to get Tremendous Mario Bros. operating in Portal 2, albeit with low decision and body fee. Since we heard you want video games inside video games, another person put DOOM inside DOOM so you’ll be able to DOOM when you DOOM.
Because of [Mahdi] for the tip!