3 ms·
It's beam-chasing, BUT in a much more powerful and programmer-friendly (declarative, really) tile based way. All of the 8- and 16-bit home and arcade systems es
by JohnBooty 3y ago
It's beam-chasing, BUT in a much more powerful and programmer-friendly (declarative, really) tile based way. All of the 8- and 16-bit home and arcade systems essentially worked this way.
For the Genesis you've got two independent background layers. They are made of tiles. You also have 80 sprites which are also tiles.
For each sprite, you give the system an X,Y position and a pointer to VRAM for the graphics data.
For each background layer, you give it a scroll offset and a list of pointers to VRAM for the graphics data. Very similar to sprites, but you move the whole layer at once so each tile doesn't get its own X,Y.
You don't have to do this on every frame. It will just keep drawing the same thing over and over until you change something. You don't have to do steps 1 through 3 on every single frame - you just make the changes you need. If the game is paused or the player hasn't moved, for example, you might not do anything at all.
You have a limited amount of time during VBLANK (the time between frames) to do graphics work. This is where you update sprite/background positions, transfer data, change palettes, whatever.
You have an even more limited amount of time during HBLANK (the time between individual lines in a frame) to do things as well. A common use for this is updating the background scroll position in the middle of the frame. This is how you get "line scrolling" effects like the cool pseudo-3D floor effect in Street Fighter II. You can also change palette colors. This is how you get the transparent water effect in Sonic the Hedgehog even through the Genesis doesn't have true alpha transparency - you change the palette part of the way down the screen during VBLANK.