Page 1 of 4
Porting to Android via Java
Posted: Wed Jul 07, 2010 4:42 pm
by Gianni Leuani
[EDIT by Dominus:
When you read on in this thread, Dr. Code is in progress of porting Exult to Android via Java]
I'm interested in trying to make a working version of Exult to run on Android devices. But I found that in order to do this, a working model of the code has to be developed in Java, which could then be adapted to run on Android by switching out the platform specific graphics-handling.
The "working-model" should only be the game logic that parses the U7 game files, and handles running the game itself while making calls to the graphics and sound code.
Is there any additional code or anyone with notes out there that could help me with parsing the game-data files? If I had something that worked like a JUnit test that can verify if a game data file is valid or not, that'd be really helpful.
Re: Porting to Android via Java
Posted: Wed Jul 07, 2010 8:10 pm
by Dominus
I'm not sure you really need a javabased code for Android anymore. At least according to
http://arstechnica.com/open-source/news ... ev-kit.ars
This port to of Scummvm to Android could maybe shed more light on this:
http://forums.scummvm.org/viewtopic.php ... ht=android
Re: Porting to Android via Java
Posted: Thu Jul 08, 2010 1:21 pm
by Gianni Leuani
The arstechnica article is mentioning that the C++ toolkit is using JNI to hook into the java code. And if you've ever delt with JNI, you'd eventually realize it gets harder to maintain in the long run, especially when newer processors come out.
So, its best to not depend entirely upon the C++ toolkit just because Exult was developed in C. I'm just trying to plan ahead here instead of just banging out code for codes sake.
And the SCUMMVM, that's an entirely different animal altogether.
Re: Porting to Android via Java
Posted: Thu Jul 08, 2010 1:24 pm
by Dominus
I mentioned Scummvm because we share at least the audio code.
Happy codeing...
Re: Porting to Android via Java
Posted: Mon Aug 02, 2010 3:48 pm
by Ed
this book seems to cover the gist of the idea, but i have no idea how applicable it is to this project:
http://books.google.com/books?id=-1eQ71 ... CBcQ6AEwAQ
(just mentioning it because it would be terrific if it did happen)
Re: Porting to Android via Java
Posted: Wed Aug 25, 2010 5:34 pm
by 486DX2/66 Dragon
No need to have a Java port.
You can use JNI wrappers for C++ code.
Also, there is libSDL for android.
It will be a messy thing, but theoretically it should be doable.
Re: Porting to Android via Java
Posted: Wed Sep 01, 2010 5:50 pm
by WtF Dragon
If someone manages to get started on this and/or get it working, please let me know at Ultima Aiera (
http://www.ultimaaiera.com). I've been corresponding with Bioware Mythic, and they're getting pretty serious about seeing the Ultima games ported to mobile platforms...a working, reasonably non-buggy port of U7 to Android would probably be of interest to them, possibly even to the level of them giving it official sanction.
And no, I am not (to the best of my knowledge) kidding or being a jackarse.
Re: Porting to Android via Java
Posted: Wed Sep 01, 2010 6:30 pm
by Dominus
AsI wrote on your site, they should get someone to port Exult to Android and iOS. An experienced programmer should be able to do it. Basically Exult need sto be ported to SDL 1.3 and then you can go off
(as has been done for ScummVM or Dosbox...)
Re: Porting to Android via Java
Posted: Thu Sep 02, 2010 2:32 pm
by TDI
If BioWare is hiring to create Java ports of Ultima games, COUNT ME IN!!!
Seriously, I'll send my resume right away.
Re: Porting to Android via Java
Posted: Thu Sep 02, 2010 7:06 pm
by WtF Dragon
@TDI
A couple of quick points.
1) It's Bioware Mythic (a.k.a. Bioware Fairfax), not Bioware (a.k.a. Bioware Edmonton) that's pushing this. That's a small distinction, as there is a lot of cross-communication between studios. But at least as far as technical distinctions go, Mythic is a separate studio from the one that pumped out Mass Effect, Dragon Age, and all the rest.
2) I don't know if they are hiring at this exact point in time, but their mid-to-long-term goal is to see the Ultima games ported to other platforms, especially mobile platforms. Paul Barnett, their Creative Director, is really stoked about iOS (iPhone/iPod Touch/iPad) ports, especially, though I'd imagine an Android port would also catch his attention.
At present, they don't have the means to develop such ports in-house; their time is given over to other projects of more immediate importance. However, I have spoken with Mr. Barnett personally, and he's told me flat-out that if someone comes up with a solid, reasonably stable port of e.g. U4 (or U7; I can't imagine he'd turn it down), he'd do damn near everything to make sure that it got published EA's mobile storefront(s?) (the App Store, and I'd assume the Android Store if they have one for that ecosystem).
If you've got more questions, drop 'em here and I can forward them to Mr. Barnett.
Re: Porting to Android via Java
Posted: Thu Sep 16, 2010 12:47 pm
by WtF Dragon
Re: Porting to Android via Java
Posted: Mon Sep 20, 2010 10:58 am
by Ed
guysguysguys (and girls sorry i get excited)
sdl has been ported over, no java required. they've already pushed ports of Ur-Quan Masters and OpenTyrian to the market.
http://www.anddev.org/sdl_port_for_andr ... t9218.html
maybe just what the doctor ordered
Re: Porting to Android via Java
Posted: Mon Sep 20, 2010 4:10 pm
by monotremata
Damn of course its only Android 1.6 or above..
I bought a stupid AT&T Backflip back in March and we're apparently Motorola's red-headed step child and are still on 1.5..
They say we're getting 2.1 and they're testing it but funny how for all of the non-US models of the phone they've cancelled it and decided they're staying at 1.5 for the best 'experience'...
Its the OpenGL they're having trouble with lately so Im guessing my phone wouldn't be up to playing Exult nicely anyways..
Time to look out for a new Samsung on Ebay heh..
Re: Porting to Android via Java
Posted: Fri Sep 24, 2010 6:43 pm
by monotremata
Ok somebody do this now haha!
The Backflip just got a custom 2.1 ROM last night based off a Cliq upgrade..
We dont have 3d acceleration yet but I can test whenever someone gets a build done hehe!!
Re: Porting to Android via Java
Posted: Sun Oct 03, 2010 4:27 am
by devon8
It's not exult, but ultima7 works pretty well on my ipad via dospad (dosbox port). Should also work on iphone4 and I believe there's an android port of dosbox out there, although there's probably not anything as fast as the ipad running android yet.
Re: Porting to Android via Java
Posted: Tue Oct 12, 2010 8:38 pm
by drcode
Has anyone used ScratchBox to port to Android? It sounds promising.
Re: Porting to Android via Java
Posted: Tue Oct 19, 2010 3:39 pm
by drcode
The ArsTechnica article says they don't intend native code to be used for large applications, but for CPU-intensive operation. But it looks like ScummVM works.
Still, Exult is a pretty large program that's not very efficient with memory. I wonder what it would take to do a Java version, and whether the performance would be okay.
I've just started playing around with the 'Hello Android' examples in Eclipse with the emulated phone, and maybe will work up to doing a U7 shape browser as an exercise.
Re: Porting to Android via Java
Posted: Mon Nov 01, 2010 7:16 pm
by drcode
For fun (strange idea of 'fun'), I've started converting Exult code to Java to run on Android. My initial goal is just to display one image from shapes.vga, but that involves a LOT of code. I'm pretty much just translating by hand from C++ classes to Java. Eclipse makes this relatively easy in the way it does syntax-checking as you write.
So far, I've written about 1200 lines of code and all I have to show is that I can read in the Avatar's shape.
But to display it, I need a palette, and that leads to bringing in most of the 'U7 file' code. Maybe tonight...
One thing that worries me about all this is that it doesn't look like an Android supports 8-bit palette graphics, which means we'll be doing a lot of converting from our 8-bit frame to its RGBA canvas. I don't know if an Android has enough CPU power for this.
Re: Porting to Android via Java
Posted: Fri Nov 05, 2010 5:02 pm
by MB
I really hope this works out! The only portable Ultima 7 fix I have is via that old psp port (and it is simply awful).
I run scumm vm on my Samsung Galaxy with no issues, so I'm hoping that these new phones have the power to run the classic greats.
Btw, thank you all for the hard work so far. Been following this project forever and gotten a lot of fun from it.
Re: Porting to Android via Java
Posted: Sun Nov 07, 2010 9:00 pm
by Torgus dragon
Can you tell us more about scumm on the galaxy s? The galaxy s should be able to run u7 easily.
Re: Porting to Android via Java
Posted: Mon Nov 08, 2010 11:59 am
by Dominus
@jeff, can yougive us some screenshots or photos of exult running on the android so far? Do you actually have an android or are you codeing halfblind through an android emulator? Your commits sound interesting
@torgus, I'm sure the scummvm forums would be much more suited to find information on this.
Re: Porting to Android via Java
Posted: Mon Nov 08, 2010 10:52 pm
by drcode
I'll get a screenshot tonight, but don't expect a lot. What I'm doing is converting our c++ code to Java, skipping some things that I'll get to later and simplifying when possible. All that code (2000+ lines), and all I've got so far is the ability to render the flat terrains or paint a shape. No objects are created yet.
I only have the emulator to test with.
What worries me is performance. It doesn't seem like there's any builtin support for 8-bit graphics. So I'm painting into our own byte-array. Then on each 'blit', that gets transformed through the palette into a Color array, which then gets stored in a Bitmap (which looks like another big copy); and finally, that gets painted and stretched to fill the canvas/screen. That last operation is in the android library, so I'm hoping that maybe it's hardware supported. Seems like a lot of code being executed in Java for each screen refresh...
Maybe tonight I'll try to get the scene to scroll one tile on each refresh to see how many frames/second it can get.
Maybe it would make more sense to port the C++ code, but it doesn't sound as educational.
Also, I think debugging or getting support would be a real problem.
Re: Porting to Android via Java
Posted: Tue Nov 09, 2010 3:10 am
by drcode
Re: Porting to Android via Java
Posted: Tue Nov 09, 2010 4:43 am
by drcode
I added scrolling around with the arrow keys, and it's pretty slow. If you want to try it, here's where it looks for files:
String base = "/sdcard/Games/exult/blackgate"; // FOR NOW.
addSystemPath("", base + "/PATCH");
addSystemPath("", base + "/STATIC");
addSystemPath("", base + "/GAMEDAT");
Re: Porting to Android via Java
Posted: Tue Nov 09, 2010 10:03 am
by Dominus
Looks very nice. Can't try it since I don't have an android. I'd root more for an iOS port
I'm still surprised that you need to do that much hard work for porting to Android. I was really sure that this would be much easier than porting to Java...
But as long as you are enjoying it...
Re: Porting to Android via Java
Posted: Wed Nov 10, 2010 9:53 pm
by drcode
A bit more progress:
http://www.facebook.com/photo.php?fbid= ... 1523107292
The Avatar is still a fake (just drawing the shape, he doesn't really exist).
Re: Porting to Android via Java
Posted: Mon Nov 15, 2010 6:35 am
by drcode
Re: Porting to Android via Java
Posted: Mon Nov 15, 2010 5:07 pm
by TDI
> I think everyone can view this
I can only see those pictures if I login with a facebook account.
Re: Porting to Android via Java
Posted: Tue Nov 16, 2010 8:57 am
by dag
>> I think everyone can view this
>I can only see those pictures if I login with a facebook account.
Me, too
Re: Porting to Android via Java
Posted: Tue Nov 16, 2010 12:43 pm
by Dominus
Jeff, if you don't mind I can put these pictures either on imageshack or dropbox...
Re: Porting to Android via Java
Posted: Wed Nov 17, 2010 12:26 am
by drcode
Sure, that would be nice.
Re: Porting to Android via Java
Posted: Thu Nov 18, 2010 9:31 am
by Dominus
Re: Porting to Android via Java
Posted: Thu Nov 18, 2010 8:59 pm
by i30817
The worse part of being a managed language are badly designed api's that even with immutable types are paranoid and copy things into new arrays.
Anyway do you have a repository? I enjoy running findbugs on java code bases and fixing trivial @!#$.
Re: Porting to Android via Java
Posted: Thu Nov 18, 2010 9:59 pm
by Dominus
Re: Porting to Android via Java
Posted: Fri Nov 19, 2010 12:14 am
by i30817
Forgot that android doesn't use java bytecode -> findbugs won't work.
Re: Porting to Android via Java
Posted: Fri Nov 19, 2010 12:20 am
by i30817
A quick question though: you're trying to keep class to class compatibility between the codebases? There is a ObjectList class that is rather redundant considering the (rather excellent, except for very specialized uses, or primitive collections) java collections api.
Re: Porting to Android via Java
Posted: Fri Nov 19, 2010 8:07 pm
by drcode
I might look into replacing ObjectList, but it currently has the advantage of not creating new links as objects are moved in and out of it, since the objects themselves have the link pointers.
Re: Porting to Android via Java
Posted: Sat Nov 20, 2010 1:25 am
by drcode
The facebook album now shows that the actual NPC's are being created. The next step, which is probably going to take some time, is to have the Avatar be able to walk around.
What sort of interface should there be for moving the Avatar? I assume Android phones have a touch screen, but is there a common way to indicate dragging with a right-mouse button like we do in U7? Or would the arrow keys work, and then use the touch screen for dragging objects?
(Edit by Dominus: dropbox album updated with this screenshot
http://www.dropbox.com/gallery/7801769/ ... d?h=e27af2)
Re: Porting to Android via Java
Posted: Tue Nov 23, 2010 4:12 am
by i30817
There are two places where you are using iterator in the oldest way possible. You should probably use a for each there. I would give you a diff file, but netbeans is being retarded and only allowing me to diff single files, so it would take more time for you to apply that than do it manually.
Re: Porting to Android via Java
Posted: Tue Nov 23, 2010 7:31 am
by drcode
Thanks. I'll take a look tomorrow. (Anything to speed things up.)
Re: Porting to Android via Java
Posted: Wed Nov 24, 2010 4:10 am
by i30817
This won't speed anything up though. I suppose subversion commit rights are out of the question? I wouldn't actually touch the code, just refactor it around when not completely functional (that, now it appears to be).
Re: Porting to Android via Java
Posted: Wed Nov 24, 2010 4:26 am
by i30817
BTW what's the pathfinding algorithm? It doesn't seem to be anything heavy in code like A* how does it avoid obstacles, and moves actors?
Re: Porting to Android via Java
Posted: Wed Nov 24, 2010 8:19 pm
by drcode
Exult does use A*. I haven't added that to the Java version yet, but I plan to (although maybe that and a few other algorithms should be kept in C++ and use JNI). Generally, I'm trying to convert our C++ code fairly faithfully to Java, cleaning up a few things in the process. It's been a while since I've worked on Exult and this is giving me the chance to become familiar with the code again.
In ExultAndroid, you can walk right through walls now. Maybe I'll call that a feature.
I'm wondering how the emulator speed compares with real devices. Anyone have experience with this?
Re: Porting to Android via Java
Posted: Wed Nov 24, 2010 9:57 pm
by Cobalt
If they can get this game to run on a PSP you can get it to run on anything.
Re: Porting to Android via Java
Posted: Wed Nov 24, 2010 9:58 pm
by TDI
>In ExultAndroid, you can walk right through walls now. Maybe I'll call that a feature.
Leave it in the game and activate it as a hidden feature when the player enters: osspispopd
That would be kinda funny.
By the way, I'm amazed at the speed of your progress on this.
Re: Porting to Android via Java
Posted: Thu Nov 25, 2010 9:08 pm
by drcode
Thanks. What makes it go fast is that I'm mainly translating from C++ to Java, so most things work right away.
Re: Porting to Android via Java
Posted: Fri Nov 26, 2010 12:11 am
by i30817
I know of a few performing A* implementations in java.
http://keithphw.freehostia.com/LineOfSi ... Sight.jnlp
the javagaming forum is in general, a good place to as performance and api questions.
Re: Porting to Android via Java
Posted: Fri Nov 26, 2010 12:13 am
by i30817
Ah.
source (note that clicking this link may not work, you may have to paste the link text into your browser window to actually download the zip file):
http://keithphw.freehostia.com/LineOfSight/src.zip
dependency jar (Java Topology Suite):
http://keithphw.freehostia.com/LineOfSight/jts-1.8.jar
Re: Porting to Android via Java
Posted: Fri Nov 26, 2010 5:57 am
by Malignant Manor
Is the Android specific coding minimal enough that this could easily be made allow for platform independence?
Re: Porting to Android via Java
Posted: Fri Nov 26, 2010 6:53 am
by drcode
There's some Android-specific code for handling events and painting the screen. The rest is pretty standard Java, I think.
Might be nice if someone implemented the Android Java libraries for use on a regular (Linux) PC. I'd imagine the performance would be a lot better, so I wouldn't have to wait 5 minutes for the debugger to get started.