Wednesday, 9 March 2016

Faster rendering, now with added bugs

Only a quick update tonight as today I was asked to fly to Vegas tomorrow and so I'll have to get an early night tonight.

I realised overnight that there was one routine that I had inadvertently left incomplete; this was partly the reason that all objects had to be rendered every frame. The other reason - it transpires - was a bug in the routine that lists all the objects that are to be drawn. Once I had completed coding the former, and fixed the latter, the forced rendering of every object could be removed.

The good news is that objects tend to be redrawn (only) when they need to be, so the new routine isn't too far from the mark. The bad news is that the formerly occasional graphics glitch - extraneous pixels - is more frequent and far more prevalent now. And with the occasional flickering of objects when walking in front of/behind them, it's clear that I have a couple of bugs to iron out.

The new code also gives me a better insight into the performance of the Coco3 port. Empty rooms are blindingly fast whilst populated rooms are quite a bit slower, perhaps a little too slow considering there's still a bit of code to add (collision-detection and Z-ordering) for each frame. Another interesting observation was that walking in front of/behind objects slows the frame rate considerably, which I've never noticed on the original. However that could simply be due to the fact that I haven't finished porting all the code yet.

The original code tunes the frame rate based on the number of objects wiped and objects rendered each frame. Regardless, the game does slow down appreciably on busy screens, so I'm not concerned at all if the port does the same. I'll be happy if the Coco3 isn't - at its slowest - any slower than the original.

I'm undecided whether I'll continue with the Z-ordering, which effectively completes all the rendering code, or stop and fix the graphics glitches first. It's possible that the Z-order code will only complicate matters when it comes to debugging, but I should also be able to disable that routine with a simple .define. Choices, choices...

No comments:

Post a Comment