[OLD-1] AGS engine Android port

Started by JJS, Thu 03/11/2011 20:18:29

Previous topic - Next topic

HappyCat

Jumping into testing) Gonna give this build a try too.

StarkRG

Hey JJS, I'm just getting started exploring AGS and all it's wonderful goodness. I love what you've done so far on the Android port (though I am having issues where nearly all the games I loaded onto it crash at one point or another and return me to the home screen).

RE: Ouya Support
It shouldn't be necessary to install any particular things to support this as long as you can add controller support. I haven't delved into Android development too much so I can't give you any hints on supporting controller input. That said I have side-loaded a few games onto the Ouya that already had controller support and they work just fine. This might be useful to you: http://docs.nvidia.com/tegra/data/How_To_Support_Android_Game_Controllers.html (yes it's on a site dedicated to a particular chipset but it deals solely with InputDevice and InputEvent objects within the standard ADK) As an added bonus you'd be adding controller support for all android devices. Getting it on the Ouya store is another thing altogether but I can't imagine that would be too difficult.

I will certainly be keeping my eye on this project. One thing, though: eventually (as the bugs dwindle down), it would be nice if there were a way to use this as a wrapper on an AGS game that could then be released on the play store. I, for one, would be perfectly willing to provide some sort of monetary kickback to you if I ever decided to release something commercially (assuming the license allows such a thing, if not then maybe a donation to the... er... Charitable Fund For The Benefit of... er... JJS Porting Activities).

QuestingHero

Quote from: JJS on Fri 19/07/2013 07:27:53
Can you try this build with experimental mouse/keyboard support? I can only test it in a virtual machine, so I cannot tell how it behaves on a real device. Moving and left/right-click should work as well as most keyboard keys (including ESC and F1-F12). Is the AGS mouse cursor for you offset from the Android cursor? http://jjs.at/temp/AGS_mouse.apk
I was out of town this past weekend, so I didn't see your post until now. Right now I am at work so I can't try it out on the Ouya, BUT, my HTC One has USB OTG and I just tried it out on it (Mouse Only, no extra Keyboards here). Right and Left buttons work perfect, single clicks with both registered as expected. The mouse pointer did move when I moved the mouse, but at a much smaller scale. If I started at the far right side, and moved the mouse pointer all the way to the Left side, the Game Pointer only goes about 1/2 to 2/3 the way across. I would not worry about there being double cursers, DosBox Turbo and ScummVM have the same issue. On a side note about both of those apps, ScummVM keeps both cursers pretty close, DosBox Turbo on the other hand has a Mouse Offset that you can adjust (I think I have it about 35% - 40% if that helps at all).

QuestingHero

#403
UPDATE: I had both "Relative Mouse Control" and "Dragging with Longclink" checked in the settings. after turning both of them off, mouse movement is PERFECT! there are 2 mouse pointers (System Mouse is on top of Game Mouse), but the game mouse keeps right up with the system mouse. Even when I move the System mouse off the black area of the sides of the game (4x3 game on a 16x9 screen), when I brought the system mouse back to the game area, the game mouse jumped right back to it.

Well Done JJS, I look forward to installing this on my Ouya.

UPDATE 2: Just had a chance to test this on the Ouya and it works great! Just like before I had to make sure those 2 options were unchecked. My Test game was Quest for Glory 2. Everything with the mouse worked flawlessly. I did try out a full size USB Keyboard on the Ouya too, and all the Alpha keys worked. the numb pad worked (when numlock was on). All the supported F1-12 Keys worked. the only thing that didn't (and I don't know if this can even be fixed), is the Ctrl+Alpha keys didn't work. Like in the game you can press Ctrl+S to bring up your stats... but that is not a game breaker as they are duplicated in the menus.

Once again, Amazing work and thank you so much.

cianty

#404
QuestingHero, you just caused me to get a wireless mouse from Amazon. I can't wait to try this on my OUYA.

I have a few AGS games that I still need to play so I'll use them as test cases. :)

Update: Even without a proper mouse this already works great on OUYA. The mouse movement is perfect and the controller has already left clicks (U) and right clicks (Y) built in. Sweet! Now if only the controller's touchpad was a bit nicer.
ca. 70% completed

QuestingHero

Quote from: cianty on Wed 24/07/2013 19:04:15
QuestingHero, you just caused me to get a wireless mouse from Amazon. I can't wait to try this on my OUYA.

I have a few AGS games that I still need to play so I'll use them as test cases. :)

Update: Even without a proper mouse this already works great on OUYA. The mouse movement is perfect and the controller has already left clicks (U) and right clicks (Y) built in. Sweet! Now if only the controller's touchpad was a bit nicer.

:-P Always glad to help a fellow nerd spend money. A wireless mouse (Did you go bluetooth?) is much better then my really long USB Cable. Let me know what mouse you got and how well it works for you.

Also, thank you for telling me about the (U) and (Y) Buttons, did that work on other builds, or just this newest one?

JJS

Thanks for testing the build! Sounds very promising. Implementing button combinations (Alt-X, etc.) is a bit difficult, so it won't happen too soon I think.

