Improved keyboard/dpad handling

Discussions of the development process of the game.
Einsame Hirte
Posts: 25
Joined: Sun Jan 24, 2021 8:22 pm
android_version: 11 - Android 11

Improved keyboard/dpad handling

Post by Einsame Hirte »

I just submitted a draft pull request for improved keyboard and dpad input handling, including diagonals and keys for attack, flee, end turn, and the hero info screen. I'm interested in what people think would be good choices for these shortcut keys. Ultimately, there should be a way for the player to choose them, but at least initially they'll probably need to be hard coded. The current mappings are below; I tried to pick keys that are easy to use for the different available input methods (WASD, arrows, numpad).

Note that the Attack and Flee keys freeze motion while pressed to allow initial diagonal movement on 4-way controllers/WASD/arrow keys (these controls combine two key events for diagonals, so one will always get processed first resulting an initial orthogonal movement if not frozen).

Code: Select all

		// Keys mapping to ATTACK
		key = KEY_ATTACK;
		keyMap.put(KeyEvent.KEYCODE_DPAD_CENTER, key);
		keyMap.put(KeyEvent.KEYCODE_BUTTON_A, key);
		keyMap.put(KeyEvent.KEYCODE_SPACE, key);
		keyMap.put(KeyEvent.KEYCODE_NUMPAD_5, key);

		// Keys mapping to FLEE		
		key = KEY_FLEE;
		keyMap.put(KeyEvent.KEYCODE_BUTTON_X, key);
		keyMap.put(KeyEvent.KEYCODE_F, key);
		keyMap.put(KeyEvent.KEYCODE_NUMPAD_ENTER, key);
		keyMap.put(KeyEvent.KEYCODE_ENTER, key);

		// Keys mapping to END_TURN
		key = KEY_END_TURN;
		keyMap.put(KeyEvent.KEYCODE_BUTTON_Y, key);
		keyMap.put(KeyEvent.KEYCODE_E, key);
		keyMap.put(KeyEvent.KEYCODE_FORWARD_DEL, key);
		keyMap.put(KeyEvent.KEYCODE_NUMPAD_DOT, key);

		// Keys mapping to HERO_INFO 		
		key = KEY_HERO_INFO;
		//keyMap.put(KeyEvent.KEYCODE_BUTTON_SELECT, key);
		keyMap.put(KeyEvent.KEYCODE_BUTTON_L1, key);
		keyMap.put(KeyEvent.KEYCODE_NUM_LOCK, key);
		keyMap.put(KeyEvent.KEYCODE_C, key);

		// Keys mapping to TOOLBOX 	((DOES NOT WORK YET)	
		key = KEY_TOOLBOX;
		keyMap.put(KeyEvent.KEYCODE_BUTTON_R1, key);
		keyMap.put(KeyEvent.KEYCODE_NUMPAD_DIVIDE, key);
		keyMap.put(KeyEvent.KEYCODE_B, key);
Please see the notes on the pull request for additional info.
User avatar
Antison
Posts: 4338
Joined: Mon Mar 28, 2011 11:33 pm
android_version: 12 - Android 12
Location: A home without a beagle is just a house

Re: Improved keyboard/dpad handling

Post by Antison »

I really don't see a need for keyboard support as the game is designed for touch screen on mobile devices (phones mostly, but tablets are supported to some extend) and don't have a need for a keyboard.
"A home without a beagle is just a house"
Einsame Hirte
Posts: 25
Joined: Sun Jan 24, 2021 8:22 pm
android_version: 11 - Android 11

Re: Improved keyboard/dpad handling

Post by Einsame Hirte »

To be clear, this patch doesn't add keyboard support; it just improves what is already there. And while playing on the touch screen is certainly the most convenient for casual gaming, there are some advantages to using a dpad or keyboard - not least avoiding RSI from constant tapping during combat (someone actually complained about this on Google Play). Even without this patch, grinding is a LOT easier with a keyboard/dpad - you just walk into the monster and it keeps hitting them until they die (or they get a critical hit and kill you because you're not paying enough attention).

