Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Variants (http://angband.oook.cz/forum/forumdisplay.php?f=4)
-   -   Variants on Android (http://angband.oook.cz/forum/showthread.php?t=10039)

Archenoth May 9, 2020 21:23

Variants on Android
 
So, I've been doing a little testing, and it seems like it's not actually terribly difficult to get most variants to compile and work on Android using Termux.
Basically, you can get enough of a compilation environment running on Android natively with it (You can just install the right tools and libraries with apt) that, with a few tweaks, I've found that mostly any variant is possible while following the building instructions for Linux.

So far I've had success with frogcomposband, Zangband, and Sil, but I bet most others will work too.

The cool things about this are:
  1. More roguelikes are playable anywhere!
  2. They take up basically no battery when playing, and if you put your phone in power saving mode, you can play on most phones for a really, really long time
  3. Termux lets you create custom key layouts, so they are actually surprisingly easy to control if you are fine with the screen size in portrait mode

For example, here's Sil:
https://pbs.twimg.com/media/EP9U1yjV...jpg&name=small

Some of the tweaks that I had to do to make it more playable include:
  • The custom keys along the top, which you can find here. (You can put that in termux.properties)
  • Use the "roguelike keyset" in the games played to keep things consistent
  • Keymap the arrow keys with hjkl directions in my keymaps (Arrows in Termux auto-repeat if you hold them down, and arrows are sometimes bound to "run a direction")

One hurdle when compiling most of these is that there is a list of system calls that Android will cause the kernel to outright kill -9 some games, which are listed here. But those aren't too difficult to discover and bypass if you just try to compile normally, and run the game through strace if it dies. (Eg "strace ./frogcomposband")

That lets you basically just grep the code for that syscall so you can replace it with nothing. (Most of them don't do anything in the single-user/single-group CLI that Android has anyway)

I know there are versions of the main game on the Play Store, and I think that's super-neat, but I figured I'd just throw out what I've been doing recently in case someone else wanted to play a variant of their choice on the go, and didn't realize this was an option without making a full-blown app!

Thoughts? Ideas? And has anyone else done something like this?

Nick May 10, 2020 00:33

That's great. I'm now considering getting an Android tablet just for this :)

Diego Gonzalez May 10, 2020 01:53

Nice! Improving the android app is quite a task, and having the chance to play variants without too many changes is great!

Archenoth May 10, 2020 03:19

Quote:

Originally Posted by Nick (Post 145337)
That's great. I'm now considering getting an Android tablet just for this :)

I find that, surprisingly enough, tablets seem to play less nicely than normal phones do. This is mostly because the size of the screen makes it hard to hit the keys comfortably. (Since you have to move your hands to hit a lot of them as opposed to being able to use them all with one hand)

Phones are weird because the size of them means that hitting any key on the keyboard isn't actually that difficult. (Like, it's about the same difference as typing on a phone instead of a computer; which people do a lot) So if you can get the directions and some of the more commonly-used special characters on the screen in a place where it's as easy to press as the keyboard keys, I find that it's surprisingly usable.

I tried on a tablet too, but all the extra distance my hands had to move to do things like movement and the fact that there wasn't a consistent way to hold it to do that means that an external keyboard was significantly more comfortable in my case.

Archenoth August 25, 2020 21:01

Heck yeah! Some of the stuff in my post got compiled into a package, so now if anyone wants to play frogcomposband in Termux, it's just a matter of running "apt install frogcomposband"~

Sil and ToME 2 will probably be next. ^^

KesTheHammer February 7, 2021 07:37

I'm no Linux expert. So I installed Termux from the play store, and typed in "apt install frogcompsband" and it said unable to locate package frogcompsband

Pete Mack February 7, 2021 10:42

@Nick--
The android port for Angband is better still.

Archenoth March 19, 2021 18:27

Quote:

Originally Posted by KesTheHammer (Post 150990)
I'm no Linux expert. So I installed Termux from the play store, and typed in "apt install frogcompsband" and it said unable to locate package frogcompsband

Oh! That should be frogcomposband

You can tab complete it pretty early into the name to avoid needing to type the whole thing too~

Pete Mack March 20, 2021 01:18

@Archenoth--
I tried playing in Termux at one point, but I couldn't get around the soft keyboard. It doesn't have a raw mode, as angband requires. (It also mucks up the command line.)

Archenoth March 24, 2021 07:15

Quote:

Originally Posted by Pete Mack (Post 152004)
@Archenoth--
I tried playing in Termux at one point, but I couldn't get around the soft keyboard. It doesn't have a raw mode, as angband requires.

