Forum index VCMI Project - Heroes 3: WoG recreated
Forum of the project aiming to recreate best turn-based strategy ever!

FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  StatisticsStatistics
RegisterRegister  Log inLog in  AlbumAlbum  DownloadDownload

Previous topic :: Next topic
Moved by: Warmonger
2014-02-23, 18:28
VCMI for Android
Author Message
Robin

Joined: 30 Apr 2016
Posts: 15
Posted: 2017-01-09, 09:30   how to compile the code please?

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?
 
     
Fay 
User defined rank


Joined: 07 Apr 2014
Posts: 54
Posted: 2017-01-12, 11:34   

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

Quote:
The intro is still laggy when trying to skip but meh with it, it's just intro.
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.

Quote:
The walking on the map is choppy as hell but it works at least so I'm not complaining.
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. ;)

Quote:
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.
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.

Quote:
- Clicking certain point is sometimes tricky
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).

Quote:
But when using bad resolution (screen ratio) there are artifacts between the game screen itself and the edges of the screen
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.

Quote:
Is there any way to use the mods for vcmi?
After the app initializes the first time, you can put the mods in <app-root-folder>/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.
 
     
val-gaav 

Joined: 24 Feb 2008
Posts: 186
Posted: 2017-01-12, 18:20   

Fay wrote:
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.

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.
 
     
HarryPhoon

Joined: 06 Jan 2017
Posts: 9
Posted: 2017-01-22, 23:57   

Quote:
Quote:
But when using bad resolution (screen ratio) there are artifacts between the game screen itself and the edges of the screen
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.


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.

https://postimg.org/image/7iqhvhl4z/
https://postimg.org/image/bz99713ct/
https://postimg.org/image/6v04032yv/
 
     
Kiiro Yakumo 
Daredevil


Joined: 20 Nov 2016
Posts: 10
Location: Rata Sum
Posted: 2017-02-21, 20:47   

Quote:
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.

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

Quote:
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. ;)

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

Quote:
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.

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.

Quote:
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).

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

Quote:
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.

Oh ye~! That would be nice too, Vol Up/Down and stuff...
_________________
For any talk-related stuff please contact my PK-632z Golem.
 
     
SomeGuy147 
Enthusiast

Joined: 06 Mar 2017
Posts: 3
Posted: 2017-03-06, 21:53   

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:

  • 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.
  • 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.
  • I know it was in the second point but for the love of god implement right click in some way
  • 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.
  • Whole menu, loading, displaying maps and that stuff in general is significantly laggier and slower than xyz's version.
  • 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.
  • 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.

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.
 
     
Fay 
User defined rank


Joined: 07 Apr 2014
Posts: 54
Posted: 2017-03-11, 22:00   

@SomeGuy147 Most of the differences probably come from the fact that xyz used unofficial sdl 1.2 port (https://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...

Quote:
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.
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.

Quote:
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.
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).

Quote:
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.
Well, tablets have bigger screens so I assume it could be used there.

Quote:
Whole menu, loading, displaying maps and that stuff in general is significantly laggier and slower than xyz's version.
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
Quote:
Oh~! Sneaky 3DO, pretending it's just an intro
I meant desktop vcmi version, not OH3. No idea how resources are loaded in the original. ;)

@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.
 
     
SomeGuy147 
Enthusiast

Joined: 06 Mar 2017
Posts: 3
Posted: 2017-03-12, 17:37   

Fay wrote:

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).

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?
 
     
Fay 
User defined rank


Joined: 07 Apr 2014
Posts: 54
Posted: 2017-03-12, 23:17   

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.
 
     
Warmonger 
VCMI programmer


Age: 28
Joined: 07 Jun 2008
Posts: 1545
Location: Warsaw, Poland
Posted: 2017-03-13, 06:44   

Quote:
2. there are lots of full map redraws during the movement and android can't really keep up.

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 :-/
_________________
Think twice if you really need to send me private message. Use public forum for general questions.
DJ Warmonger blog
beegee wrote:
Warmonger, you are the best!
 
 
     
Jendrus 

Joined: 13 Mar 2017
Posts: 1
Location: Lublin, Poland
Posted: 2017-03-13, 16:52   

Could someone explain to me instalation step by step? What i must download? api16 or api21?
 
 
     
Fay 
User defined rank


Joined: 07 Apr 2014
Posts: 54
Posted: 2017-03-13, 23:26   

Quote:
What i must download? api16 or api21?
api21 is for android 5.0+. If you have 4.1-4.4.x, you can only use api16. "Installation" instructions should be displayed in the launcher, but rough description is in the post with the first version http://forum.vcmi.eu/viewtopic.php?p=15731#15731

Quote:
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
Maybe it would be possible to change these forced full redraws into partial draws (redrawing only hero tiles + neighbors(?)) because nothing except hero animation changes there. I might try looking into it (at some point).

--

Sooo I built new packages, but they're quite weird this time and I'm not sure if they work correctly (honestly, compiling them feels very random). It works correctly on my 7.1 device, but I was unable to start the app on any emulator (tested on three different ones and each one is broken in a different way...). I don't know, I might need to downgrade sdk/ide or something if it doesn't work for others.

If you feel lucky, you can try it.
https://github.com/Fayth/vcmi-android/releases/download/4/vcmi-api16-20170313-debug.7z
https://github.com/Fayth/vcmi-android/releases/download/4/vcmi-api21-20170313-debug.7z

