Sunday, August 27, 2006

It's just what I asked for, but not what I wanted

Just random thoughts today. Tomorrow I leave Singapore and return to the land of the free and the home of the brave. What a trip this has been. I should write a book.

Today was alpha-channel day; the day I finally added support for images which already have an alpha channel to render their transparency correctly. Apparently some people aren't satisfied with using magenta as their transparency color, they want REAL transparency. And of course getting it to work required a few bizarre hacks but hopefully now the rough spots are over.

And now I can kick back and see what, if anything, people do with it. I've often implemented things at the request of somebody, thinking that if I removed this last dam then a steady stream of new sprites, objects, maps, characters, or dirty limericks would issue forth. I don't recall that ever being the case.

All the same I continue to believe that the most important things I can do to continue improving the game is to fix bugs and implement features that people have asked for. I'm particularly interested in adding features people have taken the time to log on the SourceForge site, because filling out that form is just enough of a pain in the ass that it proves people are at least a little bit interested in getting the feature.

Hopefully tomorrow on the 14-hour plane ride from Hong Kong to San Fran I'll get the new sprite system designed to my satisfaction. Now THAT is something I personally can't wait to get in place, it's hard to stop thinking of new ways to use some of the things we've got planned. The trick will be to make it easy for other people to understand and use.

Saturday, August 19, 2006

Mouse targeting finished

It's in in CVS. All the commands that prompt for a target now respect the mouse. The one thing I've found it good for is moving the cursor all the way across the map. Occasionally this happens when the auto-target picks an enemy on the opposite side of where you really want to attack.

More fun than a barrel of monkeys

Vials of slime. Hurl them at your enemies and watch the madcap mayhem begin. Available now in CVS at fine establishments like Tooth's and Shroom's.

Experimenting with mouse input

That's right, somebody wanted to use the mouse for targeting. The nerve. It is a pain to use the arrow keys to cursor around, but I planned to add shortcut keys so you can easily jump from target to target. Nonetheless I do aim to please so I checked in an initial version to CVS. It needs some polish but works about as expected. Mousephiles start your glad rejoicing. Anti-mousites please withold the flames, we will get our hotkeys so we can continue feeling smugly superior.

cmdwin overhaul done

The afore-mentioned muck-wading is now over. It wasn't that bad, and I found a few more bugs that needed fixing up (for those of you playing the last release, try mixing 9999999999999999 mixtures of a spell and enjoy your extra reagents). I also decided to right-justify the cmdwin prompt when it gets too big to fit in the buffer, so you'll always see the latest verbage.

Wednesday, August 16, 2006

They told me so, but it didn't help

While implementing the last feature I discovered a bug in the cmdwin code that's exposed with the reduced screen-size version of the UI. The cmdwin strings are overrunning their little box on the display and trampling right over the frame border. After messing with it a bit I realized that I had implemented the wrong API for the cmdwin. During command prompts the code is always printing, and backspacing, and doing little tricks to keep track of how much to backspace. It became suddenly clear to me that the API should be a stack. You push a fragment of a prompt, then pop it, push the reply, and go on with the next fragment until the command is complete, then you wipe it clean and start over on the next command.

The new API is implemented and now I'm waist-deep in the muck of wading through all the commands and fixing them to use it. Programmers naturally hate this kind of drudge work, which is why it's a 100 billion-dollar industry or something to publish books about how to use some new approach to write your code so that this isn't necessary. I used to read those books until I realized that they all depended on one critical faculty which I do not possess: the ability to predict the future.

Now I just hold my nose and wade through the muck. It's faster than reading those books and less stressful than worrying if I've predicted the right future when I wrote my code. And it gets me re-acquainted with code I haven't visited in years, which is always good for a laugh or two at my younger self's expense.

Sunday, August 13, 2006

Nazghul/Haxima: the Feature Marathon has begun

Finally started in earnest on that big long feature request list at SourceForge. Today I added support for multiple save games (that one has been on the list for over two years), a L)oiter command, and kaypy's request for "NPC's as light sources". He was bothered by the fact that they wandered around in the dark... I guess it was a little weird. I tried two approaches to that before just adding a default AI to pretty much everybody. A lot of the monsters will use this now, too, which may be undesirable in some cases. I'll deal with those on a case-by-case basis.

Thursday, August 10, 2006

Emacs: mapping file extensions to modes

I love emacs outline mode. When I'm making notes (like, trying to figure out the UI for supporting multiple save games) I usually start with a plain text file. After a while, I start organizing the notes. Soon, I start making headings with '*' and subheadings with '**'. Then I type M-x outline-mode and voila! I can expand or collapse headings and subheadings with a few keystrokes. And it's still, really, just a text file. Man, I love plain text files. Intensely. Yet platonically.

Today, I read this and thought to myself, "I should learn more about emacs so I, too, can have godlike programming power." It might be a bad thing if I had that kind of power, as anybody who bothers to read the source for nazghul will quickly discover, unless they turn into a pillar of salt first. But that's not my problem.

I already knew about outline modes, but today I had another thought (two in the same day!): I could save my outline files with a .olm extension, and modify my .emacs to automatically enter outine mode and turn on syntax highlighting whenever I open one. Syntax highlighting makes the little '**' marks pretty, and I like that, since it gives my eyes something to focus on while my mind wanders.

This is a very simple trick, but I'd forgotten how to do it. Luckily, I discovered that I'd already done it for javascript, and had a ready-made example. Are you ready? Here's how you do it:


(add-to-list 'auto-mode-alist (cons "\\.olm\\'" 'outline-mode))
(add-hook 'outline-mode-hook 'turn-on-font-lock)

Monday, August 07, 2006

Nazghul: cute little mini-sprites in the UI

Yesterday kaypy and I tag-teamed some new UI enhancements to the party viewer. Each party member now has little mini-icons to show his, her or its readied arms. Also, the cryptic single-letter codes that used to show effects like poison have been replaced with nice little sprites created by kaypy. Here's a screenshot of what the next release will look like.

Sunday, August 06, 2006

Nazghul: text colorization in next release

I added colored text support to CVS recently, and produced this monstrosity here. Kaypy has suggested some improvements here. (Caveat: those links won't be up forever). He certainly has the better eye for color design than I do.


Meanwhile I'm trying to figure out a nice clean way to make the colorization consistent (whatever the colors turn out to be) throughout the UI. Naturally, I want to do it without tearing up a bunch of code. An obvious approach is to assign types to different UI elements that keep showing up: labels, dice roll strings, proper names, stats, etc, and then use an API to print them that automatically assigns the right color in the printing process.

This does not seem appealing:


status_print_label("STR:");
status_print_stat(ch->getStrength());

That would entail a lot of rewriting. I'm thinking of adding a formatting layer instead:

status_print("%d", ch->getStrength());

Except I don't want to type all that, so I'd probably shorten it to:

status_print("/lSTR /s%d", ch->getStrength());

Where the '/' character works like '%' in printf, indicating that a formatting code is about to come next. This is exactly the way I did colorization in the first place, and so far I haven't hated it.

Haxima: next release will have character creation

Kaypy has committed has character-creation script to CVS, so we'll see how people like it on the next release. I tried it with one of my test games where I start with two characters, and they both went through character creation with no problems!

Thursday, August 03, 2006

Time to start on that features list

The bug list at SF is now empty (if you think that's a mistake then log a new one here, but keep in mind that some things have been fixed in CVS but haven't been released yet). Assuming the bug list remains empty I'll be starting on the feature list soon. That should take a while.