Temple of The Roguelike Forums

Development => Programming => Topic started by: AgingMinotaur on September 05, 2013, 10:01:31 AM

Title: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 05, 2013, 10:01:31 AM
I know some people play with a gamepad. I believe Legend is the only one who does RLs on a gamepad, but I think we should all be zealous about catering to Legend's needs :) So for the game I'm currently starting to write, I've been thinking I want an interface that plays well with this particular device.

But what should I keep in mind? I don't really know much about the anatomy of gamepads in general. How does a typical gamepad handle diagonals, for instance? How many buttons do I have to play with? Some buttons are typically "metabuttons", like Select and Start, right?

I want to keep the UI clean and simple, with just a few buttons needed to play the game, and the default option to access inventory etc. with the cursor keys. The keys will all be remappable, and I'll add options for keyboard shortcuts (eg. immediately access item X, without first navigating through the inventory), but they'll be optional to streamline the experience for keyboard users, whilst retaining a functional UI for those who'd rather wield a mouse or a gamepad.

Related question: Am I right in believing that mouses/touchpads used on Macs only have one button? If so, the game must be playable with just the left mouse button, or am I missing something?

As always,
Minotauros

Edit: Maybe I'm just being lazy asking this. If that's the case, sorry, feel free to ignore me. There is already this thread (http://forums.roguetemple.com/index.php?topic=1446.msg10413#msg10413), I see, where I learn that the gamepad has 12 buttons in total, and that there is an application called xpadder to map the keys manually. That leaves me wiser, but still not quite enlightened, I think. How much of a hassle is this xpadder thing, for instance. I'd love a game where you can just plug in your gamepad, and go: "A to fire, B to reload, Select for extended actions, and Start for main menu, yeah, okay, let's make bonnets bloody!" I can also surely seek out some documentation on the web. But maybe this post can spawn some interesting discussion anyway.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: JohnK on September 05, 2013, 04:14:37 PM
Your typical modern controller has...

2 analogue sticks (left and right).
A d-pad (the cross shaped thing which makes up 4 buttons).
Start and select/back buttons in the middle.
4 normal buttons on the right.
2 shoulder buttons.
2 shoulder triggers (you can get an analogue for how far they are depressed).

I've never tried a rogue-like on a controller but from having played/written other games on one I would imagine you'd go with...

Left analogue stick for movement (4 way or 8 way, just make sure you set up a decent dead zone so movement doesn't get misinterpreted).
Right analogue can scroll round the map and/or inspect.
d-pad for bringing up in game menus and start for the main menu. I think using this for movement would actually be a mistake.
Common actions go on the 4 buttons on the right. Use the shoulder buttons as modifiers for these (like shift and control) which gives you 12 possible actions.
I can't imagine sensible uses for the other buttons.

I'd imagine the only way to tell for sure is to buy one and try it out yourself, but I can't see why it shouldn't work.

X-Padder is pretty easy to set up and has plenty of options to configure it. You could even make your own config file and distribute it with your game if you didn't want to support it in your own code.


P.S. Macs can be set to allow a right click, but I believe it's off by default.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 05, 2013, 04:19:59 PM
Thank you :)

As always,
Minotauros
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: IBOL on September 05, 2013, 06:22:57 PM
hey, this is a great idea. maybe i'll go out and buy a cheap game-pad.
anything that adds something for players, especially that they don't get with other games.
(I once plugged my xbox controller into my computer, but it came out half way, shocked me,
and now doesn't work most of the time.)
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: guest509 on September 06, 2013, 12:37:02 AM
XBox controller is the standard.

For Roguelikes I haven't thought much about the analog sticks. There's a DPAD, 4 Face buttons and 4 Bumpers on top (2 of which are trigger-like).

Diagonals are tough, but if you can do them with the cursor keys you can do them with the DPAD. You can wait to move the character until the directions are released, then read if it was a diagonal or just an orthogonal.

My control scheme I've been putting thought into uses the old NES controller.
-DPAD to move and bump, of course.
-A button to shoot, then pick a direction to shoot in. (Or I could put together a DOOMRL type targeting system)
-Select button takes you to the menu where you can move the cursor around with the DPAD and press A to wear/wield/use in inventory or take off an item in a slot. Press 'B' to drop an item. Press select again to back out.
-Press 'B' when not in the menu to pick something up. This also waits/searches if the square is empty, which could be a problem if you are trying to 'wait' on a scroll of scare monster but 99.9% of the time it's not an issue.
-Press start to quit/save.

So there you go. Shoot, Bump, Move, Pickup, Menu (use/wield/wear/take off and drop). I even have an idea for a 'belt' section of the inventory that you can use quickly without using a game turn, a 'free move' if you will. For potions and throwing stars and such.

Hope that helps. You don't need a ton of buttons. Final Fantasy, Zelda and Dragon Warrior only had the 2 buttons plus select. Press start to pause.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Vanguard on September 06, 2013, 05:49:35 AM
You could also assign diagonal movement to the four shoulder buttons.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 06, 2013, 07:02:01 AM
Re: diagonals, I guess a possibility is to leave the details configurable. Those who feel comfortable just using the standard stick/controller can stick to that. For those who want to be on the safe side, one of the buttons on the side could be used as a modifier key that shifts all directions 45°.

As always,
Minotauros
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Vanguard on September 06, 2013, 12:08:01 PM
Or you could just build a game around four-directional movement.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Holsety on September 06, 2013, 12:21:37 PM
Or you could just build a game around four-directional movement.

Boo! Hiss!

You could always have a modifier key. Ie. If you keep one of your shoulder buttons pressed (/held down) it "rotates" your d-pad inputs.
So that up is instead processed as up-left, and left is processed as left-down. (Maybe even show an icon on-screen that screams HEY YOUR INPUTS WILL BE ROTATED)
With a menu option whether you prefer your shoulder button to rotate your d-pad inputs to the left (like i just gave the example) or to the right. Since controllers have 2-4 shoulder buttons usually you could reserve the other shoulder button for running, just like how shift+direction key has you auto-traverse a corridor in most Angband variants.

There's a lot you can do with controllers. (Ofc. there's the hassle of having to plug your controller in just to play a particular game, so having things be optional is always nice :B)

edit: AND HE ALREADY KNEW. So much for being useful :b
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: akeley on September 06, 2013, 12:30:29 PM
Gamepads are more comfortable than KBM.

Okay, this will sound either like beyond-obvious to some or total heresy to others (side I used to be on)...but it`s something I been deliberating on a lot  recently. So, was quite happy to see this thread appearing.  Of course some gaming genres will always be better off on a KBM, and while roguelikes might initially look like one of these, my recent experiences convinced me otherwise.

You see, I`ve been playing RLs on my handhelds a lot - NDS & PSP. There`s not much choice, but you can find a few ports, and they all utilize the DPAD/buttons/shoulders  - to a better or worse effect.  Of these:

Powder (NDS) - uses the "standard" system similar to the one Jo describes above. Movement on DPAD,  buttons/shoulders easily configurable and START takes you to a command list. Works great - but this game was coded as a handheld (GBA) native, so it`s bit different from the PC-centric majority.

TOME/Angband (PSP) - these are PC ports and the conversion wasn`t complete - or maybe not conversion itself but the UI implementation. Main method for commands: pressing (and holding) Triangle brings up a  a tiny letter set which you then navigate with DPAD. Quite a chore, especially trying to get to capitals/symbols - you have to hold shoulder  button simultaneously.  Everytime you need "*" for example, so common in lists - it`s really tiresome.  Theres also another shortcut, holding a button + DPAD navigates some pre-set commands, not too bad though a bit messy and you need to dig into config to set these up.

Nethack (PSP/NDS) - this is similar to Powder with rather "normal" DPAD movement, configurable buttons and main command list called with a button. Again, plays great. (Though diagonals dont work from DPAD fro some reason - you need to use touchscreen. Strange, but probably just coding omission)

So, the Powder/Nethack method already proves it`s very much doable  - and most importantly, playable. I`d already pick it over KBM (in some circumstances at least, like my current uncomfortable desk). But that`s not all - saved the best for the last...

Crawl (NDS) - a revelation, no less. This is a port of Linley`s DC 4.0 beta - and it absolutely rocks. Putting aside the awesomeness of the game itself, the control scheme here is a strike of genius. At first it totally bamboozled me and I put it aside as a curio, fired it up one day after Powder overdose, got into it and never looked back.

First, major change: pressing a DPAD direction won`t move you anywhere. You have to press A (while holding the direction) for that to happen. Sounds insane? Thought as much too. And yet...give it a whirl and it soon  becomes a second nature. One thing, diagonal "problem" disappears. The other: it`s a lifesaver for a hotheaded players like me who kind of rush everywhere by just holding a direction, which is quite often suicidal. So, a safety lock of sorts.

Second: all the major commands are mapped to the DPAD too. Sounds even crazier? Yep... but it works incredibly well. This system lets you map 9*4 (buttons ABCD) keypresses. Minus the 8 needed for movement and you have 28 bindable combinations - should be sufficient even for RLs with big command sets. There`s a visual hint when you hold a direction - it highlights ABCD options on-screen, so you don`t have to memorize them.

The main advantage of this system is perfect streamlining. Mostly I just use DPAD+ABCD, occasionally two others for map and "big" inventory. No need to dive into menus or fiddle with multiple buttons. Heartily recommended, would be more than happy seeing this implemented for old and upcoming roguelikes. I know it sounds convoluted on paper, but is a breeze to learn and use, really - and worth seeing in action, if you don`t have an NDS I suppose it could be emulated too.

And yeah, the diagonal-modifier method has been used in jRLs like Mystery Dungeon or Izuna and it works great.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Vanguard on September 06, 2013, 03:26:33 PM
Boo! Hiss!

What's wrong with four directions?
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: guest509 on September 06, 2013, 06:47:17 PM
Watch gamehunter play an 8 direction game. Total pro. It adds lots of tactical variety.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 06, 2013, 10:18:11 PM
What's wrong with four directions?

Well, for me personally, my world is currently ruled by hexes! hexes!! beautiful hexes!!! Or as you yourself so eloquently put it:
Make everything a hex.

On a gamepad, six-directional movement seems like it shouldn't be a huge problem. Since pushing the stick up or down doesn't do anything, it should be pretty quick to get the hang of it. That aside, I totally agree – I've never really understood this grudge some people hold against games designed with orthogonal tactics. For instance, would Go suck less if was eight-directional? Methinks not!

As always,
Mintauros
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 06, 2013, 10:31:26 PM
Holsety: Great minds think alike, honey 8)

akeley: That's very interesting. Will have to reread your description of Crawl's UI to let it sink in, but it certainly seems like you can have your cake and eat it, too. Direction+A to move is quite intriguing, actually worth considering for a keyboard UI, even. It sounds like something you can learn to love quite easily, but that many old-timers and purists will hate at first sight. I guess leaving it configurable is almost not an option, since most people would just leave it turned off, rather than picking up annoying, good habits.

As always,
Minotauros
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Vanguard on September 07, 2013, 01:21:36 AM
First, major change: pressing a DPAD direction won`t move you anywhere. You have to press A (while holding the direction) for that to happen. Sounds insane? Thought as much too. And yet...give it a whirl and it soon  becomes a second nature. One thing, diagonal "problem" disappears. The other: it`s a lifesaver for a hotheaded players like me who kind of rush everywhere by just holding a direction, which is quite often suicidal. So, a safety lock of sorts.

Oh man, I just came up with this same idea myself and came running to the thread thinking I was some kind of genius.

It's really the perfect solution.  It's comfortable, it's convenient, you can move as fast as you can button, and you don't have to worry about your d-pad being unreliable.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: akeley on September 07, 2013, 10:31:19 AM
Will have to reread your description of Crawl's UI to let it sink in

Yes, I know it sounds anything but clear. It`s one of these things best experienced "live", so I suggest a little emulation exercise (it`s all freeware, so no worries about copyrights and such).

http://desmume.com/download.htm (http://desmume.com/download.htm) - desmume, the best NDS emulator around.
http://library.dev-scene.com/index.php?dir=DS/Games/DSCrawl/ (http://library.dev-scene.com/index.php?dir=DS/Games/DSCrawl/) - DSCrawl

Just unpack and drag dscrawl.nds into the emu window, should work okay.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Rickton on September 07, 2013, 03:12:46 PM
Related question: Am I right in believing that mouses/touchpads used on Macs only have one button? If so, the game must be playable with just the left mouse button, or am I missing something?
I know the discussion's moved on, but this question was never actually answered.
Short answer: No.
Long answer:
They used to come with one-button mice, but they started including 2-button mice I think around 2005. Even before then you could use a 2-button mouse, you just had to buy one separately, and most people did.
Anyone who still uses a one-button mouse most likely doesn't play roguelikes or really anything besides Candy Crush.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Holsety on September 07, 2013, 04:26:50 PM
Gamepads are more comfortable than KBM.

Disregarding the subjective X is more comfortable than Y issue, the problem is that every pc in general has a keyboard and mouse, but a USB gamepad is a seperate entity that most (?) people don't have. I happen to have one and my biggest peeve is going "OH MAN NOW I HAVE TO GET UP AND HOOK IT UP, WHY BOTHER WHEN I CAN JUST KEEP USING THIS KEYBOARD THAT'S RIGHT IN FRONT OF ME.".
Doesn't help that everything else my computer does is keyboard-based, so I'm really just only hooking up the gamepad  to play 1 game.

First, major change: pressing a DPAD direction won`t move you anywhere. You have to press A (while holding the direction) for that to happen. Sounds insane? Thought as much too. And yet...give it a whirl and it soon  becomes a second nature. One thing, diagonal "problem" disappears. The other: it`s a lifesaver for a hotheaded players like me who kind of rush everywhere by just holding a direction, which is quite often suicidal. So, a safety lock of sorts.

ALTERNATIVELY, you can use the d-pad or whatever to orient your character, and then press A to move (one move per press) in the direction you're facing. Rotating your character doesn't take up a move. I think I remember Izuna (a jRL on the nintendo DS) using this system. I'd prefer it to [holding a direction and tapping the button] because it requires less buttons to do the action.

Worth noting that Izuna/Shiren/Journey to Farland (I'm just gonna call em jRLs from now on since they're pretty much consistent) have smaller rooms, and IF enemies have ranged attacks, they're in the 8 directions. So you can't shoot an arrow in an L-shape, like you can in a lot of roguelikes. Generally they feel as if they're more about tactical positioning (?) with a VERY heavy emphasis on fighting inside of corridors.

If you have an ipod touch (or whatever compatible device) there's also The Isle of 8 bit Treasures (https://itunes.apple.com/nl/app/the-isle-of-8-bit-treasures/id336755042?mt=8).
It uses the ipod's touch screen with virtual controls (which is pretty garbage; can't beat tactile response).
It follows the jRL formula, but spices things up a LITTLE;
You can choose from the overworld which dungeon you want to tackle, unlocking more and harder dungeons as you beat previous ones. The goal is to dive a certain amount of floors and find a macguffin. En route you can pick up powerups (stun 1 enemy, do 1 elemental attack, do 1 screenwide elemental attack, heal, etc etc.). If you make it to the macguffin any powerups you're carrying are saved in a sort of bank, from which you can withdraw them to bring them with you to your next dungeoncrawl.
Also you can use your music library to generate your weapon, weapons in this game being a sort of roulette wheel with various specials.
So you could have a hammer with the on-hit effects of
[normal normal normal firey-swipe normal normal instakill normal stun-enemy normal heal-enemy normal].

I never thought about whether that was a good system, but it did make the game less boring just by being there.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: guest509 on September 07, 2013, 09:09:59 PM
My gamepad is never unhooked. I have JoyToKey on my desktop...:-)
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: akeley on September 08, 2013, 11:07:09 AM
WHY BOTHER WHEN I CAN JUST KEEP USING THIS KEYBOARD THAT'S RIGHT IN FRONT OF ME.

Oh, come on now. Following this logic, you might as well ditch the mouse too. Though I admit that first sentence of mine you quoted is a bit flammable - but it was more of a "think out loud" moment (which is why the next two sentences were a stab at some explaining/damage limitation). While I don`t think the "more comfortable?" angle is subjective and I could argue about it, it`s a subject that`s outside the scope of this thread.

And of course I`d never advocate getting rid of KBM functionality in RLs - the point here is that adding sensible pad control would be welcome by many(?) players.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: AgingMinotaur on September 08, 2013, 09:40:16 PM
ditch the mouse

Hear, hear  :D

As always,
Minotauros
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: Holsety on September 09, 2013, 11:13:06 AM
Though I admit that first sentence of mine you quoted is a bit flammable - but it was more of a "think out loud" moment (which is why the next two sentences were a stab at some explaining/damage limitation). While I don`t think the "more comfortable?" angle is subjective and I could argue about it, it`s a subject that`s outside the scope of this thread.

And of course I`d never advocate getting rid of KBM functionality in RLs - the point here is that adding sensible pad control would be welcome by many(?) players.

Nah, don't worry about that. It was purely my reasoning, since I hardly ever plug in my gamepad. I did play some RLs on touchscreen devices AND handhelds, so I can see why people would want gamepad support.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: wire_hall_medic on September 13, 2013, 06:57:03 AM
I like how Shiren handled diagonal commands.

Pressing a direction on the d-pad entered orthogonal movement.  Unless you were holding the "diagonal" button (one of the shoulder buttons).  Then, the system would only recognize diagonal movement, which was handled by pressing two directions simultaneously.  Check out the control scheme as an example of how they did it; I'm sure there's a manual out there some where.
Title: Re: Keeping gamepads (and other odd peripherals) in mind
Post by: guest509 on September 14, 2013, 10:07:44 AM
Oh man, that's even better.