Friday, March 20, 2015

Knotwood - All About Bitmaps

So the short version of Knotwood is this: Knotwood is a graphical adventure game featuring exploration as the main mechanic.  You travel through Knotwood, an endless forest, which changes and evolves and grows larger as you explore, so dead ends become pathways, and places you've visited before now sport new features, like there may be streams where there wasn't before.

I wanted to give Knotwood an early graphical adventure game feel, a la the original King's Quest.  It wouldn't require me to draw anything, because the exact pixels would all be handled in code with color values, (and a limited selection at that).

First I decided to update FlashDevelop, since I hadn't done so since I first downloaded it years ago, but of course updating always causes problems, and after some time of trying to fix some basic issues, I discovered I had to do a clean install of it, and couldn't just use the update tool, because the version number increased by a whole number (actually multiple whole numbers), so trying a simple update caused weird errors.

But with that out of the way, I started playing around with graphics.  At first, I did what I knew: I used textbox objects, made them 1x1 pixel, and colored the backgrounds and left everything else invisible.

Of course, that's a silly way to do things, but I did it just to know myself that it was a possibility if all else failed.

But fortunately all else didn't fail, and I soon learned about how to work Bitmap Objects.  It basically let me do what I wanted to do with the text boxes, but without all the fluff (and with a lot more tools at my disposal), and came with its own array, so I didn't need to make an array that would take a bunch of 1x1 bitmaps; a Bitmap Object is an array of pixels.

So that's all well and good, but making a 320x240 Bitmap is... small, of course.

With this game, I want to give players the ability to resize the window as they see fit, so they don't have to stay maximized, or can do other things.  Unlike Latchkey, this is a pleasant (nonthreatening) experience, so there's no need to forever be paying 100% attention if you don't want to.

But setting the window to the size I want in pixels is tiny.  I did discover, fortunately, that I can adjust the window size and the pixels scale up, exactly as I'd like, without distortion (you just get white bars on the sides if the window ratio is out of sync).  So the window looks nice now.  Of course the player can make it any size they want, auto-scaling without trouble, but it's nice to at least have an easy to see default.

Next I played with changing colors in the Bitmap I made on an individual pixel basis.  This is quite easy, and so far all my worry over the difficulty of playing with pixels has been unnecessary.  But of course we'll see what happens when things get more complicated.

Next up, I think I'll need to make layers of bitmaps, so, say, dirt might be on the bottom and grass above it and water above that, and then change transparencies for top layers to hide what needs to be hidden.

Hmm... collision detection may become a problem, although I suppose my next task (after making a moving player character, of course) is to see if there's a way to link collision detection to alpha values.  We'll see how that works.

No comments:

Post a Comment