Skip to content

Instantly share code, notes, and snippets.

@DanBradbury
Last active October 20, 2020 23:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanBradbury/947b5cce8aa3981d9fc2 to your computer and use it in GitHub Desktop.
Save DanBradbury/947b5cce8aa3981d9fc2 to your computer and use it in GitHub Desktop.
Episode 5 Full

Side scrolling in GameMaker can be implemented with little effort. In this episode we take a step back from 2014 and take a look at how a 2d side scrolling games were implemented 20 years ago. Due to limited hardware, developers had to use smart memory management techniques to create the games that they wanted. In the 80s the best games were being made for consoles like the NES since they could support memory on the game card. In the early 1980s the standard graphics card for PCs; the CGA was not capable of even creating a satisfying 2d side scrolling effect. The Color/Graphics Adapter was IBM's first graphics card with a max resolution of 640×200, and support for 16 colors, and 16 kilobytes of video memory.

For a more more details on the CGA read on here.

This card did not have the capabilities to create the smooth side scrolling effect that NES and Sega gamers were already accustomed to.
It wasn’t until IBM’s second generation graphics card(the EGA) was released for a believable scrolling effect to be created on the PC. The guys over at id Software; John Carmack and John Romero decided to throw together a small one level clone of Super Mario Bros. 3 for PC called Dangerous Dave Copyright Infringement.

Some folks mention a Batman Game that came out in 1989 to coincide with the movie for DOS. But as noted there is a choppiness on whenever the side scrolling effect is used. So ha!

Dangerous Dave was nothing but a Mario clone made as a proof of concept for the PC. The game marked the first successful side scrolling effect on the PC, and is an impressive implementation given the limited hardware.

The idea was to demonstrate to Nintendo that the small team could port Mario to the PC with the same look and feel that was expected from the NES. After the demo was completed (in a week) it was sent off to Nintendo; Nintendo declined to have the team make a PC version but was impressed by the successful smooth scrolling they had accomplished.

The method designed by Carmack is called Adaptive tile refresh. At a high level the technique is used to seamlessly refresh all moving tiles and transition in new tiles that are being stored in a buffer. For an added bonus Carmack implemented double buffering to eliminate the flicker and tearing that was common among previous side scrollers on the PC.

The massive improvements made on the EGA; supporting 16 simultaneous colors from a 64 color palette and an improved memory mapping that made hardware computations possible. For those bold enough, read about CGA's memory issues (TLDR; odd pixel vertical scrolling near impossible due to the hardwares design for characters & not graphics)

With the hardware features Carmack was able to keep track of a 64 pixel buffer that held 1 block wider than the level. Whenever movement occurred the buffer could be drawn in 1 pixel increments and create a seamless scrolling effect. While this handled the edges there was still an issue of creating a smooth scroll effect for the rest of the screen. In order to complete the effect the code calculated which tiles had been affected by the movement and redrew them. Since there would be a brief pause when the tile was being redrawn Carmack’s double buffered implementation made sure that the redrawing was accomplished as cleanly as on the consoles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment