For example, Ninja Gaiden uses this in many of its cinematics to create dramatic effects, such as a windy grass field, or the sight of a distant castle. Some games combine this sprite0 flag with another technique, that of a predictably timed loop, to wait for a certain number of additional lines to render, thus getting multiple splits on the screen. When its bottom row of pixels is rendered, the sprite0 flag gets set This is used by many NES games to make a simple screen split, like Ninja Gaiden (1989) shown here. Game code can first position this sprite where it wants a split to occur, then wait in a loop, checking for the sprite0 flag, so when this loop exits it knows exactly which scanline is currently being rendered. Whenever this sprite is rendered, if one of its pixels overlaps a visible part of the background, a bit called the “sprite0 flag” is set. HUD on top doesn’t move as the level scrollsįirst, the PPU has built-in hardware that treats the sprite at memory position zero specially. There are a number of techniques to perform this kind of synchronization between game code and the PPU. Achieving this effect requires precisely timing when to change the scroll, so that it happens at the desired scanline. Most commonly, the scroll position can be assigned midscreen, creating one portion that stays static (like a HUD), while the rest scrolls ahead. However, certain changes to the PPU’s state can be performed while the screen is being rendered, these are called “raster effects”. Most of the time, changes to the PPU’s nametable and palettes have to occur during this small window. Vblank gives the software an opportunity to change data in the PPU’s memory, as otherwise that memory is being used for rendering. On the NES, the PPU (Picture Processing Unit) does this scanline based rendering automatically, every frame, while code running in the CPU does whatever work the game needs to do. Once the bottom corner is reached, a period called “vertical blank” (or vblank) happens, wherein the electron gun moves back to the top left to prepare to draw the next frame. They draw scanlines to the screen, one at a time, left to right, top to bottom, using an electron gun that physically moves to point at the screen where it draws these lines. Like any older computer, the NES was designed to work with CRT TVs. Scanline based rendering, with a pause for vblank To go any further will require a quick tangent to discuss, in detail, how rendering happens. Combined, these cover nearly everything a basic NES cart can do without using additional hardware. Part 1 and part 2 described CHR data, nametable based backgrounds, sprites, and scrolling.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |