VCMI for Android

I didn’t really have time recently, so only a quick update this time…

@ Broken api21 package: okaaay, it’s broken and this was a problem on my side (actually, that’s due to some broken/undocumented feature of the build system). Hopefully this package is better.

@ Hang during map start/load: I managed to track this one down. It was occurring due to some weird interaction between jni->java communication and SDL events (I think that SDL hook to java was getting broken when client called jni method to start the server; after that, SDL_PollEvents froze the main SDL loop).

(additionally some better logging in launcher)

github.com/Fayth/vcmi-android/r … -debug.apk
github.com/Fayth/vcmi-android/r … -debug.apk

I haven’t checked other problems yet… I probably won’t be able to do anything for the next few+ days.

Yay new build to test!
I will check it up in a minute and see if something new is happening or not.
Also I’d like to clarify something, I made a mistake with Android version on my S2+ it’s not 5.5 but 5.1 sorry for the trouble. Also I’m working on updating it to 6.0 because why not, I hope it will still be viable testing thingie.
I will install new build for now on P9 and check the typical stuff…aaand write back asap.

EDIT #1
Interesting O_O
Installed API 21 edition on Huawei P9, tried loading the game and…it loaded O_O
I know I know, one load may be lucky for device or whatnot (of course I believe in the leading coder that it’s not random luck but true skill of fixing! :3).
The remaining thing to check is the fight…now to find something to fight.

EDIT #2
Good news! After the battle it didn’t crash either!
Good job mister, it’s working better and better :slight_smile:
The intro is still laggy when trying to skip but meh with it, it’s just intro.
The walking on the map is choppy as hell but it works at least so I’m not complaining.
The one thing I want to ask is how to do “right-click” here? I want to check sometimes stuff like “what does that magical spoon do?” and I can’t find any way for it.
That’s for Huawei P9 (EMUI Android 6.0 as a reminder).
I will now proceed with Samsung Galaxy S2+ (RR Android 5.1 as a reminder) and see if something is happening.

EDIT #3
Okay Samsung Galaxy S2+ (still 5.1) now runs VCMI both API 16 and API 21 to the point of launcher but launching the game itself still fails for some reason, I will check if there are any logs later.
I have managed to third week or so on Huawei P9 without serious problems, it looks like this:

  • Moving on the world map is a bit choppy, but besides that, no problems found.
  • Clicking certain point is sometimes tricky but still MUCH better and easier than “official HD edition” (pfffttt)
  • The battle is another story, it goes smoothly, too smothly, when let’s say Djins casts a spell on ally, I need to either remember by the sound what spell it is or check the battle log what has been cast. Overally I think all spells are being “executed” faster than I can say “Magic Missile!”. A little problematic but I can manage for now.
  • Ranged attacks in battle done well, Ubisoft can’t into this, pfeheh (altough I’m yet to check Magogs or whatever the name in english).
  • The right click is impossible to do, sometimes it’s key to be able to do it so I would like to mention it officially as wanted :stuck_out_tongue:
  • Save/Load no problems for now.
  • Text boxes done well, I will add one as a proof later :slight_smile:
  • More info to come if I find something

