
Since the last update, I’ve tried coming up with solutions on how to fix the glitchy sprite tiles when changing direction. The problem stems from me trying to copy too many tiles to VDP memory during vblank. The VDP tries to render the graphics while I’m still trying to copy memory and that causes conflicts. The friendly smspower folks suggested a “double buffered” solution where I’d copy the car’s tiles over two game frames. Copy half-ish of the car’s tiles on the first frame, then the rest on the second frame. When copying, put the tiles into a “back buffer”, i.e. an unused area of VDP memory while the active sprites use a different area. When the copy is done, make the sprite use the newly copied area and then next frame copy the tiles into the “old” area.
Went with an ugly but working solution. In the gif above you can see the two areas in the VDP memory getting updated in alternate steps.
The disadvantage of updating over two frames is that the animation will be updated at 30fps while the rest of the game runs at 60fps. But the physics can still run at 60fps and the new direction even if the sprite doesn’t reflect it exactly for one frame.
Now that I think the prototype is in a decent working shape, I do believe I’ll be taking a break on this project for a bit.
Leave a Reply