If you had used the Castle Tilemap Editor checked in before today, you would have had to deal with a performance issue with large maps, because it was drawing the whole map, including off-screen parts, to the map window every draw call. So today I sat down to write a function to make it draw to an offscreen back buffer, only drawing what was currently on the screen, to improve the performance.
However, as I got started, it turns out I had already done that. I had properly coded it that way from the very beginning of CastleEngine. However, somewhere along the way, in dealing with bugs and crashes, it had worked its way out of the loop. So at this point it is recreated each resize and used to determine whether the scrollbars should be shown or not (a flickering issue i have to deal with, on that note), but otherwise nothing is ever drawn to it. It was all drawing directly to the window itsel.
Not wanting to reintroduce whatever bugs had worked out to end up like that, I quickly just altered the draw code to only draw the portion of the map currently displayed. However I find it rather intesting that it had devolved in such a way, then I noticed it and went to reimplement it again without even knowing it was there.
Date posted: 08 December, 2008 Tags: programming
« Drug Induced | High Latency »