29 September 2011

Feathered Scrolling

I think 2.0 really is an improvement over the original game in a number of ways. One aesthetic improvement depends on technology.

Our original multimedia engine, mTropolis, didn’t support alpha. A pixel on the screen came from only one asset. But iOS supports alpha blending, so we can have translucent effects.

iOS is also a multi-touch OS, designed for small screens. Scrollable areas don’t have always-visible scroll bars, so sometimes it can be hard to know that they can be scrolled. There are a number of approaches one can take to telegraph* this to the user. One is to fade the edges of the list. King of Dragon Pass does this.

The idea is that the list smoothly fades out when it can be scrolled. It may be a subtle cue, but it looks better than a hard crop. (And in my opinion, looks much better than drawing a box around the list, which we usually had to do in the original.) The list above is feathered on both top and bottom.

The implementation is a UIView that embeds a UIScrollView, and sets a layer mask. It’s the scroll view’s delegate, and changes the mask so there’s no feathering if the view can’t scroll in a particular direction. Here’s what one of the key methods looks like:


- (void)featherTop
{
if (fMaskStyle == kFeatherTop)
return;
fMaskStyle = kFeatherTop;

// Set up a mask to fade just top
CAGradientLayer* gradientMask = [CAGradientLayer layer];
gradientMask.bounds = self.layer.bounds;
gradientMask.position = CGPointMake([self bounds].size.width / 2, [self bounds].size.height / 2);
NSObject* transparent = (NSObject*) [[UIColor clearColor] CGColor];
NSObject* opaque = (NSObject*) [[UIColor blackColor] CGColor];
[gradientMask setColors: [NSArray arrayWithObjects: transparent, opaque, opaque, nil]];
[gradientMask setLocations: [NSArray arrayWithObjects:
[NSNumber numberWithFloat: 0.0],
[NSNumber numberWithFloat: kPickListFeather / self.bounds.size.height],
[NSNumber numberWithFloat: 1.0],
nil]];
self.layer.mask = gradientMask;
}


And, here’s what the effect looks like up close.

The iPhone screen is really small, and you need to pay attention to every pixel. Polish like this is really important. It may be subtle, but it just makes the app feel a little better.

* OK, I really wanted to use this word because its meaning is now so divorced from the original literal meaning.

12 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Just wanted to say a big THANK YOU for making such an unique, well crafted and thoroughly addicting game. I initially wrote this off as a choose-your-own-adventure storybook type app when i saw it, then i read the review on touch arcade and knew i had very much misjudged it. I grabbed the app and before i knew it 3 or 4 hours had flown by. This app really just transcends the term "game" as i've known it.

    Also, i read the changes you made in that update you posted about here. I see you decided to make the game easier, please for the love of God do not continue that trend or dumb down the game any further. More challenge = better, this isn't the type of game you have to worry about appeasing casuals with. Casuals won't be picking it up at all i'd imagine.

    Anyways thanks again for making such an excellent game. It's great you're adding new content as well, hoping you continue to support the app in that manner (new scenes especially).

    Cheers

    ReplyDelete
  5. p.s wish whatever system this blog uses for posts had an edit feature, it was a pain to use in every aspect, including digging up my Google account password

    ReplyDelete
  6. Last comment i promise, just wanted to add that this game would be phenomenal on the iPad. Hunching over my phone for hours isn't as comfortable as one might hope :p

    Here's to hoping you fit this to the iPad 2 as best you can.

    I'll be leaving a glowing 5-star review on the app store, please keep that content coming!

    ReplyDelete
  7. Thanks. Though I have to say, more fun = better. More complex seldom is more fun. And it's surprising to me how many people have said they enjoyed, but never won, the original version.

    And thanks for letting us know a review influenced you. That sort of thing is hard for an indie to figure out.

    The blog gets spam comments despite everything Google has done to prevent it…

    ReplyDelete
  8. I didn't know spam was such an issue, makes sense to guard against it then.

    Maybe something you could do regarding challenge is keep the "hard" difficulty as challenging as it has ever been. Just modify the medium and easy difficulties if you feel people want an easy, more simply experience.

    Also, all the sites i've read comments and reviews for the game on really can't believe there's no iPad support. I know the art scanning doesn't translate well to larger resolutions, but if there's anything you can do to optimize the game for the iPad, please please look into it.

    Thanks again, KoDP is already one of my favorite games of all time. It's been around all these years and i had no clue it existed...

    ReplyDelete
  9. One other thing i wanted to ask, does exploring the rest of Dragon Pass change the mechanics and challenge the game presents? I imagine it brings you into contact with more supernatural forces/threats, and inhuman species that could pose challenges, opportunities or dangers (to what extent is that true?). How much more of the game is waiting out there beyond the boundaries of the Orlanthi tribes?

    Thanks in advance for addressing/answering the things issues i raised in this post and the last. Responsive devs really take game experiences up a notch.

    ReplyDelete
  10. That’s basically the sort of question I don’t like to answer, since it’s something you can find out by trying. But, I can say that you are expected to do at least some exploration in a typical game (and there is an achievement you can earn for doing a lot of it).

    ReplyDelete
  11. That's understandable. Can you answer a few mechanic questions then?

    I've played quite a bit but still am not certain what all of the tactics available in battle do. Is it like s rock paper scissors type thong, where charge beats maneuver, maneuver outflanks evade, that sort of thing? I didn't see this explained anywhere

    As well, does a weaponthane with the truesword blessing of Humakt effectively count as 10 footmen?

    ReplyDelete
  12. I’m not going to dig through the code, but sure.

    Mostly rock/paper/scissors yes (if I recall correctly it is not 100% odds though, life never is).

    Manual says “twice as effectively,” so probably. (Even if it’s only as 6 footmen, it’s still a good thing.)

    ReplyDelete