Tuesday, May 05, 2020

Step 16 of 300

A long and tiring day, but, it seems, the start of many. There was always a serious problem with Taskforce in the way it rendered the scenery. Each map block inherently had some blank spaces, for internal walls, when these simply joined to other walls. Everything works fine like this until you start blowing up walls, then the holes/nothingness there is visible and looks like an error of some sort.

Andrew drew attention to this yesterday, and yes, it looks like a bug and ugly. In effect, it is a bug of sorts, a limitation. Here's one of Andrew's screenshots. The wall is missing like some odd dimensional mirror:

At the time I'd experimented with simply making all walls, even internal ones, visible from all sides but that's very inefficient (rendering things that are not seen) and looks ugly, because polygons should join seamlessly.

I'd always disliked this, but, I thought, it was fast because it was ugly... but even this isn't totally correct, because some hidden surfaces are rendered, and the occasional ugly look was actually very common. In some ways I didn't mind because blow up things should perhaps look mangled, yet, this issue is the one that now bothers me most about Taskforce. Until now I'd resigned to the fact that there wasn't much I could do about it, unless I wanted to redesign the graphics engine.

Yet, my quest for doing things well and aiming for the best option means that today I have decided to redesign the graphics engine.

The problem isn't trivial but isn't that complex either. Most internal surfaces are hidden, but should appear when exposed. So blocks need a series of flags that specify if they cover each of their sides (north, south, east, west). Some blocks, like solid walls, will cover all of that wall, and so the neighbour block there won't need to render that face. Faces can be switched on or off as needed, depending on the status of the neighbour.

Actually, this is already part of the engine, for tops, because the tops of blocks are not rendered if a floor is above them. That caused obvious flimmering (ugliness) so I was forced to deal with it. If only I'd thought back then, I could have made these changes back in 2004.

The offshoot with this is that now, every map block (there are 300) needs chopping up into faces: main (floor/middle), top, north, south, east, west. Only walls really have all bits, and they can be reused, but I don't have those components now... it means a lot of remaking 3D data and a lot of retexturing, which is very slow and tedious on my rather rubbish Visual Basic texturer.

If I'm going to retexture all of the graphics (and I am) I might as well make new, higher resolution textures too, so I'm doing that too. The programming work will be easy once I have these data; these blocks... but it will be several days until I do. Every process is very slow. Fortunately, I generated most of the textures in Genetica, which means that I can render them in higher resolution with a click.

Of the 300 blocks, I've made 16 so far. The first 50 or so are simple floors, so easy to do. Oddly, I split the original floors between lots of weird texture files that has walls mixed in. That's a real pain because it means the new 'inner' blasted walls won't fit anywhere, so I have to change the actual texture layout too.

It's exhausting and laborious work, but at the end, hopefully in a week, the game should look better. Yesterday I felt great, that I was on the home straight for this game, but now I'm at the bottom of a mountain again. On we climb.