Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How did classic side scrollers implement timed events and animation triggers?

I have always been amazed at the Super Mario series on the Snes. I think it was mostly made in Z80 assembly. But since there was not a real time clock, how on earth did they manage all those timed, animated events with assembly and no real time clock?

Thanks

like image 241
jmasterx Avatar asked Nov 12 '10 21:11

jmasterx


People also ask

What was the first side scroller?

The first scrolling platform game was Jump Bug, a platform-shooter released in 1981. Players control a bouncing car and navigated it to jump on various platforms like buildings, clouds and hills.


1 Answers

An important concept to keep in mind is the VSync rate. This is how often the electron gun in the TV (or, the equivalent in modern TVs) finish drawing the screen, and slowly travel up to the top of the screen.

Because this happens at a constant rate (60 times/second in NTSC, 50 in PAL), most games use this as their timer, with code that is roughly equivalent to this:

void main() {
    while(true) {
        updateGame();
        updateSprites();
        waitForVSync();
    }
}

Obviously, this is grossly simplified, but that's what's going on. Some games were so complex that they took too long and missed the VSync period. In that case, they'd wait for the second VSync, and thus run at 30 (/25) FPS.

Sometimes, you'll notice slow down in NES games (for example). This is when the work load is so heavy that it's missing several VSync periods in a single frame of action.

But yeah, that's the gist of how timing worked on older consoles (Actually, even many newer consoles and PC games use the same system, not just old consoles!)

like image 186
Mike Caron Avatar answered Nov 15 '22 08:11

Mike Caron