I installed api 21 after api16 they run, but have same problems for me . after battle game just close. Quick on or off dont care.
(And 1 time battle just not started)
Still unplayeble(

I think its good idea if will possible send logs after crash or freeze. In auto mode.

I think that we should share ours Games’s Data files. Because we all are talking about different version of game.
I’m using 3in1 Game in English.

I~ think I have “Gold Edition” in PL language, the version I’m not sure, no patches have been applied on top of what said “Gold Edition” is.

It’s better to purchase GoG version of Heroes3 Complete and this version should be basic.
gog.com/game/heroes_of_migh … te_edition
Promotions of this title are set regullary!

That version also works badly same as mentioned mine version previously.

Hey, just got back to HoMM again.

Downloaded the 21 API version on my Asus Nexus (2013). And the game works just fine in terms of not crashing. But when using bad resolution (screen ratio) there are artifacts between the game screen itself and the edges of the screen. There should be placed some kind of static image. Gonna write after some time if it doesn’t crash after longer play :wink: .

I’m using the gog complete version with some update installed.

EDIT: So, after few weeks the game works without any problems. But performance needs a serious tweak. The flaw of performance is very noticeable while hero walk and gathering (fade effect). Loading takes an eternity (H3 itself and game). And when playing with 6 AI players their turns take takes totally something over minute or two.

Is there any way to use the mods for vcmi?

You must edit modSetting.json file and there enable/disable mods (I guess).

I read the post about Android and download the code of xyz from git. i am NEW developer of android. do we have document about how to build vcmi on Android please? i tried to build IT with vs2015 android,but failed.

does anyone can add the guidance to wiki please?

Sooo I’m still alive and do plan to continue working on this, but not sure when (probably not very soon).

This is the same behaviour as desktop version, but it’s less noticeable because it loads much quicker. Basically app tries to load all data during intro on a separate thread, but when you skip intro, the main thread waits for the loading so it gets blocked until everything is loaded. This should be changed but it’s more on vcmi-side than android fix.

I didn’t check this, but I can confirm that movement animations don’t really work for me neither. From what I remember, heroes movement looks very complex and I don’t really want to mess with it. :wink:

Do you know if this was somehow solved in xyz’s version? Probably the most “intuitive” solution would be to use long-press as right click. This would require to add “proper” touch controls support. It would probably require a lot of changes in vcmi, because application assumes mouse input everywhere.
The only easy way to implement it that I can see atm is to add an ui element outside of the game that would cause next press to be treated as right-click. It definitely would be very inconvenient to use.

Pinch-to-zoom adventure map would be cool, but again, needs proper touch controls support. And possibly also changes to map drawing (as far as I remember, scaled drawing was much slower in SDL).

Didn’t notice it on my side… I’m not sure if I can do anything there, because the whole surface is managed by SDL. Might be worth to check it.

After the app initializes the first time, you can put the mods in /Mods (the same folder where you put game data), the start the launcher and you should be able to turn them on/off in the mods section.

As far as I remember in some early VCMI Android version I tried to play on a tablet right click was taken care of by SDL Android port setup. So right click should be taken care of by SDL itself and doesn’t need extra coding.

I think by default it worked as double touch= right click but I quickly changed it to more preferable hold volume up + touch = right click.

I didn’t meant exactly artifacts but it’s part of the game screen that disturbs a bit. And when I click the lower half on the left flickers. Attached some screenshota. The game runs in 800:600.

postimg.org/image/7iqhvhl4z/
postimg.org/image/bz99713ct/
postimg.org/image/6v04032yv/

Oh~! Sneaky 3DO, pretending it’s just an intro :stuck_out_tongue:
Well if it’s not bug per se, I have no objections here.

No objections here either, they work at least, so let’s not shout too much or they will get shy and stop working cough XD

Unfortunatelly I don’t know how it was done in xyz’s version. I don’t know how it looks in code-side but if I may give some ideas:

  • Another button like you mentioned, a fine idea, maybe inconvenient but better than nothing.
  • Double tap, not sure if it wouldn’t mess with normal controls, sometimes in Android games it works, sometimes not.
  • Two-finger tap, that could be very tricky, but another possibility.
  • A joke idea, code the mouse through USB, aka Smartphone <-> USB-special-cable-plug <-> USB Mouse, in theory it would work, but come on xD
    Other than that, no objections here.

Now I think about it, what if half of the problems are resolution-induced stuff? hmmm…

Oh ye~! That would be nice too, Vol Up/Down and stuff…

Just tested previously posted API16 and API21 builds and to my surprise both worked quite well, I am on Android 7.0, OxygenOS 4.0.3, OnePlus 3T, game version is from GOG. Few things did irk me though:
[ul]
] While intro plays perfectly well, there is some significant lag after skipping it, like solid 4-8 seconds. Didn’t happen at all with xyz’s version but hey, that one instantly crashes when trying to load a game from the menu so what do I know. /:m]
] The way controls are implemented seem awful to me, I much more preferred xyz’s way of doing things, he made so your finger upon touching the screen would act as a mouse and controlled the cursor in that way which was really accurate and felt pretty good. If you’re still wondering the way he made right click work was that if you had one finger on the screen dragging the mouse around and put a second one anywhere it would instantly stop and hold right click. It’s really intuitive and is easy to figure out even if you don’t know it beforehand./:m]
] I know it was in the second point but for the love of god implement right click in some way/:m]
] Resolutions higher than 1280x768 might as well not exist for phones since stuff gets ridiculously small and hard to see, but I am guessing you can’t fix this without redrawing everything./:m]
] Whole menu, loading, displaying maps and that stuff in general is significantly laggier and slower than xyz’s version./:m]
] After you choose your options and start the game there is like 1/10 chance a random very slim flashing bar appears on the very right of your screen, no idea what the hell could that be about. Just something I noticed, doesn’t really impact gameplay in any significant way./:m]
] I know you said that the hero movement coding is complex and you don’t wanna mess with it but if you could find a way to fix it, it would make the game nearly indistinguishable from the desktop version, could easily be an android store release if you’d do that./:m][/ul]
That’s it for now, still hadn’t had the chance to properly test it all out but will prob often turn it on when I have free time and report if I see anything acting up. Thanks for making this btw, really cheered up my day, hope you don’t give up on the development, wish I could help in some way.

