Wednesday, 1 April 2020

Tile mapping working

So you can now do tilemaps from BASIC ; the picture shows a testing tilemap.

It's quite efficient, this tilemap goes at 28fps on the ESP32, and it's doing quite a lot of work on repainting the screen.

The downside is the borders ; the purple bars are covering them up :) This is because to scroll a tilemap at pixel level you have to draw it back a bit. My blitter only draws in 16x16 chunks. I could theoretically process every tile to clip it, but this would be very slow. Or I could uprate the blitter, but I really didn't want to cheat by producing something that was 2020 technology, say a hardware clip. Of course, one way to clip it is to tile the whole screen. Also, the simpler the hardware the easier it is to implement.

Also fixed a bug in the palette code which was a hangover from the original which emulate a real hardware palette. It actually now does it, but it's really slow, because hardware palettes are not a feature of the blitter driver - so changing a palette involves repainting the whole of the display. This actually is fairly quick on the ESP32 , but not enough to use palette effects in games.

No actual Retrochallenge work done today. I have one more thing I want to do, though this isn't necessary initially. The graphics is a bitplane design, and the blitter basically selectively writes bitmaps into planes. So you can say have 2 sprite planes, and 2 background planes, giving 3 sprite colours and 4 background colours (one sprite colour is for transparent), or you can have 3 sprite planes, or 1, or none at all, or no background if you really want (There is only enough memory in an ESP32 for 4 320x240 bit planes). It would be handy though to be able to draw on the sprite plane, and it isn't difficult to change the graphics routines to do this, as they all use the same routine anyway. I drew the purple bars in the picture using the BLIT command, which directly hits the blitter, whereas it would be much easier to do RECT/FRAME/ELLIPSE/CURVE/LINE etc.

No comments:

Post a Comment

Breaking change

We all make mistakes. One early mistake I made was copying (partly) the old thing in Microsoft BASIC where you didn't have to declare ...