A Great Big Stick
Up until almost 1 AM yesterday. I like being up late, it puts the next morning into a new, unremembered context and smooths out the unpleasantness. Anyway, I was doing the Lord’s work and experimenting with the laws of science.
Dealing once again with the Shadow Maps idea and the total lack of speed, I thought that grabbing a pixel and comparing it to another pixel was slowing the whole process up. So, it occurred to me that I could render the entire screen via mathematical expressions. If each picture is a a table that has as many cells as there are pixels in the parent picture, I can do all my comparisons using math and tables (which is, by the way, wicked fast). I could conceivably even apply an Alpha channel to the thing and get some honest to goodness transparency happening. But before I went in and did that, I felt a test was in order, I needed to be sure that the other half wasn’t the slow part; that it wasn’t the drawing of the pixels themselves that was the slow and stupid bit. So, I built a quick test and ran some loops. What I found was that the loops, can run more than fast enough to support a game. Easily on par with the game loop’s speed. Then I added the pixel drawing part and it was slow again. Far too slow for running in a game. So, yeah, dammit.
Which brings me to the title. After realizing that running a shadow map using Blitz Basic is likely a fools errand, I got back into the code. There was a bug that needed hammering and it needed it now. The Front End code was still being, let’s go with stupid. Run a game, quit out, run a game, quit out and sometimes, just for fun, it would load you in the wrong place and kill you. The trouble was, nothing was telling it to load you in the wrong place, it did it of it own accord as far as I could tell. Some artefact of the code being wielded by some ghost in the machine. After trying, for several days at this point to find the source, I decided that being crafty with it wasn’t paying out, so I beat it to death. I stuck a little bit in the loading function that basically says : “If you did all that, and the character is someplace stupid, you did it wrong. Do it again, and keep doing it until you get it bloody right.”
It’s hardly the most elegant thing in the world, and I would rather it just work like it’s written. Yet, it does in fact work now. So I’m happy enough with it. Now I can move past the thrice damned thing and work on the other stack of things that still need doing.