@SomeGuy147 Most of the differences probably come from the fact that xyz used unofficial sdl 1.2 port (github.com/pelya/commandergenius) and I used official sdl 2.0.

I installed xyz version to check how it works because I haven’t seen it for a very long time. I don’t have any old devices on me to check in-game, but menus worked correctly. So…

I think that in xyz’s version, actual loading is done before the intro starts (splashscreen + some black screen afterwards). Ideally I just need a change that doesn’t freeze the main thread after skipping intro. Optionally displaying a progress bar in that case. It would look “correct” then. This shouldn’t be too hard, but again, I’m slightly hesitant to change vcmi code too much because it makes merging the changes harder.

This input handling is done in SDL port. Feels quite good and I thiiink I could port it. (few weeks ago I added a bandaid method to send right-clicks through extra button in gui, but this would probably work better).

Well, tablets have bigger screens so I assume it could be used there.

Probably nothing I can do. Either SDL2.0 is more CPU-heavy than SDL1.x, or VCMI 0.99 needs more resources than 0.97 (or both).

@Kiiro

I meant desktop vcmi version, not OH3. No idea how resources are loaded in the original. :wink:

@HarryPhoon
Yeah, basically “random” stuff from memory is displayed outside of the 4:3 game screen area. This is definitely a problem in SDL, because the app itself doesn’t even know if the bars are present. It might be fixable.

Edit next day ~ okay, so I added right-click support + changed intro so it looks better. I might build/upload apks later today.

Awesome, just wondering though, are you gonna try fixing movement animations at some point, or will you leave it as it is?

I’ll try to build apks tomorrow. I tried to do it, but currently the app seems to crash on older devices (and it looks like some android build system bug).

I’ve done some testing on the movement animations/logic. I think that the issue here is that

  1. movement logic uses some custom/manual rendering loop (with manual frame delays etc); I’m not sure if that’s a problem but certainly the rendering hero movement works differently that all other rendering
  2. there are lots of full map redraws during the movement and android can’t really keep up.

I made a small change/hack (basically added a frameskip during movement rendering so that it doesn’t do full redraws every frame) which helped (at least on my phone). I wouldn’t call it smooth, but definitely looks better than previously.

Yes. In fact I tried to remove map redraw altogether, but it lead to some crashes - couldn’t figure out why. Probably only original author knows why it’s implemented this way :-/