The build also has some sort of gamepad support in that two buttons are mapped to left click and right click, MENU is mapped to the "select" button and ESC to the "start" button. Wiggling the analog stick around should also move the mouse cursor, but that doesn't work right yet.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

QuestingHero

I didn't even try the controller when I was testing (because I was focused on the mouse). this is VERY Promising , and am very excited about it. Any idea what button "start" would be on the ouya controller? looks I'll have something to play with later.

Will these feature be merged in to the normal build? and would it be a check box in the settings to enable?

JJS

I will push these changes to the repository, so they will be in the normal builds. I guess mouse and joystick support could be always on.

From the looks of it, the OUYA controller does not feature a start or a select button. Strange design decision.
Ask me about AGS on PSP, Android and iOS! Source, Daily builds

cianty

#409
@QuestingHero: Yeah, I did go with bluetooth thanks to you. As I have never used one before I didn't want to spend too much on it. Here's the Amazon link (German):
http://www.amazon.de/gp/product/B005ORZDTC/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1

Regarding Start/Select on the OUYA, in the SNES emulator that I have played a lot with recently Select and Start are mapped on the joystick buttons: You can press on the two joysticks to trigger them.

Here's a description of the controller and its buttons:
https://devs.ouya.tv/developers/docs/controllers

UPDATE: So I got my new mouse and it's great! However, true controller support definately be way more convenient as you wouldn't have to switch devices (you can't fully naviagte the OUYA menus with a mouse only). Also I'm having problems with having a proper surface to place the mouse when sitting on the couch. A proper controller where the joystick(s) caused the mouse to move would be way cooler.

Also, would it be possible to have the d-pad trigger the arrow keys? This would mean auto support for all games that have character movement based on arrow keys (in addition to clicking).
ca. 70% completed

cianty

#410
Ok, I have everything set up and can debug the app directly on the OUYA. Now I wanted to add check e.g. KeyEvent.KEYCODE_DPAD_RIGHT and then pass the respective ARROW_RIGHT key code to the engine. However, I have no idea what value to use here. The idea was to use glue.keyboardEvent() but what value would be right for the arrow keys? I don't quite get where the 0x1000 + 47 mapping for F1 e.g. comes from, either. Do you have any hints for me, JJS?

UPDATE: Nevermind. I have found the keycodes at http://alleg.sourceforge.net/a5docs/refman/keyboard.html. Unfortunately ESC doesn't work though, it is recognized as F1 in the engine. I'll keep looking...
ca. 70% completed

DazJ

Do we have an update yet on being able to convert our games into APKs ourself? :)

cianty

I think the question is what "ourself" means here.

If it means that you don't want to install Eclipse/IntelliJ, setup the development environment, create a key to sign your APK - then I don't think there is any way you can get a "yes" here.

I see AGS and the various ports like those cross-platform tools/libraries for web apps such as Cordova/PhoneGap: You can create your entire game in AGS like you would create a web app using web standards (JS, CSS, HTML), and when you want to create "native" applications using this same core then you need the respective development environment to compile for the target OS. There is no way you can ever hope to just dump your AGS game into a pre-existing Android/iOS shell and end up with a mobile app.

The entire point of the Android keys e.g. is to allow backtracking of the APK file to the creator.

What is very well feasible however is to provide the community with an environment that can be easily set-up so that any AGS creator can compile their own APK version of their AGS game. JJS had done tons of work in that direction and it is really not too difficult (even with limited programming knowledge) to fork the GitHub repository, download and install Eclipse with Android SDK and NDK and compile the whole thing. Still there are two necessary things to do first: 1) A single-game-only launcher would be needed instead of the Emulator type of thing which JJS has done and 2) a few more bugs and problems with engine as a whole would need to be solved before giving the entire port a "go" for production. I think because of the latter JJS would be very hesitant to advocate using the port for proper releases yet.

The single-game-launcher is not too difficult. I will probably try myself at that, but currently I am working on a keyboard control that works both with keyboard and the OUYA controller.

