Tuesday, October 4, 2011

Resizable Windows

I've just finished implementing a relatively mundane feature that's been on my to-do list for a long time: the ability to resize the game window in my Roguelike projects. I found myself always cranking up the window size during development so I could see more, and then reducing it back to 80x25 upon release. I suppose the next step would be to preserve the window layout in the registry but that comes with its own set of issues, and I want to avoid going into the registry just yet.

Here is the latest version of ThiefRL, my transplant of Thief-style stealth gameplay into a turn-based, grid-based world.


Here is the latest version of SpaceRL, my experiment in approximating zero-gravity movement through a randomly-generated, monster-infested derelict starship.


Both games are pretty simple at the moment; there's lots more that needs to be done.

Supporting resizing involved a fairly major change to the conceptual model of my roguelike framework. It used to have a virtual frame buffer of 80x25 characters. The game would write to this buffer very much like you might have written to the graphics memory in the DOS days, and the framework would display it. Now the game follows the model I more typically use in my non-roguelike games: the framework calls back to the game when it needs the screen drawn, including information about the window size. The game issues calls back to the framework to render glyphs at arbitrary positions within the window.

In ThiefRL I ended up swapping out the speech-bubble placement algorithm for something a bit simpler, in order to get it to behave well on resizing windows. The old algorithm was trying to avoid placing speech bubbles over NPCs. It used a sort of simulated annealing, but this resulted in totally different solutions every time it rendered. When resizing the window this looked pretty crazy. The new algorithm just tries to put each speech bubble on the opposite side of the player from its source, to keep a clear view of the space between the player and the speaker. If multiple NPCs say something on the same turn, though, it's possible for the bubbles to overlap.

I also took the opportunity to touch up some of the in-game note text to give it a bit more thematic flavor. There are still some notes that don't belong at all: the limerick in the heavily-guarded house, for instance. This really was just my test world for features, so it hasn't had terribly focused world-building done on it.

I received a couple of fan letters for these projects, which was very gratifying. I know I tend to lurch about from project to project as my whims dictate. ThiefRL feels like it's furthest along in terms of the quantity and quality of gameplay on offer, and in terms of it not having any particularly big technical challenges on the horizon. (Hierarchical pathfinding would be the next one I can think of.)

Next up, I think I will implement one-way windows in ThiefRL. I think I'd like to give the player more options for de-escalating a situation. One way might be to have "high windows" that you can jump out of to move from a heavily-guarded inner area to a less dangerous outer area. The guards would not be able to follow directly so you would gain some distance immediately. You would not be able to return through the high window, though, so it would preserve the difficulty of getting into the inner area.

2 comments:

Nolithius said...

ThiefRL is shaping up quite nicely. Might I request a [L]ook or e[X]amine command to garner information about your surroundings, especially guards' awareness levels?

Also, are you on Twitter? I'd like to follow the progress more closely and add you to the Roguelike Developers list. (@Nolithius)

Cheers!

Ebyan "Nolithius" Alvarez-Buylla
http://www.nolithius.com

James McNeill said...

Thanks!

I'm hoping to get the interface to the point where knowledgeable players would not need to issue look commands. I want the game to flow smoothly. If it makes the game more fun, though, I might try an awareness info overlay that is displayed whenever you're holding down the Shift key.

There is also the separate problem of acquainting new players with all the pieces. I've thought about supporting tooltips for that.

ThiefRL is getting a new 16x16 tileset right now because I want it to be symmetric. The versions released so far have double the light/sound propagation in the horizontal direction, even though the (grid) movement rate is the same in both dimensions, which is pretty strange but makes for circular light pools. Switching to square tiles will make things a bit more understandable.

I have a Twitter account that I have barely used (jamesmcneill). I'll ask my Twitter friends what sorts of things I should put on there. Can you tell I'm old?