OpenXcom Forum

Contributions => Builds & Ports => Topic started by: Asmin on January 06, 2013, 03:52:36 pm

Title: Android Port (SDL2)
Post by: Asmin on January 06, 2013, 03:52:36 pm
Any updates?
I bet a lot of people would love to run openxcom on their androids!
Have a great holidays ;)
Title: Re: Android Port
Post by: HappyCat on May 22, 2013, 01:27:18 pm
With 0.9 it becomes interesting again. Sadly, I have almost no experience in android programming myself.
Title: Re: Android Port
Post by: SupSuper on May 24, 2013, 07:54:57 pm
SDL is cross-platform so it shouldn't be too hard, seems it's already been done for other SDL projects: https://libsdl-android.sourceforge.net/

I dread to think how OpenXcom performs on mobile devices though...
Title: Re: Android Port
Post by: Amunak on May 25, 2013, 05:09:09 pm
SDL is cross-platform so it shouldn't be too hard, seems it's already been done for other SDL projects: https://libsdl-android.sourceforge.net/

I dread to think how OpenXcom performs on mobile devices though...

Better than emulated in DosBox I'd guess :)
Title: Re: Android Port
Post by: xracer on May 28, 2013, 07:56:00 pm
how will it work, with the required data?

would we have to compile, insert the data and the create the .apk?

I think that for us lowly non-programmer people that will be trouble some.

And i know that you guys do not want to distribute the original artwork.

What are your thoughts Sup?
Title: Re: Android Port
Post by: HappyCat on September 05, 2013, 12:20:09 pm
As far as I can see, it's possible to require user to provide folder with original data on the first run.
Title: Re: Android Port
Post by: SupSuper on September 06, 2013, 05:45:52 am
You can still access external data on the memory card, much like ScummVM and DosBOX do, no need to embed it into the APK.
Title: Re: Android Port
Post by: sidav on November 02, 2013, 07:02:00 pm
Is there still hope for the port?
Title: Re: Android Port
Post by: SupSuper on November 03, 2013, 01:17:27 am
Probably the best chance would be porting to SDL2, as it's the least disrupting option, but it would still require a fair amount of change.
Title: Re: Android Port
Post by: page on November 22, 2013, 01:22:52 pm
Is there still hope for the port?

There is hope: https://www.youtube.com/watch?v=ImQyW7A8hcw (https://www.youtube.com/watch?v=ImQyW7A8hcw)  ;)
Title: Re: Android Port
Post by: starwindz on November 22, 2013, 03:17:38 pm
There is hope: https://www.youtube.com/watch?v=ImQyW7A8hcw (https://www.youtube.com/watch?v=ImQyW7A8hcw)  ;)
This is a real hope! I am looking forward to see 1.0 version of apk release. :)
Title: Re: Android Port
Post by: starwindz on November 24, 2013, 05:09:39 am
There is hope: https://www.youtube.com/watch?v=ImQyW7A8hcw (https://www.youtube.com/watch?v=ImQyW7A8hcw)  ;)

Splendid job! I strongly would like to know the following information and run OpenXcom on my Android smartphone and tablet PC.

1. How to merge 'SupSuper's the latest git master' and 'your android code'?
2. How to set up the android compile environment and how to compile the source code?
3. How to install .apk file and how to run OpenXcom-android?

Thank you very much.
Title: Re: Android Port
Post by: SupSuper on November 24, 2013, 08:36:18 am
There is hope: https://www.youtube.com/watch?v=ImQyW7A8hcw (https://www.youtube.com/watch?v=ImQyW7A8hcw)  ;)
Nice job, surprised to see it actually works. :)

I noticed your text colors seem off though. You probably need to update Surface::paletteShift to copy SDL_Color's new alpha field. There might be other places where you need to check this (I assume you already corrected the palettes to be fully opaque).
Title: Re: Android Port
Post by: page on November 24, 2013, 07:09:52 pm
Splendid job! I strongly would like to know the following information and run OpenXcom on my Android smartphone and tablet PC.

1. How to merge 'SupSuper's the latest git master' and 'your android code'?
2. How to set up the android compile environment and how to compile the source code?
3. How to install .apk file and how to run OpenXcom-android?

Thank you very much.
Thanks. To explain in detail all that would require more than a forum post, but I can give you some hints:
1. Basically you fetch both branches (they're both in github) and git merge. I guess I'll do that myself anyway, sooner than later, to prevent the branches from diverging too much.
2. This depends on your o.s. but you need android's sdk and ndk. Then you put all the SDL libs in openxcom/android/jni (you need a special patch for SDL_gfx, which its author just added to the lib) and you're ready to go: cd android / ndk-build / ant debug
3. Run 'ant debug install' and you're set.

You can google for details about all those steps. There are many step by step guides if you're starting.
Title: Re: Android Port
Post by: page on November 24, 2013, 07:16:53 pm
Nice job, surprised to see it actually works. :)

I noticed your text colors seem off though. You probably need to update Surface::paletteShift to copy SDL_Color's new alpha field. There might be other places where you need to check this (I assume you already corrected the palettes to be fully opaque).
Yep, text rendering is indeed broken. For now I've just made enough changes to achieve a somewhat working state, so I haven't even checked what might be wrong. Thanks for the hint!
Title: Re: Android Port
Post by: starwindz on November 25, 2013, 10:21:25 am
Quote
Then you put all the SDL libs in openxcom/android/jni (you need a special patch for SDL_gfx, which its author just added to the lib)

@page
Thank you very much for your kindness. As you have mentioned, I should google to find out all information to be needed to compile the android OpenXcom.

However I have some difficulty to obtain some compile dependencies for android just like 'openxcom-deps-win-vc.zip7' for VCExpress. So could you please upload or share compile dependency files(a zip file) only that you are currently using? Dependency files would include 'SDL', 'SDL2', 'SDL2_image', 'SDL2_mixer', 'SDL_gfx', 'YAML' and 'BOOST'.

Thank you again.
Title: Re: Android Port
Post by: HappyCat on November 26, 2013, 02:59:07 pm
Trying the same thing. Too bad I never could make Eclipse do what I want it to do)
Title: Re: Android Port
Post by: Tarvis on November 27, 2013, 07:19:40 pm
I've been thinking a while about how Xcom could be modded a bit to work well for fingers on a 4-inch screen

Here's a battlescape mockup I drew up, and I don't think it would be too hard to modify the code to have it like this (is the UI externalized at all anyways?)

