Saturday, 31 May 2014

Bug hunting

Kaduria has 7 known bugs. It's not much, but some bugs can be annoying. This time I was fixing a bug that crashed when you threw more than one item on top of another. At first I thought it was a bug in stacking routine. Stacking sets a number to item's data, making it appear as "7 apples" etc. The good thing about this style is that items take less space, since 120 arrows is just one item.

Of course, the bug was not in that routine. I started to doubt it when the crash happened in the dynamic light map routine. It's checking items with light value, then displaying the light. Dynamic map makes it possible to throw a torch and see the light area in real time.

When the item is added to level there is a check for stacking. If suitable item is found, the original item is destroyed. As you can already guess, the original item handle was still in the item map, from where dynamic lighting is finding the handle... why it was there? I've found out that it's easier to actually change the item map when the item is flying, rather than use "a sprite" to represent the flying item. But the original map has to be restored after the item and the most important part is what happens when the item lands. Fixing the bug required two lines of code: set the item location to landing and update the item map.

The way stacking is done may be wrong, because each item has condition (physical, very exact). So any small damage to the item makes it incompatible with other, similar items. It may be possible that I have to reprogram stacking completely and use individual items which then are only displayed as a stack in the inventory and elsewhere.

Thursday, 29 May 2014

Does editor font have to be monospace?

The answer is no. And as usual I learned this after 20 years of programming. Although in the first years most editors were text based so the only font type was monospace font. I've changed my editor font to Franklin Gothic Demi Cond and just look at it:

It's much better than monospace font. Monospace may be required in some languages but in C++ it doesn't matter, because tab spacing has no real meaning. Besides as you can see tabs wont disappear.

I think (and many others also do) monospace fonts are less readable than regular (proportional) fonts. Selecting more readable font is important, because it also increases the readablity of the source code.

Sunday, 25 May 2014

Lights out

I wish I had more exciting news, but today I'm planning to remove light items from tools, because it's possible to put light items in tool and light slots, "double use" them. Usable items will also have a dedicated use command to use the item in the tool slot. It could be also nice to have a key for light slot to put off light fast if you need to hide in darkness. More direct keyboard commands is merrier.

There's been more than month's break in development of Kaduria. Not unheard of, but it reflects the problems I have in my so called real life. It's bad enough to have a poor quality of life, but it's even worse to be aware of it. That awareness sucks the most I guess. So what to do? I have plans... but if they work as well as the plan of Kaduria, we might have to wait for some time before anything happens.