Thursday, September 8, 2016

Controller Woes

Curse you analogue controller!
Wow, it's been a few weeks since I last posted anything here. I should remedy that.

I think I will.

Let's talk programming.

When we last talked I'd been working on a Zelda-like for Linux and I'd made a bit of progress. One of the things I was testing was the ability to use a controller.

SDL2 makes it fairly simple to hook a controller up to your computer, find it and use it and I did tests that did just that. Using the left analogue stick I made a sprite move around the screen. This worked well for both horizontal and verticle moves. But there was a problem.

My sprite has a speed limiter (for lack of a better word) that should make the sprite move across the screen at a reasonable pace and this worked for both verticle and horizontal movement. The problem was that angular movement made the sprite speed incredibly fast. This is behavior I do not want.

The fix is easy, I think. The thing is I have vague recollections about this happening before a number of years ago and I was able to find then but not now. It's a math thing and I'm sure I could figure it out if I sat down and put my mind to it. Unfortunately I'm impatient and lazy so I want Google to answer my problem. That'll take time.

Despite the speed I dinked around with my little sprite mover and it felt odd to me to be controlling the sprite with an analogue stick. I really, really wanted to use the d-pad just like Zelda of lore used to do. It took me a few moments to whip this up and after playing around with it the angle/speed problem went away as I was using digital switch basically and it felt good.

Here is the problem. Kids these days expect to control everything with the analogue stick. I cannot say I don't blame them because the majority of games out there feel right when controlled via analogue stick. So, do I take the easy way out and only use the d-pad or, do I only use the analogue stick and appease the kids (while trying to make sure it (the sprite) runs at the right speed) or do I make life difficult on myself and do both. I mean, I already have to include keyboard control for those who might not have a controller I might as well add support for both analogue and d-pad control.

Keyboard control! Ugh! That probably means I'll have to figure out an elegant way to remap the keyboard for those who want that option.

Elegant, yeah right.

No comments:

Post a Comment