Yeaaah, that's why I usually ended up adding the layer of custom keys into Termux to play. Doing it with just the keyboard on its own would be pretty tricky.
The custom key row allows for key repeats and other fancy things to be put wherever you like, though it does require some setup. (That's actually why I mentioned this if you wanted to use my key setup instead of making your own from scratch.)

Quote:

Originally Posted by Pete Mack (Post 152004)
(It also mucks up the command line.)

Oh? It really shouldn't act differently than running it in a normal terminal.

If you have more information, maybe I can find out what's happening here. :o

Pete Mack March 24, 2021 11:14

The soft keyboard disables echo in Termux until words are complete, and it tries to form actual words, which ... doesn't really fit the unix philosophy. I even tried messing around with stty, but it doesn't actually propagate up to the keyboard as it should.

KesTheHammer March 24, 2021 14:13

Quote:

Originally Posted by Archenoth (Post 151989)
Oh! That should be frogcomposband

You can tab complete it pretty early into the name to avoid needing to type the whole thing too~

I tried again, no success. (I retyped the lines below, I did not copy and paste them from my phone)

Code:

$ apt install frogcomposband
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package frogcomposband


Archenoth March 24, 2021 19:04

Quote:

Originally Posted by KesTheHammer (Post 152147)
I tried again, no success. (I retyped the lines below, I did not copy and paste them from my phone)

Code:

$ apt install frogcomposband
Reading package lists... Done
Building dependency tree... Done
E: Unable to locate package frogcomposband


Ohh! You might not have your repos populated! You might need to "apt update" first.

After that, you should be able to see it.


Quote:

Originally Posted by Pete Mack (Post 152133)
The soft keyboard disables echo in Termux until words are complete, and it tries to form actual words, which ... doesn't really fit the unix philosophy. I even tried messing around with stty, but it doesn't actually propagate up to the keyboard as it should.

Oh huh, that seems...wrong. (And like it would be pretty annoying :o)

What keyboard are you using? gboard for me doesn't buffer anything--it just instantly sends my keystrokes to the games.

Pete Mack March 24, 2021 19:16

Just the default installed keyboard. I tried Google keyboard but it was worse. I'll try gboard, thx.

Archenoth March 24, 2021 19:25

It also occurs to me there is another reason it could be buffering.

If you swipe left on the custom keys area, you get a textbox for typing literal text with added OS-level support. That will also buffer keystrokes until you swipe right again on the box.

That mode is designed for typing actual sentences and stuff into Termux, but would suit roguelikes poorly. ^^'

KesTheHammer April 7, 2021 13:27

After running

Code:

apt update
and then

Code:

apt install frogcomposband
I typed in frogcomposband and got this message:
Code:

frogcomposband: Angband needs an 80x24 'curses' screen

Archenoth April 9, 2021 21:55

Oh good! You managed to get it~ ^^

That message means that Termux doesn't have enough space to show you the game. You can pinch the screen to zoom it out, or if you have an overlay keyboard (Or an external one), you can rotate the screen to be landscape. That should give you more screen real-estate

When your terminal can fit 80 characters horizontally, and 24 vertically, it should run..!

KesTheHammer April 14, 2021 11:49

can you please lastly assist with adding the characters for the keyboard as discussed earlier. I am absolutely not Unix-literate.

Archenoth April 16, 2021 22:55

For my layout, you should be able to just paste...

Code:

wget https://gist.githubusercontent.com/Archenoth/0ef3a2eddb1ddebbcadc46aafc500984/raw/cb33e1fe5fddbcc22ab84e1960a520e9cde10879/termux.properties -P ~/.termux
...into your terminal and restart Termux. ("~" is your home folder, and ".termux" is the place a lot of configuration for the terminal goes. The wget is just downloading my config into that folder for the next time it gets read!)

If you get a message that wget doesn't exist, you can install it with "apt install wget", and then you can try the above again!

And if you aren't familiar with the Termux keybindings, Volume Down is like holding Ctrl, so Volume Down + X should save and quit when you're in any bands. You can also Volume Down + D to exit the terminal when you are at the command line.

I hope that's helpful! ^^
Unix stuff can be kinda confusing if you aren't familiar with it

KesTheHammer April 17, 2021 17:40

Thank you very much. It works 100%.

Archenoth April 17, 2021 21:00

Nice! Happy I could help~ :D

I really should package a few more variants so that there's more than just frog and vanilla in the repos currently.

Pete Mack April 18, 2021 04:34

Archeron-
The full Android port already has V 4.2.2, Frog (Selmiak), Sil-Q 1.4.2, and NPP 0.4.1 and 0.5.4
It's quite good.

ionarevamp April 28, 2021 20:58

Quote:

Originally Posted by Archenoth (Post 152601)
For my layout, you should be able to just paste...

Code:

wget https://gist.githubusercontent.com/Archenoth/0ef3a2eddb1ddebbcadc46aafc500984/raw/cb33e1fe5fddbcc22ab84e1960a520e9cde10879/termux.properties -P ~/.termux
...into your terminal and restart Termux. ("~" is your home folder, and ".termux" is the place a lot of configuration for the terminal goes. The wget is just downloading my config into that folder for the next time it gets read!)

If you get a message that wget doesn't exist, you can install it with "apt install wget", and then you can try the above again!

And if you aren't familiar with the Termux keybindings, Volume Down is like holding Ctrl, so Volume Down + X should save and quit when you're in any bands. You can also Volume Down + D to exit the terminal when you are at the command line.

I hope that's helpful! ^^
Unix stuff can be kinda confusing if you aren't familiar with it

For me, using the wget option simply downloaded another version of termux.properties, leading me to have to delete the original via cd .termux from home directory and using rm termux.properties
Then I typed mv termux.properties.1 termux.properties to rename it
After that, it worked fine.

Another thing that I found is, if you want to use the same back key functionality as some other angdroid apps, you can set
Code:

back-key=escape
in termux.properties for convenience.


All times are GMT +1. The time now is 18:13.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.