(https://i.imgur.com/Jl0FDWp.png)

I was thinking, to make the buttons even wider, End Turn and Minimap buttons can go up next to the Retreat/Options buttons. Even further, the 'Done With Unit' button can be removed and added as a long-press for Next Unit instead to make them even wider. What do you think? Is it fine the way it is or would that be better?

Also, for the TU reservations, I was thinking tapping any of those buttons would just bring up a big list to pick from instead, kinda like the firemode list.


As for geoscape/basescape, I think using icon grid menus instead of lists would also be hugely beneficial. I'll make mockups of those later.
Title: Re: Android Port
Post by: redrat9595 on November 28, 2013, 01:41:04 am
...What do you think? Is it fine the way it is or would that be better...
...Also, for the TU reservations, I was thinking tapping any of those buttons would just bring up a big list to pick from instead, kinda like the firemode list...

This looks really nice. I think the next unit buttons are fine how they are, but maybe switching the abort and end turn buttons would be better because there's no confirmation for ending a turn and fat fingering the end turn button when you meant to fire could be disastrous.

Also, instead of a list, making the reserve cluster a single button that cycles through the options could be better, as well as easier to implement. It would start on green by default, and you would have to touch it three times to get it to autoshot.

Thanks,
Red
Title: Re: Android Port
Post by: Tarvis on November 28, 2013, 03:09:52 am
This looks really nice. I think the next unit buttons are fine how they are, but maybe switching the abort and end turn buttons would be better because there's no confirmation for ending a turn and fat fingering the end turn button when you meant to fire could be disastrous.

Also, instead of a list, making the reserve cluster a single button that cycles through the options could be better, as well as easier to implement. It would start on green by default, and you would have to touch it three times to get it to autoshot.

Thanks,
Red
Yeah, I thought of this too, but with the Reserve for Crouching/Dump TUs buttons from TFTD being regular in OpenXcom (something I forgot to include in the mockup) that might be tricky to hit since they're so thin. I'll think of something.

EDIT: Okay I've got it. I'll have the 4 reserve buttons act as one big button that cycles through them like you said, and then next to it will be the Reserve for Crouching button. To set TUs to 0 that can be assigned to long-pressing the "Don't Reselect Unit" button or something. Not super intuitive, but then again neither was right-clicking it.

Revised version. I think another thing that could be done (since buttons have a lot more room now) is little text labels! I don't know if it's better off being done through the text engine or by adding it to the graphics themselves, so I'll just leave it alone for now.

(https://puu.sh/5vols.png)
I also got rid of the black outline sorta for the regular reserve buttons to give the impression that they're actually 1 button.


And here's a WIP of the Basescape changes I had in mind. The missing button is Base Information which I figure could be made to come up by tapping the base name/location/funds bit
(https://puu.sh/5vxme.png)
Title: Re: Android Port
Post by: Hythlodaeus on November 28, 2013, 08:28:03 pm
You seem like a talented chap, but the battlescape icons order seems a bit disruptive, and the basescape buttons a little cryptic without proper subtitles.

I recommend you take a look a PocketUFO since it was the first version of X-COM for portable devices. They made a pretty cool adaptation of the UI for vertical PDA screens:

(https://screenshots.en.sftcdn.net/en/scrn/55000/55781/3_j2.jpg)

You can get the windows version somewhere around the web.
Title: Re: Android Port
Post by: redrat9595 on November 28, 2013, 08:50:04 pm
Beat me to it. Here's a link I know works.
https://www.xcomufo.com/x1dl.html

Any ideas for more precise movement? The magnifying glass wasn't a bad idea IMO, but some people didn't like it. Also, how does turning/strafing work?
Title: Re: Android Port
Post by: Tarvis on November 28, 2013, 08:52:43 pm
I'm not sure if that's a very good base. PocketUFO was made for use with a stylus, and the point of all this is for the game to work well with a finger. Furthermore getting OpenXcom to work in a portrait orientation sounds like more hell than it's worth. (It would be cool though! I just think it would have to be an either/or type of deal, because getting the game to adapt either way would be rough)

I'll think of other layouts that would restore the older button order. It might cut down on viewing area, though.


As for the basescape, yeah I see what you mean. A simpler solution I guess would just be 4 taller menu buttons (with text) that open up new menus for the rest of the options.
"Manage Bases" -Contains Base Information, Build New Base, Build Facilities
"Manage XCom Forces" -Soldiers, Equip Craft
"Manage R&D" -Research, Manufacturing
"Manage Inventory and Hires" -Buy/Hire, Sell/Sack, Transfer
And a smaller one to go back to Geoscape.

I just thought the icons would have been a good idea since that would require the least amount of coding effort (simply reorganizing the button zones) without having to code new menus.

EDIT: I've thought about how movement/looking can work too without magnification. Obviously all these are a lot more than simple changes, but seems like the most intuitive way to do it on a touchscreen.

Tap on a unit to select it (Automatically center camera, too? Might be too much)

To move the unit, tap the unit again to enter 'Move Mode' where the red 3D cursor appears. Then you can tap on the map AND/OR drag the box to the destination. Dragging the box would allow for much finer movement. Then tap the box again to confirm the destination.

For looking, just dragging from the soldier to where to look should work, especially if tiles get shaded to show the FOV before the finger lets go. This would work best if it was outside of Move Mode, but would be a bit more cumbersome.


Other ideas would be adding buttons for entering moving/looking mode, but those might take up valuable space.

Shooting would work like the move mode, where you can tap the target and/or drag the target cursor around, then tap it again to confirm the shot.

The idea is that the shooting/moving targets are separate from the actual 'cursor' and instead are objects that you can drag around.
EDIT: After trying out PocketUFO, this is actually exactly how it's done there. Good idea then?


As for camera movement, drag scrolling should be fine, across all modes.

Do we have any control over the magnifying glass, or is that just given by SDL? For example, could it be made so that doing the pinch zoom gesture in the view area makes it zoom in the entire mapview (but not the UI)?
Title: Re: Android Port
Post by: Hythlodaeus on November 28, 2013, 09:57:29 pm
Soldier movement could be handled smoothly just by having path preview cursors on by default, which makes movement based on double click actions: one should the preview, the other confirms the action, so it's pretty much flawless even if you have chubby fingers.

Also I merely suggested PocketUFO as inspiration. I like your idea of simplifying the basescape with subsections though, that might work fine.
Title: Re: Android Port
Post by: SupSuper on November 29, 2013, 03:04:30 am
Yeah I think a double-click aim mode like the double-click move mode (path preview) would be sufficient, with drag scroll for the camera.

You can also look at Aliens vs Humans (https://www.aliensvshumansapp.com/) for another touch UI example:

(https://www.aliensvshumansapp.com/avh2/images/snaps.jpg)
Title: Re: Android Port
Post by: alienfood on November 29, 2013, 08:32:39 pm
There really seems to be some legs to this, very good work. I can see how a turn-based game would be ideal for something on a tablet that you can peck at over several weeks or months of casual play. One suggestion: have a setting to drop straight into your latest saved game at startup.
Title: Re: Android Port
Post by: Tarvis on December 01, 2013, 10:36:53 pm
Worked up a different layout. The idea was to make it more comprehensive (camera actions tend towards left, while unit actions tend towards the right) and also to reduce the cluttered button hell a bit.
(https://puu.sh/5z8Xt.png)
Other changes between the are: switched Reserve Crouch/rest of reserve buttons to avoid fat-fingering the real crouch button, making you lose TUs. Since the other Reserve options are to be made into one big toggle button it'll be a lot easier to hit (and harder to hit the actual crouch button by accident)
Title: Re: Android Port
Post by: Hythlodaeus on December 01, 2013, 11:37:31 pm
It's a little too confusing. I'd recommend doing some merging to save some space, for instance:

* The "show all levels" button is considered obsolete my many. I'd do away with it.
* Don't use a prev unit button. Next unit is enough.
* See level above/below and level up/down buttons take too much space for the sake of aesthetics
* Gun windows have some needless border space which was actually cut in TFTD. Here's how to cut it:

(https://anonmgur.com/up/85ba4ab52bdf58a049a8e8053b38b591.png)

* More radically, you could completely do away with the inventory button, and have the player access the inventory by clicking on the name or rank icon.  Stats could only be accessed inside the inventory screen.
Title: Re: Android Port
Post by: Mr. Quiet on December 01, 2013, 11:41:41 pm
Great job. You can also make the buttons on the screen transparent, or even remove the side buttons for "layers" and "next operative" so we can memorize which side we need to slide our pinky.

If this becomes very playable and everything, I'll buy me an android tablet.

Keep us up to date, and Sup post that video on the front page, because that's awesome news ;)
Title: Re: Android Port
Post by: Tarvis on December 01, 2013, 11:50:32 pm
I was thinking Move Unit Up/Down could be made obsolete too, by simply giving a move command to the level directly above/below the unit. Would that work?
EDIT: Turns out OpenXcom already does this! So I guess they could be gone. It makes it hard to move directly up/down when you can't see the level below you, but oh well.

And I'm not sure about removing "Show All Levels." I'd rather not remove functionality, and it is handy for quickly seeing if enemies are on the roof.

I do agree that the level up/down looks a bit jarring, but I really don't know a better way to have it. I don't think there's enough room on the bottom bar to put them.


As for the inventory button, I guess that works. If not, Minimap could be pushed into the pause menu as well, I suppose. With that and Prev Unit gone I guess there's room for Level Up/Down on the bottom after all.


While we're at it, can the menu/options button be removed too? I figure since Android phones usually have a dedicated Menu button it can just be called up by that instead.


Quote from: WeOwnTheNight
You can also make the buttons on the screen transparent
That'd be great for the level up/down buttons to make them not get in the way, but I have no idea if OpenXcom is set up to handle transparent buttons and such, especially considering it runs off of 256 total colors. They could be overlaid externally with SDL, but then they'd show up all over the entire game, not just Battlescape.
Title: Re: Android Port
Post by: Hythlodaeus on December 01, 2013, 11:58:49 pm
I was thinking Move Unit Up/Down could be made obsolete too, by simply giving a move command to the level directly above/below the unit. Would that work?
It would work, but it would make controlling a hella lot clunkier, especially when going up elevators or using a flying suit

And I'm not sure about removing "Show All Levels." I'd rather not remove functionality, and it is handy for quickly seeing if enemies are on the roof.
Trust me, it's obsolete, and no one likes it. Even PocketUFO removed it.

I do agree that the level up/down looks a bit jarring, but I really don't know a better way to have it. I don't think there's enough room on the bottom bar to put them.
No idea either.

As for the inventory button, I guess that works. If not, Minimap could be pushed into the pause menu as well, I suppose. With that and Prev Unit gone I guess there's room for Level Up/Down on the bottom after all.
Good idea.

While we're at it, can the menu/options button be removed too? I figure since Android phones usually have a dedicated Menu button it can just be called up by that instead.
Not entirely sure. How would that work?

Title: Re: Android Port
Post by: Hythlodaeus on December 02, 2013, 12:08:39 am
One more thing: you forgot the "Don't reselect unit button". A lot of people use that one for marking down units with all TUs spent.
Title: Re: Android Port
Post by: Tarvis on December 02, 2013, 12:13:04 am
One more thing: you forgot the "Don't reselect unit button". A lot of people use that one for marking down units with all TUs spent.
Since the goal is to save space, I figured this could be done by long-pressing Next Unit.

EDIT: Well I'm not sure I'm happy with how many buttons are now in the Options Menu, but here's my latest layout:
(https://puu.sh/5zfM6.png)
Title: Re: Android Port
Post by: Yankes on December 02, 2013, 02:10:28 am
Its possible to do some limited transparency effect using palette tricks.
Title: Re: Android Port
Post by: Hythlodaeus on December 02, 2013, 03:10:01 am
Oh, another idea to save huge amounts of space: pull another pocket UFO and get rid of the stat bars completely. Show numbers only. Make a larger version of the numbers with an icon identifying each, and put the reaction icons on the left side of 'em, on smaller buttons. Like on PocketUFO, name and rank are only shown for a small amount of time when the trooper is selected or in the inventory menu. And don't worry, we have someone working on miniature rank icons.
Title: Re: Android Port
Post by: kkmic on December 02, 2013, 10:36:48 am
Where's the "Abort mission" button?

How about having some buttons performing a different task if taped, double-taped or long-taped?

For example, you can open the inventory on a single tap on the soldier's name and center on the soldier on a long tap on the soldier's name.

Speaking of the "abort mission", why not have the abort screen appear on a long tap on the end turn button?
Title: Re: Android Port
Post by: Tarvis on December 02, 2013, 03:36:22 pm
In that layout, Abort Mission and Minimap are moved to the Options menu. I don't really like it either, but I don't have much of a choice for getting everything to fit in a flush bar at the bottom. I'm fine with it for Abort Mission since you're only going to use it once per deployment (if at all) but I'm not sure about having Minimap there.

EDIT: Anyways. I really don't want to get rid of the graphical stat bars. Having just numbers doesn't really give you a good estimation of what the totals are. If anything, maybe the area could just be half as wide, but that would only add enough room for 1 button. Getting rid of the rank icon and using a mini-one right before the name would add a space for another button. So I guess that way the Center/End Turn buttons can go down on the main bar.

If possible, again the Reserve TUs button could be made into one button that calls up a menu to choose which one/toggle reserve crouching. Or, the Reserve Crouching could be set to be long-press on the Crouch button. I'd have to think of a graphical representation for that, though

I think I'll change the Center button to Minimap, since I think it might be used too often that going through the options menu to get it might be a pain. Centering could be long-pressing that, or as kkmic says, long-pressing the name/bars area instead.
Title: Re: Android Port
Post by: page on December 02, 2013, 08:27:46 pm
Wow, there's quite a lot of movement in here :) Well, first of all, a status update: I set double-click to walk by default, implemented double-click to shoot and scroll with finger sweep, back button to cancel, and some other little details.

Second, the problems:

So, my short term ideas would be:

*And*, and that's a big *and*, I need an idea on how to implement turning the soldier. Without that we're doomed! Perhaps using some button as a kind of 'shift', to simulate right click?

What do you think?

p.s.: using menu button is not such a good idea, some devices don't have it + it would complicate a possible port to ios.
p.p.s.: I'm still not convinced we need long presses and I absolutely dislike double-press :) Not the least because this is not trivial to implement, but well, the UI rework also looks like not trivial tbh.
Title: Re: Android Port
Post by: Tarvis on December 02, 2013, 11:14:14 pm
We discussed a bit further back that the move/shoot box would work best if you could drag it around with your finger. Then you tap it again to confirm and fire. That way you don't need to have separate buttons, and you don't have to worry about being a tile or two off with your big fat stubby finger since you can drag it around for precision. Tapping elsewhere on the map would only move the move/target cursor, not actually move the unit.

Try out PocketUFO if you want to see how that works

Basically:
-Drag scroll on the map to move camera around. I don't think it should be two-finger scrolling, since some devices don't have multitouch support. Maybe there can be an option for scroll buttons/zones on the edges like PocketUFO?
-Swipe from unit to a direction to turn unit. Would work best if tiles were colored to show the new FOV before letting go of the unit
-Tap selected unit to make move box appear, drag/tap to move cursor, tap cursor to move unit
-Tap gun icon as usual to make shoot cursor appear, drag/tap to move cursor, tap cursor to fire. (Since there's no right click, perhaps a 'Cancel Aiming' option could be added to the firemode menu)


And as for long presses, it's either that or a more cluttered screen due to larger buttons. You could just use the original UI, but then it wouldn't control very well on a phone at all. I don't think the UI rework would be hard, at least if all the buttons are contained within the space of the original HUD. It would just have to be hardcoded, I think, since I don't believe the UI is externalized.

Anyway, I wouldn't have much hope for this going to iOS anyhow. It would be nice, but how would this go in the App Store unless new game content was made from scratch? Unless you can somehow make a deal with Firaxis or whoever owns the IP now to sell the game data with it as well. There's always jailbreaking, but I think that's a tiny fraction of people compared to Android users.
How does the Home button work on iOS anyways? Does it always close the application or does it work as a menu/back button in some apps? I don't have an iPhone so I can't confirm. I don't know what Android devices don't have a menu button, though...
Title: Re: Android Port
Post by: Yankes on December 03, 2013, 12:23:42 am
weapon button can be 'Cancel Aiming' button. It could work like toggle.
Title: Re: Android Port
Post by: Tarvis on December 03, 2013, 01:32:46 am
Well anyway. I think the new touch controls should be implemented before the UI changes, since those seem like the easiest task and can just be tweaked whenever down the line
Title: Re: Android Port
Post by: page on December 04, 2013, 12:05:03 am
Tarvis, so you would either scroll or change move target based on whether a soldier is selected? That doesn't seem really comfortable, as it does not allow to scroll to set the destination target. Same for shooting. Or have I misunderstood?

Otoh, swiping from the unit to turn seems a great idea :)
Title: Re: Android Port
Post by: page on December 04, 2013, 09:27:07 am
Replying to myself, I think I misunderstood. You only drag the destination/aiming cursor around iff you start dragging from the current cursor position. Is that right? That makes more sense.
Title: Re: Android Port
Post by: sidav on December 04, 2013, 11:45:28 am
Wow, true hope for a port! Guys, you're awesome! But my English skill doesn't allow me to clearly understand: all the talk in the topic is just a theoretical thoughts or someone really works on a port?
Title: Re: Android Port
Post by: Tarvis on December 05, 2013, 03:23:57 am
Tarvis, so you would either scroll or change move target based on whether a soldier is selected? That doesn't seem really comfortable, as it does not allow to scroll to set the destination target. Same for shooting. Or have I misunderstood?

Otoh, swiping from the unit to turn seems a great idea :)
No no, my idea is swiping the map will ALWAYS move the camera. To drag the move/target box around you'd have to drag from the actual box/target itself, or tap (not swipe) on the map to move the box there instantly ala PocketUFO. So yeah, just like your second post

It'd take quite a bit of checking in code to do this, but it would handle great, I think. The hardest part would be untying the move/shoot cursors from the actual cursor (which would be the touch input) and selective scrolling based on where exactly you're swiping.

One thing I was thinking of though is that these changes can be coded for the PC version first, then ported over. Of course porting it to Java would take some effort, but testing it in Windows would be a lot easier and probably save time. The only thing you couldn't do on the PC is the multitouch pinch-zooming which probably will only happen on the geoscape anyhow.

Wow, true hope for a port! Guys, you're awesome! But my English skill doesn't allow me to clearly understand: all the talk in the topic is just a theoretical thoughts or someone really works on a port?
From what I understand, the porting itself is mostly complete (besides it being based on an older version of OpenXcom for now because it has to be ported from C to Java). Right now we're just discussing theoretically how to change the user interface to suit touchscreens/fingers. Currently it's just a 1:1 port of the PC version which might be okay for tablets but not phones with 4-5inch screens.
Title: Re: Android Port
Post by: sidav on December 05, 2013, 10:25:04 am
From what I understand, the porting itself is mostly complete
Yeah, but that port is 3 years old. Too old :(
Title: Re: Android Port
Post by: page on December 05, 2013, 11:13:22 am
Erm, I don't know about any java port. What I did was port the current oxc to SDL2, which works on android, and from there start tweaking things to accommodate to the platform. The repo is here: https://github.com/cpages/OpenXcom/compare/master...android (https://github.com/cpages/OpenXcom/compare/master...android)

Just to clarify, the codebase is the same for all platforms. You just build with gcc or msvc or whatever for pc, or cross-build with android's sdk+ndk.
Title: Re: Android Port
Post by: Tarvis on December 05, 2013, 07:31:23 pm
Oh wow, my bad. I didn't realize the most current development wasn't the same as in the OP.
Title: Re: Android Port
Post by: starwindz on December 07, 2013, 04:50:00 am
Hi developers!
What is your operating system for android port development?
Linux(Ubuntu) or Windows or OSX?
Title: Re: Android Port
Post by: page on December 09, 2013, 11:38:57 pm
Hi developers!
What is your operating system for android port development?
Linux(Ubuntu) or Windows or OSX?
I'm a NixOS user: https://nixos.org/ (https://nixos.org/)
Title: Re: Android Port
Post by: Amunak on December 10, 2013, 03:50:56 am
Just some notes from my experience with lots of games and apps on my android phone:

Also... You might consider merging the two hands together. Or display just one main, and make the other accessible through its menu or inventory. I bet most people 80% of the time use only one hand, one weapon.

What do you plan for controling the geoscape? I'd suggest make it drag-hold move, and with placing bases/intercept I think it'd be best to have the crosshair just centered, and you'd place it by rotating the globe. You could also make the globe zoom in an out by two-finger touch  and move, like in Google Maps.
Title: Re: Android Port
Post by: Tarvis on December 12, 2013, 07:59:41 pm
Read through the last few pages, we've pretty much discussed this (move/shoot cursors can be dragged around for precision and tapped again to confirm)

As for newer Android devices, with the navigation bar being part of the screen instead of separate buttons, I thought apps could call for a menu button to be shown on the right side? I don't have a phone like that so I can't quite confirm.

EDIT: Yes, but this is done by setting the app's targetSdkVersion to <11. I'm not sure what else that might affect though...

As for merging hands, how will you throw grenades then without putting your gun away first?
Title: Re: Android Port
Post by: Amunak on December 12, 2013, 10:17:45 pm
As for newer Android devices, with the navigation bar being part of the screen instead of separate buttons, I thought apps could call for a menu button to be shown on the right side? I don't have a phone like that so I can't quite confirm.

EDIT: Yes, but this is done by setting the app's targetSdkVersion to <11. I'm not sure what else that might affect though...
Yes, you can do that. But it doesn't look nice - the button is on the side, it really looks like "I don't want to be there" and it shouldn't really be present in modern apps. I think that using a button like in the original is the best solution, even if it takes some space.

As for merging hands, how will you throw grenades then without putting your gun away first?
I assume that all these popup menus would take up all the screen space (unlike just a part, like in the original). There should still be enough space to add something like "left hand: throw; left hand: auto fire; left hand: manual fire; ... And if not, you can add just one item/button/switch, that'd say "use the other hand". If you tapped that, you'd get the menu for the other weapon.

Or you could just make it accessible through the inventory screen only (maybe have there buttons like "make primary" (which would select that hand as primary and show it in the bottom of the screen), and "access this hand now" for one-time use. I guess the former idea is better, though.
Title: Re: Android Port
Post by: Tarvis on December 16, 2013, 07:49:34 pm
Yes, you can do that. But it doesn't look nice - the button is on the side, it really looks like "I don't want to be there" and it shouldn't really be present in modern apps. I think that using a button like in the original is the best solution, even if it takes some space.

It may look like an afterthought, but it's still there, and to me I think it's a lot less intrusive than taking up space in the top left corner, covering a bit of the map area. It could always use the Back button instead, though.
Title: Re: Android Port
Post by: Amunak on December 17, 2013, 12:16:50 am
It may look like an afterthought, but it's still there, and to me I think it's a lot less intrusive than taking up space in the top left corner, covering a bit of the map area. It could always use the Back button instead, though.
This.

Also, if you were to remove one of the "hands", you could easily put both buttons there.
Title: Re: Android Port
Post by: HappyCat on December 25, 2013, 10:41:41 am
Page, is there any chance for nightly/weekly/some-other-time-span builds?
Still not found time to fence with this, only got compiled small sdk apk out of the project(
Title: Re: Android Port
Post by: HappyCat on January 12, 2014, 12:55:52 pm
Thanks. To explain in detail all that would require more than a forum post, but I can give you some hints:
...
2. This depends on your o.s. but you need android's sdk and ndk. Then you put all the SDL libs in openxcom/android/jni (you need a special patch for SDL_gfx, which its author just added to the lib) and you're ready to go: cd android / ndk-build / ant debug
It might be a dumb question, but I don't see a ndk-build folder in github sources. What am I doing wrong?
Title: Re: Android Port
Post by: page on January 12, 2014, 01:00:30 pm
It might be a dumb question, but I don't see a ndk-build folder in github sources. What am I doing wrong?

Sorry the instructions were a bit confusing. You are meant to run ndk-build and ant debug, from the android folder. Using '/' as a separator was a bit misleading :)

On a related note, though, here is my Christmas gift (with a bit of delay): https://www.ufopaedia.org/index.php?title=Android_port_(OpenXcom) (https://www.ufopaedia.org/index.php?title=Android_port_(OpenXcom))
Title: Re: Android Port
Post by: HappyCat on January 12, 2014, 02:15:03 pm
Thanks a lot!
UPD: I am having a shifted pallete unless I am in a text edit mode or taking screenschot.
For example, I look at Earth floating in pink space and having blue surface, but when it is time to enter base name it's looking normal again.
Until I finish entering the name.
Title: Re: Android Port
Post by: mtwilight on January 13, 2014, 10:48:31 pm
Hi,

I've been following you guys on this board because I love the project. When I saw you guys here discussing about doing the visual adaptations on OpenXCom to fit smaller screens I though I might have some to add, as a designer, just some suggestions, entirely open to be discussed:

- On smaller screens I think some UI elements will have to be out or subset in a menu, 'cos there's a lot on the screen now. A good start, in my opinion, is to match Apple design guidelines when they say to design for the 80% majority, which in this case means that commands used by 20% of the people could be put out. Viewing the main screen is always more important than having a non-standard option.

- For that above, I don't know if this was covered already, but the ideal case is to have a simpler version for smaller screens aside with a complete version for bigger screens. All good system/apps with multiple versions do so: the smaller the screen, the simpler the interface (simple in this case means 'with less features').

- Buttons like the "view all levels" and "help" could be cut out.

- The soldier stats and rank could be simplified or cut to open space. In the stats case, for the sake of briefness you could leave the numbers and cut the bars or, if possible, change the bars into something smaller.

- A clever idea is to eliminate all back and forth buttons (up and down too) that can be looped (level viewing, prev/next xcom operative).

- I don't think a toggle button with all four options (like the TU saving mode presented) is a good idea. People will try to press only the part they want, making it uneffective as a big button. Two ways to make it work: show only the current mode or don't use green background, but a html-radio-like above the options.
( I don't get why the crouch option have to be apart, but I must have bypassed it here... )

- Last, but not least, the soldier stats screen and the soldier ground screen could be called by pressing the soldier name/stats and both screens could have a button to call the other screen (stats/ground).

I made a quick screen of what I've been thinking, hope it helps somehow.

So that's it, keep up the great work guys  :)
Title: Re: Android Port
Post by: Empiro on January 13, 2014, 11:44:21 pm
- Buttons like the "view all levels" and "help" could be cut out.

Good idea. I think things that are used at most once per battle (for example, abort) can also be cut and either placed in an "extra options" menu or made context sensitive (for example, an interactable UI element on the map itself near the exit area)

Quote
- The soldier stats and rank could be simplified or cut to open space. In the stats case, for the sake of briefness you could leave the numbers and cut the bars or, if possible, change the bars into something smaller.

You could probably rework the inventory screen to show even more stats (as numbers). It would even eliminate a UI screen of limited value (numbers with colors work just fine) Most phones and tablets have a wider aspect ratio, so you can probably display some information at the sides compared to the original game.

Quote
- A clever idea is to eliminate all back and forth buttons (up and down too) that can be looped (level viewing, prev/next xcom operative).

It'd be good to take advantage of common touch screen UI functionality too. For example, to go up down a level, you can press on the ladder button, then slide up to go up, down to go down. To switch to next / previous soldiers, press the "person button" and slide left / right. You can even add enhancements -- for example, if you drag up, a horizontal list of "soldier summary cards" pops up across the screen, displaying a list of soldiers in the same order as the next / previous buttons. The summary might show a few bars give you a rough idea of the general health and current TU/Total TU of each soldier. That way, you can quickly see who still has TUs left.

I think that one of the weakest aspects of these old games is their UI. Instead of thinking "how do we adapt X-Com's UI to modern phones?", we should be thinking "how do we design a good mobile UI that allows us to do everything you can do in X-Com, while still retaining the original UI's style and feel?"
Title: Re: Android Port
Post by: starwindz on January 15, 2014, 12:59:49 am
OpenXcom Android works fine on my 10.1 inch android tablet, Samsung Galaxy Note 10.1.
But color looks abnormal. (Palette problem?)
Title: Re: Android Port
Post by: sidav on January 15, 2014, 04:30:28 pm
OpenXcom Android works fine on my 10.1 inch android tablet, Samsung Galaxy Note 10.1.
But color looks abnormal. (Palette problem?)
Where did you take the apk file?
Title: Re: Android Port
Post by: HappyCat on January 15, 2014, 04:49:56 pm
I thinks it's from ufopaedia wiki entry that page mentioned in his last post.
It's where I got my apk from and I witness the same issue.
Title: Re: Android Port
Post by: Ganimoth on January 15, 2014, 07:35:21 pm
Is it just me or I cant get out of soldier statistics screen?
Title: Re: Android Port
Post by: page on January 16, 2014, 10:26:29 am
Is it just me or I cant get out of soldier statistics screen?
It's not just you  ;D

starwindz, nice screenshot :) I've tried it on 3 different devices and have not seen this behavior on any.

Anyway, notes taken and patches welcome!
Title: Re: Android Port
Post by: HappyCat on January 17, 2014, 07:14:31 pm
I decided to make more complete notes of pallete-looking issue on Galaxy Note 10.1

"options.jpg" shows how options (or any other) screen actually looks like ingame.
"options_device_screenshot.png" is how it looks on a screenshot taken by tablet built-in screenshot taker. Here colors looks normal. And they retain normal look for a few seconds. I checked that sliders and other ui elements are still operational within these seconds.
"options_input shows.jpg" how options screen lokks like if you start editing text field.
The whole thing kind of reminds me how text and images changes when selected for copy in text editors or browser...
Hope it clarifies something.

On a side note, music continues to play when openxcom stops being active apllication and even when tablet is in waiting mode.
Title: Re: Android Port
Post by: sidav on January 19, 2014, 10:21:50 am
page, big thanks for the port. It works well on my LG Optimus Sol (android 2.3.4), it runs much better than an original x-com in DOSBox on the phone. Awesome!
Some notes:
1) I think it's neccessary to increase size of menu buttons (like difficulty levels, in intercept menu, and so on), and to make a possibility to turn it off in options.
2) Yep, game just doesn't want to exit.
3) i didn't understand how to rotate a soldier. Swipe from soldier to the direction works not always.
4) Maybe it will be better to bind double-tap to the right mouse button?
5) Screen on my phone is 3.8'' with resolution 800x480. It's not so useful to command a soldier with tapping on the tile where to move and then tapping again in the same place: sometimes it is hard to tap on the same tile. Maybe, it's better to make a tap on a tile just a selector for a path, and make special button on UI to give an order to move.
5.1) and the same system for the shooting: select a target then give an order with special button
6) In general, it will be good to "zoom" battlescape , if it possible, to make less tiny things that player should tap when playing :)
7) Maybe, it's time to replace the app icon to the proper? ;)
upd: i doesn't experience the issue with abnormal color, everything in the render is normal.
Title: Re: Android Port
Post by: Greg956 on January 22, 2014, 08:33:34 am
Samsung Galaxy S3, Android 4.2.1 stock. All working, apk installed, copied all of my data to sdcard/openxcom/data
Russian Language working, other languages works too. Resolution 1280x720, fullscreen, Shader-HQX.
Installed Amiga fonts.
The problem is that all is pink, and I don't understand how to make normal colors.
Title: Re: Android Port
Post by: Tarvis on January 22, 2014, 05:12:30 pm
On smaller screens I think some UI elements will have to be out or subset in a menu, 'cos there's a lot on the screen now. A good start, in my opinion, is to match Apple design guidelines when they say to design for the 80% majority, which in this case means that commands used by 20% of the people could be put out. Viewing the main screen is always more important than having a non-standard option.
Quote
Buttons like the "view all levels" and "help" could be cut out.
This is kinda what I was thinking as you saw before. I'd do one thing different though: I'd replace the "abort mission" button with the options button. That's what the ? button does (not "help"), it opens up the game pause menu. Abort Mission could be put in there. However, every device (even iOS) has a 'Back' button that could call that instead of a soft button, so that could just become free space for something else (confirm shoot/move maybe?)

I suppose for the sake of mitigating fat-fingering, the End Turn button could have a confirmation dialog too.

Quote
For that above, I don't know if this was covered already, but the ideal case is to have a simpler version for smaller screens aside with a complete version for bigger screens. All good system/apps with multiple versions do so: the smaller the screen, the simpler the interface (simple in this case means 'with less features').
This would be ideal, but I don't think OpenXcom is currently designed to be able to dynamically change this kind of thing, since I believe most UI is hardcoded right now. But I suppose there could just be two versions of the game for that (a Tablet and Phone version)

Quote
The soldier stats and rank could be simplified or cut to open space. In the stats case, for the sake of briefness you could leave the numbers and cut the bars or, if possible, change the bars into something smaller.
This is one thing I somewhat disagree with. Shortened, maybe, but I don't think the bars should be totally gone. It's pretty hard to estimate just how much of your soldier's health is left when it's just a number with no visual indication. Though for TUs it would be fine.

Maybe it could display the total number next to it, so HP could show as "18 / 25" or so instead of just 18, if bars were to be totally cut.

Quote
A clever idea is to eliminate all back and forth buttons (up and down too) that can be looped (level viewing, prev/next xcom operative).
Nice one, I hadn't actually considered this for level viewing. But what about move up/down? In your design, that's only one button. That can't wrap, especially because each move takes TUs. Does your button bring up a dialog that asks which way to move?

Also, Next/Prev unit wraps too, I only added "Prev Unit" because I wasn't sure what else to do with that space. It wasn't in the original game.

Quote
I don't think a toggle button with all four options (like the TU saving mode presented) is a good idea. People will try to press only the part they want, making it uneffective as a big button. Two ways to make it work: show only the current mode or don't use green background, but a html-radio-like above the options.
( I don't get why the crouch option have to be apart, but I must have bypassed it here... )
Good point, having it as a single cycling button would work best. Mostly because html-radio-like callouts aren't implemented in Xcom in any sort of way. But it could use the OS to do that, I suppose.

Also, the crouch reserve button was separate because it works separately to the other ones (you could opt to reserve TUs for both shooting and then crouching after shooting, for example) It does take up space so it could be moved to long-pressing the regular crouch button (though this isn't quite as intuitive).

I honestly never used it, so I wouldn't mind not having it (it wasn't there until TFTD anyhow)

Quote
Last, but not least, the soldier stats screen and the soldier ground screen could be called by pressing the soldier name/stats and both screens could have a button to call the other screen (stats/ground).
The inventory screen can actually already be called from clicking the rank icon in the inventory screen! So yes, that works.

Otherwise, your proposed layout is great. I really didn't like having to put buttons at the top of the screen...

EDIT: So about the 'confirm shoot/move' button.

I was thinking  your Move Unit Up/Down button could be replaced with a 3-way control mode toggle, it'd have:

Move Mode: Move unit around.
Look Mode: Turn unit to face things.
Move Up/Down mode: Swipe unit up/down to move it up/down a level

That way the problems with having to tap the cursor to confirm a move/shoot could be avoided, and the button to the right of it could be replaced with a "Confirm" button.
Title: Re: Android Port
Post by: bullitmagnet on January 22, 2014, 08:16:27 pm
just wanna report that it seems to work quite well on my Prestigio prime, however.. how do you cancel an action, on pc I right click, but I couldn't figure it out on android . probably mising simething really obvious lol

Great work though, love the idea of being able to play anywhere
Title: Re: Android Port
Post by: Warboy1982 on January 23, 2014, 03:28:34 am
just wanna report that it seems to work quite well on my Prestigio prime, however.. how do you cancel an action, on pc I right click, but I couldn't figure it out on android . probably mising simething really obvious lol

not sure how long it takes for changes to trickle down, but you can now click on the item again to cancel the action.
Title: Re: Android Port
Post by: mtwilight on January 24, 2014, 07:55:11 pm
This is kinda what I was thinking as you saw before. I'd do one thing different though: I'd replace the "abort mission" button with the options button. That's what the ? button does (not "help"), it opens up the game pause menu. Abort Mission could be put in there.
That would be nice enough.

Quote
This is one thing I somewhat disagree with. Shortened, maybe, but I don't think the bars should be totally gone. It's pretty hard to estimate just how much of your soldier's health is left when it's just a number with no visual indication. Though for TUs it would be fine. Maybe it could display the total number next to it, so HP could show as "18 / 25" or so instead of just 18, if bars were to be totally cut.
If the bars can be shortened, that would be ideal IMHO.

Quote
Nice one, I hadn't actually considered this for level viewing. But what about move up/down? In your design, that's only one button. That can't wrap, especially because each move takes TUs. Does your button bring up a dialog that asks which way to move?
Yes, that was what I thought (tough I didn't mention).

Quote
Good point, having it as a single cycling button would work best. Mostly because html-radio-like callouts aren't implemented in Xcom in any sort of way. But it could use the OS to do that, I suppose.
I didn't meant an exact radio button, but rather something that behaves and looks similar, just to the user to have this feeling of "toggling between options"

Quote
Also, the crouch reserve button was separate because it works separately to the other ones (you could opt to reserve TUs for both shooting and then crouching after shooting, for example) It does take up space so it could be moved to long-pressing the regular crouch button (though this isn't quite as intuitive). I honestly never used it, so I wouldn't mind not having it (it wasn't there until TFTD anyhow)
Seems very unnatural. I never used it too.

Quote
Otherwise, your proposed layout is great. I really didn't like having to put buttons at the top of the screen...
Thanks, good to see it helped  :)

Quote
EDIT: So about the 'confirm shoot/move' button.

I was thinking  your Move Unit Up/Down button could be replaced with a 3-way control mode toggle, it'd have:

Move Mode: Move unit around.
Look Mode: Turn unit to face things.
Move Up/Down mode: Swipe unit up/down to move it up/down a level

That way the problems with having to tap the cursor to confirm a move/shoot could be avoided, and the button to the right of it could be replaced with a "Confirm" button.
That's a very clever solution, if it can be made I think it's the best one.
Title: Re: Android Port
Post by: X on January 25, 2014, 10:33:56 pm
Quote
Known issues
    Exiting the game hangs. Just kill the app from android for now.
    Don't leave the game while in text enter mode. When going back, it won't reappear and you'll be stuck editing the text.
- game lose control after smartphone's display go to sleep.
Title: Re: Android Port
Post by: bullitmagnet on February 01, 2014, 01:00:20 am
can I be thick (yet again) and ask how would I update. I am assuming that I would just have to overrite files with the new ones. cos I installed it with the apk , I assume that I wouldn't need to uninstall it and install it again.. I know, I know. probably a simple thng I should already know :)

I would also like to ask if anyne knos the best way to change the soldier sprites, I wanna have a go at changing the slightly daft boiler suits. I realise that this isn't the right part of the forum, but meh, I was here writing this so thought id try :-)
Title: Re: Android Port
Post by: shanroo on February 12, 2014, 04:03:25 am
Hi!

I'm newbie here (maybe with bad english, sorry), and now installed the android port. Nice work! Now my biggest problem is in sell/buy menus. If I not properly touch the inc/dec buttons then it will hold them down until I touch somewhere else or happen something (like I'm out of storage space). Another buttons (rotate, other inc/dec buttons) works alike. It's annoying a bit. Also buttons are small on my screen, but it's not the smallest phone on the market. It's 4.7". Maybe lists like those would have larger buttons, or a popup with some more buttons like +/- 10-50-100-all.

About the "monster": If I understood correctly you rotate the whole sphere of ocean. I think ocean is visible as a circle always, and only solid blue. Nothing on that. Do really need to a) rotate; b) be sphere?

Title: Re: Android Port (SDL2)
Post by: SupSuper on February 12, 2014, 05:54:19 am
Ok I've split up the thread to make things clear, because people were mixing up the old and new Android port discussions.

The original Android port discussion was 3 years ago! You know what version we were on then? 0.2. It was a completely different port from the one you've seen in the last video by Page, and pretty much everything has changed since then, so please disregard anything you read about it (if in doubt, just go through this new thread again). The globe's no longer a monster. It's more of a troll. :P
Title: Re: Android Port (SDL2)
Post by: page on February 22, 2014, 12:54:06 am
I've put up a new beta. I've been quite busy with other stuff, so it's mainly just an update to the current oxc upstream, with latest SDL. The only bug fix is for exiting soldier unit stats page with back button. The links are on the same wiki page. Enjoy!
Title: Re: Android Port (SDL2)
Post by: page on February 24, 2014, 12:08:05 pm
Btw, can you check if the 'pink problem' still happens with this version? <- starwindz, HappyCat
Title: Re: Android Port (SDL2)
Post by: sidav on February 24, 2014, 12:36:48 pm
page, on some russian forum we had found the solution of the "pink problem". Don't sure i can say it correctly in English, but it is solved by turning off "Hardware overlay" setting in "Developer settings" in Android settings menu, i.e. it is not a problem of the port itself.
I also can provide some statistics about workability of the port on various devices, based on the forum reviews, if you need so.
Title: Re: Android Port (SDL2)
Post by: page on February 24, 2014, 03:18:13 pm
Thanks a lot for the pointer, sidav! I could not test it yet but there's a guy in the sdl irc channel with the same problem that got it solved with this, so I call it fixed.

As for statistics, it would be nice to know of some if it doesn't take you much time. Perhaps you can point me to that forum as well? (I can't read russian but my coworker can) :)
Title: Re: Android Port (SDL2)
Post by: sidav on February 24, 2014, 05:59:10 pm
page, i made statistics for you:
Many users report that TUs cost of shots hasn't displayed, maybe it's because of russian .lng file taken from desktop openxcom?
(my remark: i use .lng file from your cache pack, and i have TUs cost displayed.)
Statistics on devices:
All LG devices i seen have no trouble with openxcom.
Sony xperia L has "veeeery long" loading, but except this also has no trouble.
Sony Xperia Z1, Meizu MX2, Acer A500, Google Nexus 4, Fly iq 445, Huawei Ascend Mate, Highscreen Alpha GT, HTC Desire C: no trouble.
Samsung Galaxy Gio, Samsung GT-I9103 Galaxy R: no trouble (even no "pink problem"!)
Fly iq 440, Lenovo A789, Huawei g500pro: black screen on launch (but the game sounds working, if do some tap on screen).
Motorola RAZR I: game crashes on launch.
Almost all another samsung devices have "pink problem", but otherwise they have no trouble.
Also, many users said that their hardware "back" button doesn't work. It is fixed by binding an action on it in the game settings.
Overwhelming majority of users (but not everyone) reported that the game crashes sometimes when your soldier/tank/mind-controlled alien is killed. I experience this issue too. It is not persistent and usually doesn't occur again after game re-loading (but the game can crash later after re-loading), and generally seems random without any regularity, also it seems that there is no corellation between device model and this issue.
That's all for now, hope it was helpful
Title: Re: Android Port (SDL2)
Post by: HappyCat on February 25, 2014, 09:56:32 pm
Perhaps you can point me to that forum as well? (I can't read russian but my coworker can) :)
I am not sidav, but I am sure he means following topic:
https://4pda.ru/forum/index.php?showtopic=539828
Title: Re: Android Port (SDL2)
Post by: sidav on February 27, 2014, 06:49:43 am
page, I tried to update (yeah, earlier i couldn't) and I get the "There is a problem parsing the package" message when apk is being  installed. my device is LG Optimus Sol with android 2.3.4
Title: Re: Android Port (SDL2)
Post by: HappyCat on February 27, 2014, 11:01:55 am
Am I correct that there is currently no way to executing actions requiring right mouse button or control key on pc?
Things like turning the turret, opening doors and forcing fire.
Title: Re: Android Port (SDL2)
Post by: page on February 27, 2014, 08:45:43 pm
sidav: thanks for info and report. For anyone reading, I uploaded a beta2r1 which fixes that.
HappyCat: thanks for the link!
Title: Re: Android Port (SDL2)
Post by: page on February 27, 2014, 08:50:57 pm
Am I correct that there is currently no way to executing actions requiring right mouse button or control key on pc?
Things like turning the turret, opening doors and forcing fire.

Yep, only turning the soldier works.
Title: Re: Android Port (SDL2)
Post by: HappyCat on March 03, 2014, 07:12:10 am
I've found a bug related to turnging.
1. Turn the soldier "downwise", so he/she faces the screen.
2. Select next solder via "next soldier" button.
3. Press button "center on soldier".

Selected soldier sometimes also turns downwise. Never seen it happening with other directions.
UPD: Doesn't happen every time, so I am yet to find a solid way to reproduce this one.
Title: Re: Android Port (SDL2)
Post by: HappyCat on March 05, 2014, 09:48:01 pm
Step 3 in last bug description seems to be unnecessary.

I was actually able to open door without turning by swiping from soldier to door.

Background music is playing even when device is in sleep mode.
UPD: workaround for turning bug is to tap somewhere else before tapping "next soldier"
"Spend all TUs" button is unpressable for me. I can tap-hover it and get hint, though.
UPD2: soldiers often turns after using stun baton. Looks related to general turn issue.
Title: Re: Android Port (SDL2)
Post by: Warbear on March 28, 2014, 09:23:06 pm
Come on! I can't wait for the new update. There's an annoying bug: I can't get out of stats menu. I have to kill the game and then restart it.
Title: Re: Android Port (SDL2)
Post by: HappyCat on March 30, 2014, 09:52:34 pm
There is workaround: bind back button to cancel in options.
Title: Re: Android Port (SDL2)
Post by: sidav on March 30, 2014, 10:51:34 pm
Yes, there really are the turning glitches.
Title: Re: Android Port (SDL2)
Post by: HappyCat on April 04, 2014, 08:47:37 am
Overwhelming majority of users (but not everyone) reported that the game crashes sometimes when your soldier/tank/mind-controlled alien is killed. I experience this issue too. It is not persistent and usually doesn't occur again after game re-loading (but the game can crash later after re-loading), and generally seems random without any regularity, also it seems that there is no corellation between device model and this issue.
That's all for now, hope it was helpful
This seems to happen often when current unit dies of reaction fire or first unit ot move next xcom turn dies on alien turn.
Had to modify save game to help hwp survive and make mission completeable(
Title: Re: Android Port (SDL2)
Post by: page on May 15, 2014, 01:22:34 am
Greetings earthlings!

I've been a bit absent lately because of real life (a little alien has invaded my life ;) ) but I'm semi-back to having some spare time. Long story short, there is a new beta release in place. As always, links and changelog in the wiki, but for the impatient:

As you can see, it is now hosted on openxcom.org, (I'm sure you've all already seen the donation campaign in place to help with the server costs ;) ), as google took down the others from google docs.

One thing I'd like to know: is the crash on mind-controlled units still happening? Does it only happen in android or also pc?

Enjoy!
Title: Re: Android Port (SDL2)
Post by: sidav on May 15, 2014, 10:14:06 am
Thanks for new version, page! It works, but I already found a bug: when I go to options (changing of parameters doesn't matter) then click "OK", the game causes to exit (or to crash... looks like exit without any messages). Changes on options are saved, though. When i click "Cancel" in the options, everything is normal.
Also, game still complains about unexistence of the ogg files.
Title: Re: Android Port (SDL2)
Post by: page on May 15, 2014, 02:11:23 pm
Thanks for new version, page! It works, but I already found a bug: when I go to options (changing of parameters doesn't matter) then click "OK", the game causes to exit (or to crash... looks like exit without any messages). Changes on options are saved, though. When i click "Cancel" in the options, everything is normal.
Also, game still complains about unexistence of the ogg files.
Good catch :) As for the music, it should work. Are you sure you're not missing the gm.cat file, which was necessary to move or rename with older versions for ogg to work?
Title: Re: Android Port (SDL2)
Post by: sidav on May 15, 2014, 06:45:02 pm
page,  yes i sure. Maybe, I should change something in audio options?
What about the options bug? It's the most inconvenient thing for now...
Title: Re: Android Port (SDL2)
Post by: sidav on May 16, 2014, 07:45:31 pm
Another major problem, page. When I command my soldier or tank to shoot, then i can't exit froom shooting mode. Cursor becomes a crosschair and doesn't react on "back" button. It shoots, game doesn't hangs, just can't exit fire mode. In other menus (like soldier stats) the back button works as normal.
Remapping the back button to "Cancel" action in controls options doesn't help.
Title: Re: Android Port (SDL2)
Post by: page on May 17, 2014, 12:51:50 pm
Another major problem, page. When I command my soldier or tank to shoot, then i can't exit froom shooting mode. Cursor becomes a crosschair and doesn't react on "back" button. It shoots, game doesn't hangs, just can't exit fire mode. In other menus (like soldier stats) the back button works as normal.
Remapping the back button to "Cancel" action in controls options doesn't help.
Luckily Warboy 'fixed' that a while ago. You don't need the back button, but just to press the weapon button a 2nd time to cancel the shooting action. As for you pm question regarding fps and frame drop, it should work as before (to be honest, I'm not sure if fps is in effect or vsync is enabled by default).
Title: Re: Android Port (SDL2)
Post by: sidav on May 17, 2014, 04:01:08 pm
page, yeah, it works (i think it's even more useful than the back button :)
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 19, 2014, 03:28:09 pm
After a bit of googling around and fiddling with SDL_gfx (mostly to trick it into compiling with SDL2), I got myself an almost-working OXC-android build from page's source! Well, the debug version, anyway. I've still got a few questions, though:

 - Your Application.mk says to compile for armeabi-v7a, but the .apk you've posted has its libs built for armeabi; is that just an oversight?
 - Which ndk do you use? I'm using r7-crystax-5.beta3, as it's (kinda) supported by Boost. Still, I had to switch to gnustl_static, as it won't compile with stlport.
 - You're trying to load mikmod and smpeg2, but they're not getting built (at least they're not listed in your Android.mk). Is that right? Anyway, I've managed to run the app without them (after commenting out the corresponding loadLibrary() calls). My guess is that they're needed for different types of user data.
 - One thing I'm looking forward to is scaling the graphics. The tablets could really use the 1.5x-2x original resolution in Battlescape. Unfortunately, for now these options are broken (for a good reason, I guess). When I try and whack a hammer at it by changing the constants in Screen.cpp, the battlescape UI goes missing, but the battlescape itself looks beautiful! Though the animations in that case are painfully slow (even on a Nexus 4!).

Anyway, I'd love to see a how-to on compiling this port (or I could try to retrace my steps, but I'm afraid these would be among the "Worst Practices") and maybe do something useful, though my complete lack of experience as a developer will make that tough.
Oh, and you guys rock! 3D explosions are the best thing, and the android port comes really close.
Title: Re: Android Port (SDL2)
Post by: page on May 20, 2014, 12:42:43 am
Hi sfalexrog! Since I've been asked for those instructions several times lately, I took the time to write at least a basic description in the wiki page. As for your points:
- I thought only the Application.mk governed for which abi it was built? The libs in my builds folders seem to be for armeabi-v7a, how do you know/check that the apk has its libs built for armeabi? As you can see, I'm no ndk expert myself :)
- I don't know what's this 'crystax' ndk. I simply use r9d.
- mikmod and smpeg are SDL_mixer deps, available in its external folder. A bit of simlinking as shown in the wiki and you're done
- Yes, the rendering part needs some work, but I'm not yet familiar enough with oxc scaling to fix all that. You're invited to give it a go ;)

Well, hope this helped a bit. You can drop by the irc channel if you need anything.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 22, 2014, 08:21:22 am
Thanks, page! That helped a LOT. Looks like the r9d has stlport that supports exceptions and RTTI, so the compilation went flawless. I believe you only need the header files from boost.
 - As for armeabi and armeabi-v7a, well, I just looked inside your APK, saw that there's only libs/armeabi and no libs/armeabi-v7a and assumed that these were for armeabi. ndk-build _should_ place armeabi-v7a in the armeabi-v7a folder, so I guess there's something weird going on with your build system.
 - About the mikmod and smpeg libraries - okay, that makes sense, I just messed with SDL_mixer configuration and turned off pretty much everything except ogg. Don't know why exactly I did that - probably had some problems compiling it as it is.
 - Oh, the renderer. I've managed to recompile the app with higher internal resolution (still had to set GS and BS to 1.5x in the options, though), turning the cursor back on in the process. For some reason the cursor position didn't scale with the screen, so I had to "patch" the SDL_Event on the fly. I _think_ there must be a better way to do all this.
As for now, well, I got myself a version with 1.5x scaling:
(https://i.imgur.com/13gQtIy.png)
(on a Nexus 4, larger version (https://imgur.com/IhY5nMi))
(https://i.imgur.com/P7LjYG2.png)
(on a Nexus 7, larger version (https://imgur.com/USmafq3))
Framerate seems okay, much better than when I've tried messing with the source the first time.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 23, 2014, 09:11:26 pm
Okay, looks like I've found the reason for the "OK button crash". Android sure doesn't like multiple windows. The fix is to create the window and the renderer separately, and to only destroy and recreate the renderer. The window is not going to get resized anyway (well, at least not on stock devices), so we just reuse it.
Sorry for no pull request, I'm new to all this github stuff and can't make heads or tails of it  :-[
Anyway, I think I should try and figure out what's up with the scaling the right way.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 23, 2014, 11:35:42 pm
Sorry for triple-posting, but I guess I should share this thing.

I've merged page's source with the current master (commit 962c78598d at the time of writing), "fixed" the screen resizing code (couldn't figure out how to make a pull request though), fiddled a bit with package names and got this: https://dl.dropboxusercontent.com/u/732324/openxcom-debug.apk (https://dl.dropboxusercontent.com/u/732324/openxcom-debug.apk)
This apk is signed with a debug key, so I guess it won't run unless you have an option to run debuggable apps or something. Also it needs the latest data (unless you want to see some STR_ placeholders).

A few precautions:
 - I'm still building without smpeg2 and mikmod, so your mileage in terms of sound may vary. I probably should rebuild the package with them.
 - I've only built for armeabi-v7a, so some older devices are probably out of luck.
 - Since I can't say I always know what I'm doing, anything can happen, up to and including a chryssalid walking out of your android device and making zombies from your dog and your cat. You have been warned.
Title: Re: Android Port (SDL2)
Post by: page on May 24, 2014, 12:20:09 am
Not tested yet, but nice job! However, I checked your github repo (I guess you have the same nick there?) and couldn't find any changes. Could you at least push there so I can see/pull the changes? Thanks!
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 24, 2014, 06:31:51 am
Yes, https://github.com/sfalexrog/OpenXcom is my repo, but I got stuck a bit trying to figure out how it worked. Tried pushing the changes, it's probably broken now but I think the relevant changes are here. Unfortunately, I've been dumb and made a commit that has fixes for resolution AND name changes. I'm not good with computers  :-[

Also, the bug with game crashing due to soldiers dying to reaction fire is still there. Will look into it later, I guess.

EDIT: Okay, I think I've figured out what caused the game crashing. The fix should be on github. New debug build is also up for everyone brave enough to test it.
MORE EDIT: Okay, looks like I've figured out how to git fetch upstream, git merge and git push. I think the current version is playable, didn't encounter anything game-breaking (then again, I messed with the code and git more than I've played, which is a good thing, I guess?)
Title: Re: Android Port (SDL2)
Post by: sfalexrog on May 28, 2014, 02:09:14 pm
I guess it won't hurt if I just post another version signed with a debug key:
https://dl.dropboxusercontent.com/u/732324/openxcom-1.0-debug.apk

This version should be up to date with today's (2014-05-27 23:05) nightly, and has some minor changes:
 - Drag scrolling uses left mouse button by default (so it's enabled for geoscape and battlescape)
 - page's drag scrolling code is disabled in favor of the common code (i.e. which is used in the desktop version). Swiping from soldier to turn still works, though.
 - Save/load screens should be somewhat easier to use (loading starts when you lift your finger up, not when you tap the screen)

Known bugs:
 - Sometimes the intro will play at a very high speed
 - Multitouch is broken
 - Quitting with the button apparently doesn't work exactly as intended, and some menu items (especially in Advanced options) might get duplicated. It's better to remove the game from the recents before starting it again.
 - Loading screen is shown in 320x200, so not everything fits in

Of course, you should update your data folder with the current nightly.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 01, 2014, 12:47:06 pm
Ah, why the hell not.

I've heard about performance issues on some devices (high CPU and battery consumption), and while I'm no wizard and can't really do anything about most graphics stuff happening on the CPU, here's a version with some snake(men) oil sprinkled on it: https://dl.dropboxusercontent.com/u/732324/openxcom-1.0-debug-opt.apk

I've tried changing the compiler to clang-3.4 and messing with compiler flags, resulting in a somewhat larger binary that should have some more optimizations turned on. As for any real performance gains, I'm not sure they're there. Like I've said, snake(men) oil.

Still, it (mostly) corresponds to the current (2014-06-01 06:23) nightly, and has some added features:
 - Placing more than one finger on your touchscreen should no longer make the game freak out
 - There's a rudimentary support for multitouch gestures. So far it's only implemented for geoscape, and it's really basic, but it will zoom in/out if you pinch fast enough (for now it's tied to the pinch speed)
 - Not sure if I've posted about it, but hiding the keyboard no longer gets you stuck in text input: just tap on it again! To save the text you still need to hit enter, though.

So, yeah. Update data folder, load the game, see if there's anything broken.
Title: Re: Android Port (SDL2)
Post by: hawk66 on June 05, 2014, 10:39:11 pm
I've managed to install the app and copied the folders

to /storage/sdcard0/openxcom/data

so data is the root for the contents of the openxcom data files and the original files.

I get the error 'Failed to open direcotry : SoldierName/'

So, what I'am doing wrong here?

Thanks.

EDIT:
I messed up the folder structure and did not realize it...very nice port :), thanks a lot for doing this!!!
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 07, 2014, 12:11:11 am
Thanks! Nice to know someone is actually using the android version  :)

Also, more updates!
This version:
 - Should have all changes from the upstream!
 - Has an option to change video scaler! (currently you can have either a "blurry" one or a "blocky" one - linear or disabled)
 - Has a better implementation of globe-pinching!
 - Lifts the base-naming window higher (so that the name won't be obscured by a keyboard)!
 - Adds a "cancel" button for the first base naming window! (It's buggy at the moment, and I don't know why one would want to use it, but here you have it)
 - Based on current (as in hg-current) SDL2, SDL2_image and SDL2_mixer, so expect some bugs to be fixed and other introduced!

Anyway, this update will probably break something really hard, so I'll be happy to have all your logcats from crashes.
New version:
https://dl.dropboxusercontent.com/u/732324/openxcom-1.0-fef3d48e-debug.apk
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 11, 2014, 01:00:49 am
Updated the port a bit more.

In this version:
 - Game should no longer crash on globe pinch-zooming (credit goes to SupSuper for telling me what to fix);
 - Onscreen keyboard now hides if the associated TextEdit gets destroyed;
 - Not sure if that's a noticeable change, but SDL and yaml libraries are now statically linked.

New version: https://dl.dropboxusercontent.com/u/732324/openxcom-1.0-916d160c-debug.apk
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 14, 2014, 05:34:23 pm
Now that 1.0 is released, will there be an Android build? Thanks!
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 14, 2014, 07:32:04 pm
It's going to be up on the main site soon, but I guess it won't hurt to post the link here.
https://dl.dropboxusercontent.com/u/732324/OpenXcom-1.0.apk
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 14, 2014, 09:31:22 pm
Is there an updated data archive for it too? I only found one posted by someone else in May a couple pages back.
Title: Re: Android Port (SDL2)
Post by: SupSuper on June 14, 2014, 10:54:12 pm
You can grab the OpenXcom data from any port (eg. the Windows ZIP on the Downloads page). The original game data is up to you to get. :P
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 14, 2014, 11:05:14 pm
The original game data was easy because I was ironically playing it via DOSBox Turbo when I heard that OpenXcom had just been released.

The OpenXcom data was the part I was wondering about. I managed to get it from the 1.0 release tag on github, though, as that was as easy as any other method to accomplish on a tablet away from home.
Title: Re: Android Port (SDL2)
Post by: Xuio on June 15, 2014, 08:49:31 pm
I have little problem with version 1.0 and my Galaxy Note 3. Buttons in sell/purchase and skyranger equip screens are "stuck" when i press them with s-pen, so selecting small number of items is very inconvenient. The rest is great.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 15, 2014, 09:08:35 pm
The only real quirk I've noticed on my Nexus 7 is that when in shooting mode I have to click the gun icon to cancel shooting mode before I can click any other buttons. Oh, and for some reason I can't drag inventory items (but I can click to grab and click to place).

Compared to playing in DOSBox Turbo, it's great being able to drag scroll and to see radar ranges and vectors on the tactical display. On the other hand I miss the Roland music, and the drag-to-turn for soldiers is touchy.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 16, 2014, 02:21:14 am
Xuio, I've heard about buttons being stuck on some devices, but unfortunately couldn't reproduce it on my end. It probably has something to do with the way SDL2 handles touch devices, but since I don't have access to any device with an active stylus, I can't be sure on how to fix that. Still, I hope it'll be fixed eventually  :)

HunterZ, well, I hate to ruin the magic, but touchscreen support is somewhat barebones because it's mainly mouse emulation, and there's only so much you can do with it. I've noticed myself trying to drag-drop things on the inventory screen, so maybe I'll get down to implementing it some day :) Maybe I'll tune drag-turning a bit too, but that might start to interfere with map drag-scrolling. As for Roland music, well, you can actually make some .OGGs and use them!

Also, well, since android is experimental (hey, the front page says it!), I might as well try and do some experimenting:
 - Now the game actually tries to use your system locale. I'm not sure where it's used apart from setting the display language on the first launch, but Android should ignore locale with native code anyway, so I wouldn't expect things to break too much.
 - Also, OpenXcom's data, translations and data patch are now contained inside the package. You still need the original data, and you'll have to place it in /sdcard/OpenXcom/data as usual, but everything else will be installed automagically.

Since I have no experience with Java and its Android implementation in particular, expect things to break hard. Still, even if they do break for some reason, don't hesitate to tell me about it, maybe I'll fix it somehow!

The link is here:
https://dl.dropboxusercontent.com/u/732324/OpenXcom-1.0-bundle.apk
Title: Re: Android Port (SDL2)
Post by: jedikwon on June 16, 2014, 02:22:52 am
Can someone tell how to do Right click? I cannot make a soldier to face different ways and cancel aiming. Back button on my Android tablet doesn't do anything.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 16, 2014, 02:29:33 am
Can someone tell how to do Right click? I cannot make a soldier to face different ways and cancel aiming. Back button on my Android tablet doesn't do anything.
Facing is accomplished by swiping on the soldier in the direction he/she should face. It's a bit tricky.

Canceling aiming mode can be done by tapping on the weapon icon again.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 16, 2014, 03:00:03 am


HunterZ, well, I hate to ruin the magic, but touchscreen support is somewhat barebones because it's mainly mouse emulation, and there's only so much you can do with it. I've noticed myself trying to drag-drop things on the inventory screen, so maybe I'll get down to implementing it some day :)
Makes sense, as I noticed it was a native app that uses SDL.

Maybe if you are able to hack only the inventory screen input logic to drive the mouse up/down status based on whether the user's finger is touching the screen?

Quote
Maybe I'll tune drag-turning a bit too, but that might start to interfere with map drag-scrolling.
Yeah, I don't have any ideas about how to make things better there, except maybe to do it via a virtual D-pad overlay or something.

Quote
As for Roland music, well, you can actually make some .OGGs and use them!
Unfortunately I only have a real MT-32, and the game takes advantage of additional CM-32 sounds. I could maybe try putting my SC-88 in CM-32 mode, but that would only work if the game doesn't try to program the synth with any custom instrument sound parameters.

For now I've installed OGGs of SC-55 soundfont recordings, which are a decent step up from AdLib.

Title: Re: Android Port (SDL2)
Post by: blahbluh on June 16, 2014, 04:02:46 pm
Thanks! Nice to know someone is actually using the android version  :)

Son, you're doing God's work. Your port was posted on www.reddit.com/r/androidgaming, so you're probably going to get a lot more feedback from now on. As soon as I get home, I'll install the apk on all my devices, I'll get back with I encounter any bugs.
Title: Re: Android Port (SDL2)
Post by: jedikwon on June 17, 2014, 07:53:15 am
Facing is accomplished by swiping on the soldier in the direction he/she should face. It's a bit tricky.

Canceling aiming mode can be done by tapping on the weapon icon again.

Oh I see. Thank you. It is tricky as you say though. I wish I can use Android Back button as a right mouse button.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 17, 2014, 08:47:55 am
Oh I see. Thank you. It is tricky as you say though. I wish I can use Android Back button as a right mouse button.
Hey, that's not a bad idea since it would address both the facing and shooting issues, and I don't think the back button is currently used for anything else.
Title: Re: Android Port (SDL2)
Post by: vpraetor on June 17, 2014, 03:43:45 pm
Just registered to say thank you for working on it.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 18, 2014, 05:48:06 am
For some reason the MT-32 OGG soundtrack posted in the following thread sounds like static on Android OpenXcom 1.0: https://openxcom.org/forum/index.php?topic=2270.0

I'm not sure why this is happening, since the OGGs play fine on Android in a media player app, and the SC-55 soundtrack OGGs sound fine in game.
Title: Re: Android Port (SDL2)
Post by: SupSuper on June 18, 2014, 06:59:56 am
Mismatching sample rate settings maybe?
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 18, 2014, 07:13:21 am
Mismatching sample rate settings maybe?
It's possible. It may also be that the MT-32 soundtrack is recorded at much higher sampling and bit rates. The working SC-55 OGG soundtrack is 44kHz 128kbps, while the MT-32 one is 48kHz 499kbps.

If it matters, Android port of OpenXcom defaults to 22kHz sound output, so it's probably downsampling both soundtracks on the fly unless the music doesn't go through the game's 22kHz audio mixer.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 18, 2014, 03:12:59 pm
For some reason the MT-32 OGG soundtrack posted in the following thread sounds like static on Android OpenXcom 1.0: https://openxcom.org/forum/index.php?topic=2270.0

I'm not sure why this is happening, since the OGGs play fine on Android in a media player app, and the SC-55 soundtrack OGGs sound fine in game.

First off, by Gods that soundtrack is beautiful! I nearly fell in love with that sound.

Second, for what it's worth, I've tried downsampling the audio to 22050 Hz, which made it somewhat paler, but I've thrown the resulting files to Android and they worked. Not sure what's the problem with 48000 Hz version, but it might be android or SDL2_mixer screwing up some resampling. I'll admit that I didn't touch the sound code, nor did I look into any changes to it (if there were any). Maybe resampling to 44100 Hz will work better in terms of sound.
Title: Re: Android Port (SDL2)
Post by: kiksy on June 19, 2014, 11:03:50 am
Signed up to say thanks for this, no bugs so far. Installed the improved sounds mod and that seems fine too.

+1 for back button as right click.
Title: Re: Android Port (SDL2)
Post by: balbaroth on June 19, 2014, 05:53:19 pm
Thanks for this marvelous xcom android port
i can now kill aliens at work ;)

I went thru the whole thread and i didnt saw anything that mention mod support

My question is about mod support : i was able to put mods that doesnt modify the .exe
but the best mod : Soldier diaries modify the game .exe

is there a way to build a apk that has that modified openxcom.exe so that wonderful mod work on android ? :)
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 20, 2014, 07:56:03 am
I tried using the 44kHz SC-55 OGG soundtrack with the game's sampling rate set to various values, and found that it also had issues at any setting other than 22kHz. It seems that the OGG support of the Android version is very shaky.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 20, 2014, 12:46:02 pm
I tried using the 44kHz SC-55 OGG soundtrack with the game's sampling rate set to various values, and found that it also had issues at any setting other than 22kHz. It seems that the OGG support of the Android version is very shaky.

The OGGs (and all other sounds, IIRC) are handled by SDL2_mixer, not by the game itself. Its support for Android may be flaky, but I can't really do much about that apart from updating the library once in a while.

My question is about mod support : i was able to put mods that doesnt modify the .exe
but the best mod : Soldier diaries modify the game .exe

is there a way to build a apk that has that modified openxcom.exe so that wonderful mod work on android ? :)

Well, that won't work with any binary mod, but since Shoes has opensourced his changes, I guess it's just a merge and a build away. The real trouble is that I don't really want to get too far away from the main source tree (there are already enough things that may and will break in the future), and I've screwed with the build process too much without documenting anything. I'll try to provide the build instructions and scripts "soon" (well, as soon as I make them anyway, I'm still doing some things by hand).

I wish I can use Android Back button as a right mouse button.

I see the appeal of the back button, but I'm not convinced. Back buttons, like many other Android things, are not as standard as you'd want: for example, I'm using a custom ROM with PIE controls (the ones that kinda "slide out" instead of always being on screen). The back button on these controls is not caught by the game, but instead screws up the game's window. Personally, I like the idea of "long tap to turn" much more. As for other things - doesn't the back button already cancel the current action? (yeah, I know I should know better, but hey, ROM screwing and all that  :) )
Title: Re: Android Port (SDL2)
Post by: balbaroth on June 20, 2014, 04:45:42 pm

Well, that won't work with any binary mod, but since Shoes has opensourced his changes, I guess it's just a merge and a build away. The real trouble is that I don't really want to get too far away from the main source tree (there are already enough things that may and will break in the future), and I've screwed with the build process too much without documenting anything. I'll try to provide the build instructions and scripts "soon" (well, as soon as I make them anyway, I'm still doing some things by hand).


Thanks for the fast reply :) ill be following your progress! Amazing work
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 20, 2014, 05:02:10 pm
I see the appeal of the back button, but I'm not convinced. Back buttons, like many other Android things, are not as standard as you'd want: for example, I'm using a custom ROM with PIE controls (the ones that kinda "slide out" instead of always being on screen). The back button on these controls is not caught by the game, but instead screws up the game's window. Personally, I like the idea of "long tap to turn" much more. As for other things - doesn't the back button already cancel the current action? (yeah, I know I should know better, but hey, ROM screwing and all that  :) )
The back button does nothing right now as far as I can tell.

Maybe you could wire both long press and back button actions to simulate a right click? That would allow people to use either method for turning and canceling.
Title: Re: Android Port (SDL2)
Post by: kiksy on June 21, 2014, 10:18:33 am
Does anyone else have issues buying/selling items in the base screen? If I click to buy, quite often the button will get stuck and just max out. I kind of remember this may have been a bug in the original version?

Had a look around on here and no one else seems to have mentioned it though.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 21, 2014, 05:08:32 pm
Does anyone else have issues buying/selling items in the base screen? If I click to buy, quite often the button will get stuck and just max out. I kind of remember this may have been a bug in the original version?

Had a look around on here and no one else seems to have mentioned it though.
I haven't had that happen on my 2012 Nexus 7.
Title: Re: Android Port (SDL2)
Post by: Xuio on June 21, 2014, 06:03:37 pm
Does anyone else have issues buying/selling items in the base screen? If I click to buy, quite often the button will get stuck and just max out. I kind of remember this may have been a bug in the original version?

Had a look around on here and no one else seems to have mentioned it though.

Yes, i've noticed it too (and wrote about it few pages ago), especially with galaxy note 3 s-pen, but it happens also with finger control. 
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 21, 2014, 08:24:29 pm
Converted the 48khz MT-32 OGGs to 44khz using Audacity and they still don't work on the Android version. Oh well, the SC-55 soundtrack is passable and I play with the sound off most of the time anyway.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 23, 2014, 11:29:38 pm
The back button does nothing right now as far as I can tell.

Maybe you could wire both long press and back button actions to simulate a right click? That would allow people to use either method for turning and canceling.

That's funny, because I didn't change a line of code concerning back button handling! Must be an SDL2 thing. Maybe that's also the case of Android not being too standard across the wide range of devices.

Converted the 48khz MT-32 OGGs to 44khz using Audacity and they still don't work on the Android version. Oh well, the SC-55 soundtrack is passable and I play with the sound off most of the time anyway.

That's strange; I've tried converting the files to 44khz and they worked. Maybe it's the bitrate issue? I didn't set the highest quality. Here's my files: https://dl.dropboxusercontent.com/u/732324/mt32-44khz.zip

Does anyone else have issues buying/selling items in the base screen? If I click to buy, quite often the button will get stuck and just max out. I kind of remember this may have been a bug in the original version?

Had a look around on here and no one else seems to have mentioned it though.


Yes, i've noticed it too (and wrote about it few pages ago), especially with galaxy note 3 s-pen, but it happens also with finger control. 

Huh, I remember making some changes to fix that kind of behavior, but either forgot to post it or the workaround didn't really work. Anyway, there were some recent changes within SDL2 that might've fixed the issue.

So, what am I missing... Oh, right.
New build everyone!
It's synched with the current nightly, so expect fixes and features from that to be present here.
For my part, the changes are minor:
 - Selected (aiming) weapon is highlighted by a red border (replacing the default blue-ish)
 - You can now long press to turn your unit in addition to swiping. Long press duration is 500 ms.

My Dropbox link is here: https://dl.dropboxusercontent.com/u/732324/OpenXcom-1.0-25a50398dc-bundle.apk
Also, I've tried putting the build as a mod on the mod portal: https://www.openxcom.com/mod/openxcom-android-nightly - but I'm not sure if I've done everything correctly.
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 24, 2014, 12:05:00 am
Regarding the nightly:

Does it include the corresponding version of the data files from the OpenXcom Git repo?

What is the difference between the two files linked on the mod page?
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 24, 2014, 12:17:49 am
Regarding the nightly:

Does it include the corresponding version of the data files from the OpenXcom Git repo?

What is the difference between the two files linked on the mod page?

Yes. I've hacked together a kind-of-auto-updater (the .apk has the data, translations and "universal" patch embedded inside it as .zips), so it checks if the files need updating and does that. No more worries about updating your data!

There is no difference, the file was not working for me the first time I've uploaded it, so I've tried to reupload (since the system told me I had no files) and bam - two files! (I'm good with computers, I swear!  :) )
Title: Re: Android Port (SDL2)
Post by: Xuio on June 24, 2014, 01:11:22 am
Huh, I remember making some changes to fix that kind of behavior, but either forgot to post it or the workaround didn't really work. Anyway, there were some recent changes within SDL2 that might've fixed the issue.

Wow it's fixed now, even with s-pen :-) Thank You!
Title: Re: Android Port (SDL2)
Post by: HunterZ on June 24, 2014, 03:15:44 am
That's strange; I've tried converting the files to 44khz and they worked. Maybe it's the bitrate issue? I didn't set the highest quality. Here's my files: https://dl.dropboxusercontent.com/u/732324/mt32-44khz.zip
Thanks, I'll give those a try. It looks like yours are 224kbps and mine turned out to be 160kbps.

Update: It works, thanks!
Title: Re: Android Port (SDL2)
Post by: Minotaton on June 25, 2014, 04:52:23 pm
Great port. Works great apart from the space key doesn't work my plug in USB keyboard. Works fine outside the game. Also I can't download the nightly build from the mod portal. Says temporarily unavailable.
Title: Re: Android Port (SDL2)
Post by: meltyman on June 25, 2014, 06:03:05 pm
My tablet is Ramos i10 pro.

I have found following issues:
-Save/load -menus don't show date when game was saved. Only ???? where date should be
-When clicking "Don't reselect unit"-button in battle screen and all soldiers have been selected at once, game crashes.
-Battlescape scape doesn't work correcty: Only original-mode works. If i select full display and load battlescreen, I get blak screen. In other modes the action buttons are not visible.
Title: Re: Android Port (SDL2)
Post by: sfalexrog on June 26, 2014, 10:15:37 am
I have found following issues:

Which version are you using? These issues sound suspiciously like the ones I've fixed some time ago. At the very least I couldn't reproduce them on my recent build.

Currently the thread for the new version is here: https://openxcom.org/forum/index.php?topic=2428 (https://openxcom.org/forum/index.php?topic=2428).
Title: Re: Android Port (SDL2)
Post by: papamaanbeer on September 05, 2014, 12:54:06 am
i would love if some people that know how to do it would pick this up
Title: Re: Android Port (SDL2)
Post by: Harpo on August 14, 2015, 06:25:30 pm
I installed the android app from the playstore last night.  It crashes when going into "battle mode" every time.  It's a Galaxy 10.1.  Is there already a way around this issue?  I am finding the messages on search to be somewhat confusing....  Thanks! 
Title: Re: Android Port (SDL2)
Post by: sfalexrog on August 14, 2015, 09:28:04 pm
I installed the android app from the playstore last night.

Well, that's curious! Normally I'd just direct you to the "proper" Android thread, which is located here: https://openxcom.org/forum/index.php/topic,2428.0.html (https://openxcom.org/forum/index.php/topic,2428.0.html), but would you please be so kind as to provide a link to that playstore? There's no OpenXcom in the Google Play Store as far as I know, and the version that's published anywhere but on this forum and the modsite is not known to me.

The problem is probably because of the wrong data/ruleset for the game, it's probably a really outdated version (the app has since been modified to include everything you need except for the original game data), so you should probably remove the version you got, get a recent build and try it out. Also, please PM me the .apk you got from that "playstore", I'd like to have a good look at it.
Title: Re: Android Port (SDL2)
Post by: xracer on October 03, 2015, 07:23:29 pm
Well, that's curious! Normally I'd just direct you to the "proper" Android thread, which is located here: https://openxcom.org/forum/index.php/topic,2428.0.html (https://openxcom.org/forum/index.php/topic,2428.0.html), but would you please be so kind as to provide a link to that playstore? There's no OpenXcom in the Google Play Store as far as I know, and the version that's published anywhere but on this forum and the modsite is not known to me.

I think he means XCOM as in the new XCOM not our beloved X-COM or OXC