Hacker News new | past | comments | ask | show | jobs | submit login

This game is quite simple in how it uses the Atari 2600 hardware. Atari Hardware can draw exactly 6 things on a scanline: Playfield, Ball, Sprite 1, Sprite 2, Missile 1, Missile 2. So Adventure made the player be the Ball, the thin walls (seen on two rooms) be the missile, and two of game objects become the two sprites. There is also the torch-light sprite that can take the place of one of the game objects in dark rooms, drawn behind the background.

The game makes no attempt at all to re-use a sprite slot for another sprite appearing further down the screen. It's just two sprites, then no more.

The game also uses the hardware's pixel-level collision detection to check for collisions rather than bounding boxes, so when the sprites are flickering, they cannot collide with the player. But collision detection is not the only way that objects can interact, there's also the Bat and Magnet, or the dragons having objects to guard/run away from. The bridge also makes the game ignore player collisions for a particular bounding box inside the bridge.







Adventure kept it small mainly by indirection. Each room has a pointer for its graphics, 4 exit locations, and the color/darkness flags. The game doesn't need to do anything special to handle most rooms, so that keeps the code size pretty small. And because it's using pointers to graphics data, room data can even start in the middle of another room's data, so things like a bottom barrier can become a top barrier in the next room to use that data.

The only real time you need to handle things specially is that some room exits are conditional based on whether Game 1 is selected or not.

Because it was so simple to reuse the rooms, there was enough empty space in there for the Easter egg. The "Created by Warren Robinett" sprite alone is a whopping 96 bytes of sprite data.

But you don't need all that much special code to get the Easter egg into the game. You define one additional room that reuses an existing room layout, and add one more sprite to the list of sprites. The sprite is pre-placed in the new room, as defined by the data that initializes all the game objects. The code for the dot mostly uses the existing code for objects, you can pick up and drop objects already, and the dot is no different in that respect. There is a little bit of added code for removing the right side barrier when it's in the correct sprite slot (easy to happen when three objects are in the room), and there's also a little bit of extra code to override the right-side exit for the room.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: