Android Version

Hi everyone,

Michael here - I’m new to the forums, but I think my first post should go down pretty well. :smiley:

I’ve spent the last few weeks porting Cataclysm: DDA (0.C Experimental) to Android, and have just launched an open beta test on Google Play. I’ll be releasing this for free when it’s done.

Google Play
APK Downloads
GitHub

Features:

  • Tilesets, sound, localization, lua mod support
  • Backwards compatible with desktop 0.C save games
  • Stores game data in a publicly writeable location:
    /sdcard/Android/data/com.MichaelDavies.CataclysmDDA/files/
  • Supports installation of custom tilesets, mods, soundpacks, and save games
  • Works with a physical keyboard or virtual keyboard & touchscreen
  • Auto-saves when the app loses focus (screen locked, switched apps etc.)
  • Highly customizable touch controls and automatic in-game contextual shortcuts

Controls:
[pre]Swipe: Directional movement (hold for virtual joystick)
Tap: Confirm selection (menu) or Pause one turn (in-game)
(hold to Pause several turns in-game)
Double-tap: Cancel/Go back
Pinch: Zoom in/out (in-game)
Back button: Toggle virtual keyboard
(hold to toggle keyboard shortccode)
[/pre]
Tips:

  • At the bottom of the screen you will sometimes see keyboard shortcuts.
  • Many screens within the game already have convenient shortcuts assigned, but as you play, typing a key will add it to the shortcuts for that screen.
  • Remove a shortcut by flicking up on it. Hold it down to see help text.
  • Android-specific options live under Settings > Options > Android.
  • Adjust terminal size under Settings > Options > Graphics (req’s restart).
  • For the best keyboard experience, use an SSH-friendly virtual keyboard such as “Hacker’s Keyboard” on the Google Play store.

Known issues:

  • On certain devices all text will appear garbled. This is a hardware acceleration bug in SDL. A temporary workaround is to rename ‘/sdcard/Android/data/com.MichaelDavies.CataclysmDDA/files/gfx’ to ‘gfx-temp’, launch the game, enable ‘Options > Graphics > Software rendering’ and set ‘Options > Android > Screen orientation’ to ‘Landscape’, save + quit, and finally rename gfx-temp back to gfx.
  • As the game uses quite a bit of memory, it’s likely that Android will kill the game when you switch focus to another app, especially on devices with <= 2GB of RAM.
  • Performance will obviously vary depending on your device. I’ve found it very playable on an HTC One M8 for reference.
  • Auto-saving when the app loses focus seems to work great, but I’m still a little nervous about it, as it means a quicksave can be triggered while you’re in the middle of an in-game screen (eg. talking to an NPC, modifying a vehicle etc.) So if you want to play it safe, try and only lock your screen if you’re in the main game view awaiting your turn.

I plan on running the beta for the next 3-4 weeks, but once it’s released I’ll continue working on it periodically.

Everyone is welcome to contribute to the source code. Please don’t be shy with bug reports, feedback and suggestions.

Cheers,
Michael

Screenshots:


Note the keyboard shortcuts on the bottom left. These are fully customizable and change depending on where you are in the game.


The entire screen acts as an 8-way virtual joystick for navigating the game/menus.


Hovering on a keyboard shortcut will display help text for it.


Lots of Android options, implemented within the game’s native UI.


Using a 0.C Experimental build from a week or two ago.


Another example of the shortcuts. In this shot, " c and e are automatically added by the game, since it’s likely you’ll want to run, or close a door, or examine the vehicle.


The shortcuts’ appearance can be customized in the options.

12 Likes

At what point did you fork the code?

0.C-20818-g6ec9931: https://github.com/CleverRaven/Cataclysm-DDA/tree/6ec993170276a437ee3f8d13937799f20a67f3f1

(And in human terms, around the 23rd February 2017.)

You missed a minor fix for the chemical sprayer: https://github.com/CleverRaven/Cataclysm-DDA/pull/20095 . Just lower reload time from 900 to 10.

From what I’ve seen it looks good! Was it difficult to adapt the game to Android?

Ah excellent, thank you - I’ll slip that in the build. I wasn’t sure when would be a good time to grab a snapshot, so I just held my breath and pulled tip from master. :slight_smile: If there’s a good time in the near future to pull latest from git I’ll do that too.

The port was a challenge for sure. I’ve made games before for Android using Unity 3D, but this was my first time using the Android SDK + NDK natively. I had a read through COMPILING.md to get a gist of CDDA’s dependencies, then started fishing around online to see if anyone else had ported an SDL2 game to Android before. I stumbled across the Android source code for Dungeon Crawl Stone Soup which helped a lot, as the author documented his process of doing the port.

The most difficult bit was just setting up the bloody SDK + NDK - it’s a convoluted process because you have to run the C/C++ code through ndk-build, and then after that run the make file for the Java application, so there was lots of makefile dependencies and shenanigans to sort out. Thankfully SDL + Lua were pretty easy to get compiling under the NDK - once they were configured correctly they just worked (including sound!). I’m hoping its the same for gettext so I can get localization working.

Another obstacle was the fact that the NDK stores all your game data inside the APK ZIP, which means you can’t access the files through C/C++ with standard input/output streams. SDL provide wrapper functions to read/write from the APK assets directly, but I didn’t fancy rewriting all the file IO stuff in Cata so I set up a Java pre-install step which extracts the game data from inside the APK to the app’s external files folder. Turns out this was a good idea anyway as it allows people to mess with the game data to change fonts, install soundpacks, mods, save games etc.

