# Android port (on hold)

**URL:** <https://discourse.cataclysmdda.org/t/android-port-on-hold/1726>\
**Category:** The Lab\
**Created:** [June 11, 2013, 3:50pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726 "2013-06-11T15:50:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 11, 2013, 3:50pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/1 "2013-06-11T15:50:24Z")

</div>

Github repo: [https://github.com/utunnels/Cataclysm-DDA/tree/android](https://github.com/utunnels/Cataclysm-DDA/tree/android)  
Compiled binary: [https://www.dropbox.com/s/fqy4wf33zppasyd/DDA4droid.7z](https://www.dropbox.com/s/fqy4wf33zppasyd/DDA4droid.7z)

Currently I edit all paths to let DDA load from sdcard. So the code isn’t compatible with other platforms.

It is a headache to display the keyboard, because my phone has a 480x800 screen. Though it looks OK in landscape view, there won’t be any place to put the screen keyboard. So I use portrait view and 6x12 bmp font.

I wonder how it looks like on a device that has bigger resolution.

[hr]  
\*Edit

Update the app to use landscape view. Change font size to 8x16.

Hit back button or the icon at lower botto corner to bring up the keyboard.

You can also edit data/android.keys to add your own quick key list.

![](http://smf.cataclysmdda.com/index.php?action=dlattach;topic=1786.0;attach=176;image)

* * *

![](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/6daef411c239d0699a7d51942cfd7c2a9255722d.png)

---

<div class="post-metadata">

**Author:** ![Isylwin](https://avatars.discourse-cdn.com/v4/letter/i/b19c9b/32.png) [@Isylwin](https://discourse.cataclysmdda.org/u/Isylwin)\
**Post date:** [June 11, 2013, 4:16pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/2 "2013-06-11T16:16:36Z")

</div>

This looks awesome, now I can slap zombies with crowbars while literally shitting myself.  
Props to you man

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [June 11, 2013, 4:17pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/3 "2013-06-11T16:17:15Z")

</div>

So now I have to get the android dev environment installed on my computer…

Wow utunnels, just wow. I can’t wait to check this out.

---

<div class="post-metadata">

**Author:** ![SpaniardSlayer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/spaniardslayer/32/94_2.png) [@SpaniardSlayer](https://discourse.cataclysmdda.org/u/SpaniardSlayer)\
**Post date:** [June 11, 2013, 4:24pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/4 "2013-06-11T16:24:06Z")

</div>

Awesome! Will this run well on slower/older phones such as my Xperia Play?

---

<div class="post-metadata">

**Author:** ![anon388770](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@anon388770](https://discourse.cataclysmdda.org/u/anon388770)\
**Post date:** [June 11, 2013, 5:29pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/5 "2013-06-11T17:29:21Z")

</div>

Now I want to buy an android. This. Is. Awesome.

---

<div class="post-metadata">

**Author:** ![SpaniardSlayer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/spaniardslayer/32/94_2.png) [@SpaniardSlayer](https://discourse.cataclysmdda.org/u/SpaniardSlayer)\
**Post date:** [June 11, 2013, 5:39pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/6 "2013-06-11T17:39:12Z")

</div>

Welp, I tried running it on my phone, but when i generate a new world, there’s a bunch of stuff (looks like graphical glitches) covering the screen.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [June 11, 2013, 6:11pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/7 "2013-06-11T18:11:04Z")

</div>

Seems to work fine on my D2G, hard to test because the OSC is ridiculously difficult to use.  
If we can streamline the input (not terribly happy about the prospect, but probably with some kind of command menu), this looks like it will actually work.

Particularly for testing, might see if we can get wifi keyboard working with it. Also it crashes if I slide out my keyboard.

Astounding utunnels, simply astounding.

---

<div class="post-metadata">

**Author:** ![LazyCat](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@LazyCat](https://discourse.cataclysmdda.org/u/LazyCat)\
**Post date:** [June 11, 2013, 6:17pm UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/8 "2013-06-11T18:17:48Z")

</div>

[quote=“utunnels, post:1, topic:1726”]Github repo: [GitHub - utunnels/Cataclysm-DDA at android](https://github.com/utunnels/Cataclysm-DDA/tree/android)  
Compiled binary: [Dropbox - DDA4droid.7z - Simplify your life](https://www.dropbox.com/s/fqy4wf33zppasyd/DDA4droid.7z%5B/quote%5D)

That’s pretty good, there even seems to be support for audio ready. Did you make all that just for Cataclysm or you used some skeleton of some previous port? Have you tried playing any sounds from the native part of the code, is audio support complete?

Can you name the tools you used and describe compilation process? Are there any files that need to be manually moved between native and Java compilations? Is there anything unusual that needs to be done to get it compiled?

> It is a headache to display the keyboard, because my phone has a 480x800 screen. Though it looks OK in landscape view, there won't be any place to put the screen keyboard. So I use portrait view and 6x12 bmp font.

You could enable auto rotation anyway. If you are just moving from place to place all you need is the touch-screen, then when the keyboard is required you simply rotate the phone. Alternatively the right side of the screen with messages, radar and player info could be separated and moved below the main view, something like this:

![](http://img4.imageshack.us/img4/319/androidportrait.jpg)

> I wonder how it looks like on a device that has bigger resolution.

It’s pretty small even for 7 inch tablet. The game definitively needs landscape view, with some custom keyboard/controls panel, or vertically split windows like on that screenshot above.

> It is based on SDL 2.0 and it seems there's some bug when using both finger touch event and text input event. Otherwise I would have simulated the directional buttons. For now you have to use hjkl or numbers to move your character.

Perhaps for a quick hack you could use screen rotation event to disable one and enable the other, enable touch screen and disable text input when in landscape and the other way around when rotated to portrait.

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 12, 2013, 12:05am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/9 "2013-06-12T00:05:57Z")

</div>

Yeah, it is just a quick port. Perhaps I can draw DDA keyboard with only required keys on it so I can forget the bug.

---

<div class="post-metadata">

**Author:** ![Soron](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/soron/32/885_2.png) [@Soron](https://discourse.cataclysmdda.org/u/Soron)\
**Post date:** [June 12, 2013, 12:06am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/10 "2013-06-12T00:06:47Z")

</div>

So… now we need to make our paths more readily configurable, so that we can merge this into mainline. Yeah?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [June 12, 2013, 12:22am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/11 "2013-06-12T00:22:32Z")

</div>

Goddamnit, I want an IOS version.

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 12, 2013, 12:27am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/12 "2013-06-12T00:27:09Z")

</div>

> [@Soron](#):
>
> So… now we need to make our paths more readily configurable, so that we can merge this into mainline. Yeah?

Yeah, more need to be planned out if we take the project seriously. It is more like a curious attempt. I had a day off yesterday so I sat and coded the thing. 😛

Perhaps DDA has relative bigger side menu so the display area is really tiny. There can be a way to configue the layout but I know it needs lots of work.

Check nethack for example: [https://play.google.com/store/apps/details?id=com.nethackff&hl=en](https://play.google.com/store/apps/details?id=com.nethackff&hl=en)

Personally I don’t feel the experience is too good for the reason the screen is really tiny. I can barely read the menus.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [June 12, 2013, 3:40am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/13 "2013-06-12T03:40:35Z")

</div>

Ok so everytime I click open it boots me back to the home screen what did I do wrong.

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 12, 2013, 3:47am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/14 "2013-06-12T03:47:42Z")

</div>

Probably you are missing the data folder. Copy Cataclysm-DDA folder to your sdcard.

It looks like:

/mnt/sdcard/Cataclysm-DDA

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [June 12, 2013, 3:50am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/15 "2013-06-12T03:50:46Z")

</div>

Ok i’ll try it

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/cataclysmdda/original/1X/21b5d044e8473b25d0bf905d60477e25f6fbe0cf.png) [@system](https://discourse.cataclysmdda.org/u/system)\
**Post date:** [June 12, 2013, 3:57am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/16 "2013-06-12T03:57:27Z")

</div>

No its there what do I run it from the debug yhat comes with it.

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 12, 2013, 4:10am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/17 "2013-06-12T04:10:15Z")

</div>

No idea. Maybe the app used some device specific feature so it doesn’t always work.  
By the way, do you install the apk correctly? But the chance is small since android usually doesn’t let you do that if your system doesn’t meet the requirement of the app.

---

<div class="post-metadata">

**Author:** ![LazyCat](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@LazyCat](https://discourse.cataclysmdda.org/u/LazyCat)\
**Post date:** [June 12, 2013, 5:40am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/18 "2013-06-12T05:40:33Z")

</div>

> [@utunnels](#):
>
> Yeah, it is just a quick port. Perhaps I can draw DDA keyboard with only required keys on it so I can forget the bug.

Can you name the tools you used and describe compilation process?

At what stage is audio support, can it play sounds from the native part of the code?

Are you not going to do what I suggested and enable auto rotation and touch screen input for landscape view?

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [June 12, 2013, 6:13am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/19 "2013-06-12T06:13:13Z")

</div>

It is hard to start. You need to download and install android sdk/ndk from official site first, follow their instruction. It took me ages to do so before…After that you need only to run build.bat under android folder (from the github repo). The names of the files explain enough.

SDL 2.0 download (source) contains an empty android project. That is what I worked based on.

As for audio, I don’t know. If SDL\_mixer can be ported to SDL 2.0, it is possible.

---

<div class="post-metadata">

**Author:** ![LazyCat](https://avatars.discourse-cdn.com/v4/letter/l/ecc23a/32.png) [@LazyCat](https://discourse.cataclysmdda.org/u/LazyCat)\
**Post date:** [June 12, 2013, 8:51am UTC](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726/20 "2013-06-12T08:51:14Z")

</div>

[quote=“utunnels, post:19, topic:1726”]It is hard to start. You need to download and install android sdk/ndk from official site first, follow their instruction. It took me ages to do so before…After that you need only to run build.bat under android folder (from the github repo). The names of the files explain enough.

SDL 2.0 download (source) contains an empty android project. That is what I worked based on.

As for audio, I don’t know. If SDL\_mixer can be ported to SDL 2.0, it is possible.[/quote]

I see, some kind of official template, that’s convenient. It’s also the hardest part, initialising and setting it all up. So I searched for similar templates that include SLD\_mixer initialisation and all the necessary files. Not official but this seems should do the job:

[http://www.midnightfragfest.com/2012/05/04/sdl-2-0-android-project-template/](http://www.midnightfragfest.com/2012/05/04/sdl-2-0-android-project-template/)

In “…/jni/SDL\_android\_main.cpp” there are hooks for native access to touch screen input, key up and key down events they are commented out. Is that what you said you have disabled or does it come like that in the template? Do you know what is supposed to be the purpose of those bindings when input can already be handled from native code via standard SDL\_PollEvent?

[Next page](https://discourse.cataclysmdda.org/t/android-port-on-hold/1726.md?page=2)
