Mar 7, 2011

Progress Report: Windowing System part 2

Since my last post I've been working on adding more controls to the UI, and in so doing managed to break the entire UI system for about 4 days. Argh. I didn't really have a lot of spare time to spend on fixing it, so the game engine was left in a non-functioning state for the entire time, which I hate doing. I could have rolled back the changes since I use source control quite religiously, but the change was necessary and I powered through and got it back up and running.

My initial implementation of the skinning system as detailed in my previous post made a few assumptions that came back to bite me when I tried to implement the checkbox control. I'd decided that controls will only need 4 different states, which I reasoned at the time was:
  • Normal
  • Highlighted (mouse over the control)
  • Disabled (that greyed out non functional look)
  • MouseDown (for buttons and the like).

When it came to the checkbox control I realised there are really 6 states involved:
  • Normal Unticked
  • Highlighted Unticked
  • Disabled Unticked
  • Normal Ticked
  • Highlighted Ticked
  • Disabled Ticked

The Button Control skinning was implemented naively, as it too should really have 6 states. Furthermore, some controls may want more than 6 states, and some may only require 3, so hardcoding the system to have 4 skinning states wasn't going to work. The coding change to allow for a flexible number of states was doing my head in so I ended up with a bastard child of different approaches all working against each other which broke everything.

The good news is that its working now, and I've pretty much implemented every UI control I'll need in the near future. I may need to tweak a few things in the existing controls to add functionality over time, but I shouldn't need to make big changes like the ones that spawned the unholy abomination this week.

The "game" parts of the game.

An important gameplay element that relies heavily on the UI is inventory management, which is pretty much ubiquitous in video games. Now that I actually have a rudimentary UI happening, I've managed to get a basic test inventory working, where you can drag and drop items from slot to slot and you have a tooltip window appear when you mouse over items.

It doesn't sound like it should be much work to implement, and truth be told it isn't. However, it relies on a lot of other elements (some small, some huge) being in place.  Working on the UI for several weeks is fairly boring as you dont make any tangible progress on the "game" part of the game, as being able to click buttons and checkboxes without any actually context isn't exactly awesome fun.

Prototype game mode for Bulldog :p

In reality, there is a HUGE framework of non-game parts that have to be built before you can get anywhere, so in the beginning, identifiable progress can be slow, but once you reach a certain threshold you're mostly doing "game" parts, and it all starts to come together. Kind of like paying a mortgage - in the early years its all interest payments and very little principal, and later its mostly principal. Well, thats the theory anyway. :)

So, even though its a small feature in the grand scheme of things, the inventory screen is very important, and getting a working prototype up and running is a good feeling.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.