I vividly remember the first time I ran the game and instead of crashing on launch, the main menu appeared. I did a happy dance around the living room while my wife stared at me with a blank expression. Once I got to this point it was smooth sailing, I’m a commercial C++ gamedev with plenty of experience in UI design, so getting nice Android controls working within the Cata codebase was the fun part.

3 Likes

Holy small potatoes. I’m gonna try this. Can you add tilesets? So I can add my own later, though I’m not sure if I need to change anything or do anything special.

I also can translate the description to Spanish, if you want!

Yeah you can mess with the data just like you would on a desktop build. Game data + user saves all live under here:
/sdcard/Android/data/com.MichaelDavies.CataclysmDDA/files/

Holy crap u wont believe me if i tell you how long i have waited for this.

You are sir are a god thank you so much.

2 Likes

Haha, I completely agree! The last 12 months I’ve been quietly hoping someone else would do it, but I had the time recently and figured it’d be a fun challenge. Plus this way I could implement the controls exactly how I wanted, I’m a bit fussy when it comes to touchscreen interfaces. (That said, if the controls annoy you or you have a suggestion, I’m happy to add extra options.)

2 Likes

I know I posted already but just want to say again this is freaking awesome.

I realy have waited a long ass time for this :slight_smile:

Thanks again mate :slight_smile:

LOL you only waited 12 months :stuck_out_tongue:

Try since CDDA was released :stuck_out_tongue: thats how long I waited.
I did try to get an android port with the help of some very nice people from the forums and the IRC but I was way over my head.

Any way mate truly do appriciate this I am so excited :).

One question can we use mods and sound packs?

I use the CDDA launcher on windows its amazeing and it gives you an optoin to install different sound packs and mods.

Thanks again you wizard :slight_smile:

EDIT

Sorry missed the part thats mods are compatible I was in such a rush and hype to install and test that tbh I kind of just clicked the download link LOL :slight_smile:

There’s one bug I’m looking into at the moment which has happened on a handful of devices only. There seems to be something wacky going on with the text printing:

World create screen:

It seems like the game is running fine, but when it draws a window + prints text, certain characters are repeating several times across multiple cells (and obscuring other characters/cells in the process).

I haven’t changed any of this code from the desktop build, so my gut feeling is it’s perhaps an uninitialized value somewhere in the window/text printing functions that’s fine on desktop and most devices by chance, but not on a handful of these Android devices.

If any of the CDDA devs have any thoughts on this I’m all ears - I’ll keep looking at it on my side though I can’t repro it on my device or on my Genymotion emulators so it’s a bit tricky to track down, might have to enlist the help of someone testing it and dump out some logging info.

Seems fine on note 3 so far just for referance :).
The note 3`s are as phones go a beast though or was back in the day and tbh still are realy.

3gb ram quad core CPU etc etc

EDIT

Also if there is an admin here and IF a1studmuffin agrees this thread deserves to be stickyed like the IOS version :slight_smile:

You sir have just become my personal hero! I’ve been craving for this for soooo long.

I’ll test and come back with feedback, THANK YOU SO SO SO MUCH!

It’s fantastic!
It works fine, but plz in next time compile game with support of other languages (i create “lang” folder and place russian mo, but this didnt work).
And add your payments requisites :slight_smile:

Localization support is definitely on the list! Thanks for the kind words everyone.

1 Like

I set russian language in seetings but game still english.


So, half an hour of play:

Stability:

  • Works great on my one plus one (5.5’), am on marshmallow if it matters. No crashes, everything super stable, only a hang when I suicide a test run, which cleared up in the end.
  • Probably loading time in the beginning when starting up would be great if you can implement, just staring at the black screen seems weird.
  • I loaded a run I’ve been playing for the past week and it works fine as well!

Controls:

  • Super fluid, I was baffled a bit in the beginning but once I got used to it … man this is one amazing work here, I love the swipe movement and tap shortcuts, the most used shortcuts is great as well.
  • One thing here though, in order for something to be added to the used shortcuts you need to activate it once, this means that I need to pull up the keyboard and activate for example V(iew) and then I have it in the shortcuts - this is not something difficult for people used to the game but may be a bit daunting for new players. If possible, not sure how difficult to implement, maybe it would be nice to have next to the ? a button on which if you press a view comes in sight in which you could have a sort of a table with the actions in game to select from (like a list or something).

Graphics:

  • In game graphics look good as well.
  • I noticed if I change the resolution to a higher one and start the game, the screen with explanations that you wrote at the beginning does not scale, it remains a bit smaller to the left up side.

All in all i am super hyped about this, THANK YOUUUUU!

Thanks for the detailed feedback, very useful.

RE: the shortcuts expanding idea to save new players needing to bring up the keyboard, the quickest dirtiest solution I can think of for that would be having a shortcut to the Action Menu by default. If they perform actions from that, they’ll end up in the shortcuts list… might be enough? Otherwise it’s tricky as there’s a lot of actions that can be performed in the default game mode.

RE: blank screen + intro text not scaling, agree 100%, cheers for the feedback.

Really glad to hear it’s all working well aside from those minor things though.

Pretty amazing, it’s incredibly smooth and I love what you’ve done with the controls.
Let me know if there’s anything you need mainlined to make sure we don’t break you down the road.

I set russian language in seetings but game still english.[/quote]
I assume he hasn’t bult the localization library yet (gettext), it can be challenging to work with.