Saturday 12 December 2015

Nethack 3.6.0

The elusive Nethack Dev Team (or just the Dev Team) has released a new version of Nethack. It's not a big update, but they are in a process of trying to catch up the current vibe of development in this modern age of wonders.

I've been sick and mainly trying to recover, so it has been practical to spend time playing the new version of Nethack (rather than programming which can be strenuous). While it doesn't have many new features it somehow feels solid. You know, it just works. I still after all these years don't like D&D or the way it forces you to play the game. The nice thing about NH and many other roguelikes is that you don't exactly have to follow "powerplayer" rules and tricks. So it's possible to create your own "story" by trying out stuff. Usually it means rather untimely death, but it's the price you have to pay for freedom.

It's interesting to see where the Dev Team is heading with the next version. It could be difficult to change such an iconic game as Nethack. Maybe the changes are something like more complex environment?

I'm slowly getting my strength back and in fact today I did some programming. I have some nice ideas for Teemu in source code level to achieve more modular structure which is always a good thing, so I know what to do for next week or two.

Friday 4 December 2015

SDL 2.0: Scancode and keycode

Graphics routines are now complete. What they mostly needed was alpha channel data for things like font colors, because everything starting from data is now 32 bit RGBA. The old update rectangles are gone, because SDL2 has (I guess?) only window wide update. In that I'm planning to use a trick where the screen is updated in the keyboard get routine, because that's how the program works in logical sense. That way I don't even have to keep a update flag for every single drawing routine would otherwise had to send to GUI. Just update when waiting for keypress, whether it's in a menu or during gameplay.

Keyboard routines also needed some work. The old unicode seems to be gone and now there are keycode and scancode codes for keys. I'm actually little bit confused about them and the way I wrote new keyboard routines was using keycode. But you have to do some funny things, because in Finnish key layout some keys are not where you would think they are. For example ? is shift-+ and greater/less than characters are in the same key with greater than requiring shift. To get ? I have to check for + with modifier key shift. But I'm not sure if it's the proper way. Will it work in other layouts as well? I'm also puzzled about scancode in 2.0, because I guess it's supposed to be the physical keyboard code, but keycode itself works pretty much like it already.

There were couple of other odd things. For some reason GetKeyName returns uppercase letter for letters, even keycodes are lowercase (SDLK_a='a'). More confusingly the keyboard event seems to receive lots of events when you press a key, but movement and everything else seems to work with normal repeat rate.

Now when the technical work is done it's time to return to content creation which is sometimes annoying. It's mostly technical as well, but you don't have any kind of reference or wiki for that.