Changes:
* right-clicking support (two modes, switchable in launcher; personally, after some testing I find relative cursor very weird but I'll leave it there),
* intro doesn't appear frozen anymore (after interrupting intro, screen is cleaned + progressbar is displayed); this might also possibly fix HarryPhoon's problem with artifacts on the sides, buuut I don't know,
* hack that might make hero movement animations slightly smoother.
 
     
Alextk69 

Age: 29
Joined: 14 Mar 2017
Posts: 1
Posted: 2017-03-14, 06:58   

Fay wrote:
If you feel lucky, you can try it.
https://github.com/Fayth/vcmi-android/releases/download/4/vcmi-api16-20170313-debug.7z
https://github.com/Fayth/vcmi-android/releases/download/4/vcmi-api21-20170313-debug.7z


I just updated from the previous version of vcmi that I had and everything went smooth. On my device, Lenovo P2 with Android 6.0.1, the game works absolutely amazing. The right click is working very well and the hero movement is so smooth now. I've played for a few minutes with no crashes and bugs at all. Thanks for the excellent release, Fay!
 
     
SomeGuy147 
Enthusiast

Joined: 06 Mar 2017
Posts: 3
Posted: 2017-03-14, 19:57   

Fay wrote:

Changes:
* right-clicking support (two modes, switchable in launcher; personally, after some testing I find relative cursor very weird but I'll leave it there),
* intro doesn't appear frozen anymore (after interrupting intro, screen is cleaned + progressbar is displayed); this might also possibly fix HarryPhoon's problem with artifacts on the sides, buuut I don't know,
* hack that might make hero movement animations slightly smoother.

Few things I noticed:

  • Relative cursor mode doesn't seem to work very well, literally disappears after trying to press right click and you can move it off screen as much as you want, to the point where you completely lose it, thanks for adding it so fast though, if you're gonna fix it and don't mind working a bit more on it add sensitivity too, would be useful.
  • While intro seems much nicer now it seems to take longer time to load (might be just a psychological thing) and the sound of it disappeared (Actually now that I think about it, it may have not ever been there, if so dismiss this one), not something essential to the game but I think it worked previously.
  • Right clicking is pretty nice, takes a few clicks initially to get used to since one of your fingers always cover the information table but just moving fingers while you don't have them released solves the problem.
  • Walking seems a little bit smoother now, but further optimisation would go a long way.


Will edit if I find more stuff, thanks for the update! Oh also meant to ask, are there any performance differences between 16 and 21 API versions? And if not, what's the point of making two different ones? Also why does this update take up three times as much space compared to the last one?
 
     
Fay 
User defined rank


Joined: 07 Apr 2014
Posts: 54
Posted: 2017-03-18, 14:41   

Quote:
Relative cursor mode doesn't seem to work very well, literally disappears after trying to press right click and you can move it off screen as much as you want, to the point where you completely lose it, thanks for adding it so fast though, if you're gonna fix it and don't mind working a bit more on it add sensitivity too, would be useful.
Okay, you're right. That's because I wanted to do it without adding more java<=>c communication so I didn't have any reliable info about an actual cursor position and had to guess sometimes. I changed it to get the cursor directly from SDL an it works substantially better. Still can go offscreen though; not sure if I can limit it to actual game bounds.

Quote:
While intro seems much nicer now it seems to take longer time to load (might be just a psychological thing) and the sound of it disappeared (Actually now that I think about it, it may have not ever been there, if so dismiss this one), not something essential to the game but I think it worked previously.
The only things I changed there is clearing screen + displaying progressbar. Definitely nothing that could affect the loading speed.
I'm not sure about the sound because I always have it turned off. If it was there previously, it should still be there.

Quote:
are there any performance differences between 16 and 21 API versions? And if not, what's the point of making two different ones?
Okay, so the short answer is "it's complicated". ;) I could probably get away with building only one package. I'm not sure about some details but generally:
* android device can have one of 5 architectures (arm, arm-v7a, arm64-v8a, x86, x86_64); 64-bit ones require api21 (android 5.0+) and I think x86 needs api18 (android 4.3+),
* all arm-based archs should work "normally" with applications built for normal arm, but x86-based devices will probably not,
* I assume when the arch doesn't match, the performance is works becuse there needs to be some translations,
* running arm application on 64-bit device is probably the similar case as running 32bit applications on 64bit pc (slower, more limited, but usually not really noticable).

Currently the api16 package contains only arm arch and api21 contains all 5.

Quote:
why does this update take up three times as much space compared to the last one?
Because, for some reason, the apk file has no compression. I assume this is some kind of bug in android build system, because I can't see any settings to change it and previously it was compressed normally. You can test this by unpacking the apk file (it's just a zip) -- both packages have ~313MB after unpacking.

Quote:
I just updated from the previous version of vcmi that I had and everything went smooth. On my device, Lenovo P2 with Android 6.0.1, the game works absolutely amazing. The right click is working very well and the hero movement is so smooth now. I've played for a few minutes with no crashes and bugs at all. Thanks for the excellent release, Fay!
:)

I wrote:
Maybe it would be possible to change these forced full redraws into partial draws (redrawing only hero tiles + neighbors(?)) because nothing except hero animation changes there. I might try looking into it (at some point).
Actually... never mind. That's definitely not possible, because the screen follows the hero during movement.
 
     
Display posts from previous:   
Reply to topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
Add this topic to your bookmarks
Printable version

Jump to:  

Powered by phpBB modified by Przemo © 2003 phpBB Group

Hosting provided by DigitalOcean
Page generated in 0.04 second. SQL queries: 14