Wednesday, May 18, 2011

38 - My, you're a short one!

Why must you do this to me, WhenMouseLeave / WhenMouseEnter / IsUnderMouse? These methods are extremely hard to get perfect. And even when you think you are done, you get a popup window out of nowhere that does not notify you of a mouse move event or the OS does something strange with the mouse and you are left dangling. Anyway, I solved most of these.

I also solved a huge yet elusive bug, that only happened once the widget nesting reached a depth of over four. It took me hours to find and solve this bug. But everything is starting to come together. The new GUI system is not only a lot more stable and mature when compared to yesterday, but it is also more feature rich. So I removed the old action bar in favor of the new only (but I only commented the code out).

I also made animations a little more FPS agnostic. It is not perfect yet, because the resolution of the timer I am using is not high enough, but it is a big step in the right direction.

Since the bug fixing took me such an extended period of time, in today's post I will only talk about two topics.


Pause screen effect
I added a full screen effect when you pause the game, to differentiate between the two states. The screen becomes darker. But then I realized that this is an idiotic change since the game remains interactive in pause mode. To add insult to injury, I mark selected cells by making them darker. So I restricted this effect to when you you have full pause, like when a dialog pops up. I will signal normal pause some other way, probably by a blinking play button. Here is a sample:


You can see here the new action bar too. The three letter labels will be replaced with suggestive icons. No, not that kind of suggestions!

The question is how does one make such an effect. There are multiple ways, so I chose the fastest and easiest method, which literally took me three lines of code. It is a known fact that drawing something with transparency is slower than without. It is less known that colorizing can also share these properties. Depending on the hardware/rendering mode combination, I saw anywhere from better to 3-4 times worse performance when doing colorization. It is particularly bad with software rendering. So this effect could be improved.

I am not going to add a possibly disastrous rendering mode without making it optional, am I? This leads me well to my next topic.

In game options dialog
See the small button in the lower left corner of the screen? Pressing this bring up the following dialog:


The layout is a little bit rough around the edges, but this is a full featured dialog, with current quality standards (i.e. it opens up with a small animation and buttons enable and disable properly based on the values entered in the dialog).

The first option enables or disables the above mentioned pause effect. It is enabled by default.

The second option controls Super Special Rendering. It is enabled by default. But what could this option be? Foreshadowing!!! FORRREEEESHADOWING!

The third option controls the number of Z levels that will be rendered, the fourth the rendering of half height/full height walls and the fifth the rendering of wall borders.

Then we have three numeric values that can be altered. Speed is the speed of the time compression algorithm. This will allow you to fine tune the speed if you are not happy with the default of 6. Values range from 1 to 12. Zoom controls the three zoom levels that you are already accustomed to seeing. And finally we have cycle, that is related to the in game cycle clock. It is the scheduling "FPS", or more correctly the delay. This option is more for me than for the potential player, and it might not make the final product. Values are from 0 to 30.

And finally the small button in the corner, that unceremoniously closes this option panel (read: without animation).

7 comments:

  1. Are you using any sort of version control?

    ReplyDelete
  2. To JP:

    No. I have been planning to start using GIT for months now but I just couldn't be bothered, even though I generally love version control. I hope I'll start using it soon. Right now I have backup archives only.

    ReplyDelete
  3. You totally should. :)

    It would alleviate the (potential) problem of commenting out old code. If you really need it, just grab it from an old revision; otherwise, only keep live code.

    ReplyDelete
  4. Sweet, I found a new game development blog to follow.

    Reminds me of transport tycoon. If you haven't considered transport tycoon style popup's for displaying unit info (popup with a small viewing window around the unit + tabs for info and various settings of the unit), then you should definately consider that! Think I saw it as a wishful thinking suggestion for DF's interface once.

    ReplyDelete
  5. Just don't do what transport tycoon did and make them all fixed pixel size. That game was a mess to play on a high resolution screen and there was no way that I could find to make them bigger.

    ReplyDelete
  6. Errr... I never suggested clone transport tycoon down to the code. Just use similar style of representing unit info. What would you suggest alternatively annonymous? (also, take a look at open transport tycoon-OTTD, every unit window is adjustable)

    ReplyDelete
  7. Man, I really like what you are doing here. keep the hard work. I don't mind if the game ends as a clone of DF (I know that's not the idea), if i'm able to play it with graphics and mouse!

    ReplyDelete