If you have a single game that you want to support (and if it doesn't go crazy with "unconventional" stuff like large resolutions e.g.) that I can see it very doable to test and finish off the port for Android AGS games. I wouldn't be surprised to see Wadjet do so in short time (although Blackwell on iOS would probably be way more profitable than tackling Android now).

I wonder what JJS thinks of all this...  :smiley:
ca. 70% completed

DazJ

Thanks. We've brought this up a few times and we've been told that it's being worked on, that's why I just asked for an update.

Shane 'ProgZmax' Stevens

You are rocking these builds, JJS.  I've got to load one of my games in on the latest version and see how it works now.

Joseph DiPerla

Quote from: DazJ on Tue 30/07/2013 18:23:09
Thanks. We've brought this up a few times and we've been told that it's being worked on, that's why I just asked for an update.

Tbe problem with building your APK is that the Android port needs to be re-done a little. And I mean that the interface needs to be reworked to allow that a little. Right now it pulls up a list of games. There would need to be a specialized version of the port that can read the directory where the games files will be stored. Moving on to that issue though... Google only allows up to 50mb for the main file. While several games are under that, there are many that are not. You would need to provide expansion files, which you can have up to 2 expansion files of 2 gb each. While thats nice, it requires a heck of a lot of setup/coding. Obb files in theory are not difficult to create and to code into an app. However, for me anyway, there isn't a lot of documentation that makes using obb files easy. Just so I can explain a little bit about how the OBB expansion files work:

1)For the main APK, you need to sign the file.
2)You need to program into the app to check to see if expansion files exist and if they do:
2b) AGS will need to extract the files into the OBB directory (Which should be done automatically)
2c) AGS would either need to move those extracted files to wherever AGS will load the game from or point the game directory to the OBB directory.
3) You have to get some salt/hash security for the expansion files. So to do that, you would have to:
3b) Upload the android apk and the Expansion files to the google market server and not publish it.
3c) Take down the Salt/Hash code and download location/name.
4) Now, you would have to put some code that would allow access to the OBB file from within AGS. I think this is all done to avoid abusing the system. Whatever.
5) After that you would think you are all set... However, while OBB files should download automatically when you are installing the apps, it doesn't always. Sooooo... You would have to program within AGS to check that the obb files downloaded completely and fully. If they did not, then AGS would have to download it itself. Enter the salt/hash/download name crap.

Now, to integrate this into AGS itself is another issue too. The AGS Editor would have settings and such to take care of that (such as package name, author, etc...). AGS would also have to create the OBB Files itself as well as all they really are are zip files within the obb extension. Thats not the hard part. The hard part is making sure that the developer has the Java SDK and the Android SDK installed properly and with the environment properties set up correctly. The reason for that is so that AGS can package the game files properly into the APK and also so that it can automatically sign the APK for you. That is possible, but its a little extra work I would imagine for whoever is coding the editor. But its doable. Eclipse does it and so does Basic4Android. However, the steps for getting the HASH/Salt/Name from the google server will still be up to the game developer and that can prove to be confusing for a few people.

So it may seem like a simple Shell interface would be needed, but its a lot more complicated than that. While I develop Android Apps, I use Basic4Android and it does not currently support OBB Extensions. If it did, I would be all over making a 3rd party set up system for the APK's. If you all need it urgently, go ahead and post on the Basic4Android forums and request it to be added. Right now the developer does not see a need for it, so maybe if enough ask for it, it will be implemented. I would do this in Java, but I know very very little Java. If someone would want to take a whack at trying to implement this system, here are a few good places to start:

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CDAQFjAA&url=http%3A%2F%2Fdeveloper.android.com%2Fgoogle%2Fplay%2Fexpansion-files.html&ei=DA39UcP3FpW44AOIu4CgCA&usg=AFQjCNGEPm1MCiQTv-aEKoUJeamBR4eHwQ&sig2=_7uMjtYp_lCPxPTkG7uUcA&bvm=bv.50165853,d.dmg

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&cad=rja&ved=0CDcQFjAB&url=http%3A%2F%2Fankitthakkar90.blogspot.com%2F2013%2F01%2Fapk-expansion-files-in-android-with.html&ei=DA39UcP3FpW44AOIu4CgCA&usg=AFQjCNFNm1VserLL-cIzaL7zRcPv7k3ZVg&sig2=E2JdB-it5adb71NmvLB8ZA&bvm=bv.50165853,d.dmg

http://labs.exoa.fr/tutorial-unity-4-apk-splitting-google-play-obb/


http://stackoverflow.com/questions/11715855/steps-to-create-apk-expansion-file

This was my suggestion thread on Basic4Android if someone wants to pipe in and add to the suggestions:
http://www.basic4ppc.com/android/forum/threads/wishlist-lib-obb-and-expansion-pack-downloads.29827/

Hope this info helps.
Joseph DiPerla--- http://www.adventurestockpile.com
Play my Star Wars MMORPG: http://sw-bfs.com
See my Fiverr page for translation and other services: https://www.fiverr.com/josephdiperla
Google Plus Adventure Community: https://plus.google.com/communities/116504865864458899575

JanetC

I was just looking at the process for porting our games to Android and wow, I found out pretty much what you say, Joseph, only I only got half way there! It looks pretty near impossible to do commercial games on Android :(

I was thinking it'd be as simple as the iOS build (which was basically changing some file names here and there) but it really is not.

DazJ

So there idea of official Android releases of our products isn't going to possible?

I'm guessing I'd have to hire someone to create the APK for me then.

Icey

JJS quick question, would it be possible for some to come to you with their game, then you could take that game and the AGS apk and sorta merge it into one APK. the APK from the way I'm thinking of it would be like a zip folder or a burnable CD where the files are stuck inside that APK. Now the way it'd work is that you would change the AGS app to automatically open up that game instead of given the option to choose. Sorry if you find what I said confusing, I'm just really sleepy and I can't process a simpler way of asking my question.

DazJ

Did you ever manage to find a work around for the stuttering OGV video playback issue? I've tried it on multiple devices and even encoded the video in different resolutions but the issue is still the same unfortunately.

SMF spam blocked by CleanTalk