HOME

TheInfoList



OR:

Adaptive tile refresh is a
computer graphics Computer graphics deals with generating images with the aid of computers. Today, computer graphics is a core technology in digital photography, film, video games, cell phone and computer displays, and many specialized applications. A great de ...
technique for
side-scrolling video game '' A side-scrolling video game (alternatively side-scroller), is a game viewed from a side-view camera angle where the screen follows the player as they move left or right. The jump from single-screen or flip-screen graphics to scrolling graphic ...
s. It was most famously used by
id Software id Software LLC () is an American video game developer based in Richardson, Texas. It was founded on February 1, 1991, by four members of the computer company Softdisk: programmers John Carmack and John Romero, game designer Tom Hall, and ar ...
's
John Carmack John D. Carmack II (born August 20, 1970) is an American computer programmer and video game developer. He co-founded the video game company id Software and was the lead programmer of its 1990s games ''Commander Keen'', ''Wolfenstein 3D'', ''Doo ...
in games such as ''
Commander Keen ''Commander Keen'' is a series of side-scrolling platform video games developed primarily by id Software. The series consists of six main episodes, a "lost" episode, and a final game; all but the final game were originally released for MS-DOS in ...
'' to compensate for the poor graphics performance of PCs in the early 1990s. Its principal innovation is a novel use of several EGA hardware features to perform the scrolling in hardware. The technique is named for its other aspect, the tracking of moved graphical elements in order to minimize the amount of redrawing required in every frame. Together, the combination saves the processing time that would be otherwise required for redrawing the entire screen. Carmack designed the software engine based on a scrolling display for large images from the 1970s. Because CGA (the previous generation of PC graphics hardware) lacks features for scrolling in hardware, scrolling previously had to be done in software, by redrawing the entire screen for every frame – a task that PCs of the time lacked the performance to do. Adaptive tile refresh minimizes the computing power required for sidescrolling games to within the reach of available hardware. This works by flagging bitmap tiles and redrawing only the graphics on the screen that actually update.


History

Adaptive tile refresh using hardware scrolling made its first appearance in an unreleased test game dubbed ''Dangerous Dave in Copyright Infringement'', implemented by Carmack. The title of "
Dangerous Dave ''Dangerous Dave'' is a 1988 computer game by John Romero. It was developed for the Apple II and DOS as an example game to accompany his article about his GraBASIC, an Applesoft BASIC add-on, for the ''UpTime'' disk magazine. Summary The obj ...
" had been previously used by
John Romero John is a common English name and surname: * John (given name) * John (surname) John may also refer to: New Testament Works * Gospel of John, a title often shortened to John * First Epistle of John, often shortened to 1 John * Second ...
while programming games for
Softdisk Softdisk was a software and Internet company based in Shreveport, Louisiana. Founded in 1981, its original products were disk magazines (which they termed "magazettes", for "magazine on diskette"). It was affiliated and partly owned by paper mag ...
. The new game is a recreation of the first level of
Nintendo is a Japanese Multinational corporation, multinational video game company headquartered in Kyoto, Japan. It develops video games and video game consoles. Nintendo was founded in 1889 as by craftsman Fusajiro Yamauchi and originally produce ...
's '' Super Mario Bros. 3'', intended as a realistic test bed for the adaptive tile refresh concept, and was developed within a week. The team of future id Software employees, still working for Softdisk, then recreated the entire ''
Mario is a character created by Japanese video game designer Shigeru Miyamoto. He is the title character of the ''Mario'' franchise and the mascot of Japanese video game company Nintendo. Mario has appeared in over 200 video games since his creat ...
'' game, hoping that Nintendo would license the game for the PC. Nintendo declined the offer to release the game after id Software finished it. The first market appearance of Carmack's adaptive tile refresh came in id Software's first installment of the ''Commander Keen'' game series, ''Marooned on Mars''.


Technical details

EGA has several features that enable the adaptive tile refresh effect: # The
screen buffer A framebuffer (frame buffer, or sometimes framestore) is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Modern ...
can be slightly wider than the screen and arbitrarily high, subject to
video memory Dynamic random-access memory (dynamic RAM or DRAM) is a type of random-access semiconductor memory that stores each bit of data in a memory cell, usually consisting of a tiny capacitor and a transistor, both typically based on metal-oxide ...
limitations. # The position within this buffer from which the screen is drawn can be offset by 1 pixel increments, either horizontally or vertically. # It has enough video memory to store two such screen buffers, and still have room left over for
tiles Tiles are usually thin, square or rectangular coverings manufactured from hard-wearing material such as ceramic, stone, metal, baked clay, or even glass. They are generally fixed in place in an array to cover roofs, floors, walls, edges, or o ...
and sprites. Carmack used these capabilities to create a buffer that is 64 pixels wider and taller than the screen, leaving room for two extra rows and columns of tiles in the buffer off the edge of the screen. He used the offset capabilities of the card to let the screen slide through the buffer for smooth scrolling, which partially reveals the extra tiles. Scrolling is limited to the buffer size, and scrolling further wraps around to show data from the other side of the buffer. So in order to scroll through an entire level, when the scrolling amounts to a whole tile's worth, Carmack's code then draws the next row of tiles from the level into the buffer, just off the edge of the screen, ready to be displayed when the scrolling continues in that direction. But since only the edges of the screen are being redrawn at any time, sprites in the level do not get redrawn until they reach the edge of the screen. To counteract this, the code calculates which tiles a moving sprite had previously covered and redraws them to erase the old sprite image, then draws the new sprite image in its new position. This allows sprites to be animated independently of the scrolling with minimal computational effort. Since moving a sprite in this way involves first erasing it and then redrawing it, the image of the erased sprite may be visible briefly, causing flicker. The final part of Carmack's technique is the use of the same EGA hardware features used for scrolling to also implement
double buffering In computer science, multiple buffering is the use of more than one buffer to hold a block of data, so that a "reader" will see a complete (though perhaps old) version of the data, rather than a partially updated version of the data being create ...
: setting up a second buffer into which the code can draw while the first buffer is being shown on screen, which is then switched out during screen refresh. This ensures that no frame is ever displayed mid-drawing, which yields smooth, flicker-free animation.


References

{{Apogee Games Computer graphics Video game graphics Commander Keen