GERLA.CC

← Devlog

· Commodore 64

How the road scrolls, with the real code

In Ruote Fumanti the road moves down pixel by pixel fifty times a second and never shakes. It looks like the simplest thing in the game, and it's the one that took the most ingenuity, because the Commodore 64 has nothing ready-made for it. I've told it in full in a new tutorial, how the road scrolls, and this time with the real pieces of the program, original comments included.

Inside there's the seven-pixel trick, sliding the whole screen for seven frames and copying the road only on the eighth; the two screens used as a flip book, one visible and one being worked on; the track that doesn't exist in memory and gets composed row by row from blocks and tiles; and the moment, in the bottom border, when the page is turned without a visible tear.

And there's the part I like best, because it was found by measuring, not reasoning: two instructions moved from line 32 to right after the frame is delivered gave the game forty lines in which the processor used to wait, and dropped frames went from 1.93% down to 0.11%.

Meanwhile the game has moved to 1.0.1: while racing, M turns off the music and F the effects, each on its own, and with the music off you hear the engines, yours rising with speed and the one of the car passing you.

Read the tutorial The game

All of the devlog