Decent keyboard support may also open it up to more players, including disabled people with alternate input devices, and possibly platforms like Android TV (hypothetically; I don't know much about it).

And every rogue-like I've played uses a keyboard, starting with vi-style HJKL in hack. It's tradition, if nothing else.
slacker
Posts: 11
Joined: Tue Mar 19, 2019 6:45 pm
android_version: 10 - Android 10

Re: Improved keyboard/dpad handling

Post by slacker »

Hope to see improved keyboard. I play on both phones/tablets and on Android TV. Gameplay on TV is good, but lack of keyboard shortcuts is a major hassle.
User avatar
rijackson741
Posts: 4146
Joined: Tue Aug 20, 2013 2:04 am
android_version: 10 - Android 10
Location: Somewhere in Dhayavar
Contact:

Re: Improved keyboard/dpad handling

Post by rijackson741 »

I am not against this, but it is not high priority. Think about the number of players this would benefit relative to the total number of players. I have no way to know exactly what that is, but I am sure it's very small.
Level:71, XP:6493739, PV:608, FQ:84
HP:210, AC:212, AD:58-77, AP:4, ECC:16%, CM:1.5, BC:188, DR:3
Gold: 237559 | RoLS:1, RoL:1, GoW:1, VSH:1, RoFLS:1, WoB:1
HH:1, WA:1, CS:2, Cl:1, IF:4, Ev:3, Re:2, WP:DA:1, WP:1S:1, WP:B:1, AP:L:1, FS:DW:2, S:DW:1
slacker
Posts: 11
Joined: Tue Mar 19, 2019 6:45 pm
android_version: 10 - Android 10

Re: Improved keyboard/dpad handling

Post by slacker »

Number of users would be small, agreed. But it would make the TV experience much more enjoyable. And, who knows, may drive TV usage.
slacker
Posts: 11
Joined: Tue Mar 19, 2019 6:45 pm
android_version: 10 - Android 10

Re: Improved keyboard/dpad handling

Post by slacker »

Guess nothing has changed since 2012.

viewtopic.php?p=21992&hilit=Keyboard#p21992
> Full support for keyboards with key mapping and such is low on our priority list
Einsame Hirte
Posts: 25
Joined: Sun Jan 24, 2021 8:22 pm
android_version: 11 - Android 11

Re: Improved keyboard/dpad handling

Post by Einsame Hirte »

The pull request I submitted last April supports 4- and 8-way dpad controls (both direct and chording) and hot keys for attack, flee, end turn and hero info. Most of the game is playable without touching the screen, although some of the menu navigation is a bit tricky, as I recall - it's been a while since I worked on it. I was planning on working to add additional functions, but gave up when I didn't get any feedback and the dev team's position on the subject became clear (see above).

The patch is showing a conflict against the current master branch, and I don't have the AT development environment set up anymore (it requires an ancient version of Android Studio), but I can set it up again and resolve it if there is actually interest in merging it.
User avatar
Antison
Posts: 4338
Joined: Mon Mar 28, 2011 11:33 pm
android_version: 12 - Android 12
Location: A home without a beagle is just a house

Re: Improved keyboard/dpad handling

Post by Antison »

Einsame Hirte wrote: Mon Jan 03, 2022 6:17 am

The patch is showing a conflict against the current master branch, and I don't have the AT development environment set up anymore (it requires an ancient version of Android Studio), but I can set it up again and resolve it if there is actually interest in merging it.
You just hit on one of our biggest needs. Getting the source code and ATCS migrated to the latest version of Java.
"A home without a beagle is just a house"
Einsame Hirte
Posts: 25
Joined: Sun Jan 24, 2021 8:22 pm
android_version: 11 - Android 11

Re: Improved keyboard/dpad handling

Post by Einsame Hirte »

I'm not an experienced Android or Java developer (I actually updated AS to start learning Kotlin), so this might be a bit over my head, but can you outline what the major issues are in updating the code?
Post Reply