Exult on iOS!

Android ports of Exult have existed for a while now, but Lanica Dragon recently took on the task of porting the cross-platform Ultima 7 engine to that other mobile ecosystem: Apple’s iOS.

I’m thinking of working on the iOS port of Exult a bit this weekend. I think it might be SotA (Shroud of the Avatar) or possible the release of Ultima Forever (which I particularly found that I do not like due to free to play) causing me to me inspired. There’s a lot of implementation questions that I had before when I started working on this. So this is a starting point.

Of course, such an undertaking presents significant challenges, and raises a number of questions:

1. What time of user interface enhancements will actually make an iPhone version useful?
2. What time of user interface enhancements (beyond those above) will actually make an iPad version useful?
3. If the goal is to get this into the app store, then we have to allow the users to load in the content… There’s a few different ways to go about this, none of which I like.
3.a. User uploads it somewhere and points the app to a link or something
3.b. User e-mails theirself and we get it from there somehow
3.c. Exult app could set up some kind of Samba (Windows file share), or basic FTP server to receive files. User would have to be connected to wi-fi to get it in
4. Related to #3. Do we think it would be possible to make the content an in-app purpose, by working with EA / goggames.com? I think this would be the best option, which is still a headache, but it does give us “more of a blessing” to do this as well.

One issue in particular is that Exult is licensed under GPL, which has always been a bit of a troublesome issue for the iOS App Store. Additionally, Apple tends to very quickly remove those apps from the App Store that permit users to sideload executable binaries of any sort; the ill-fated attempts to bring DOSBox to the App Store stand as keen examples of this, and the one notable example of a DOSBox implementation that can still be found on the App Store takes extraordinary measures to make sideloading content as difficult as possible.

Now, the GPL issue is what it is. As to adding content to the game, it might make the most sense to work with EA to distribute the app, and just bundle the game content into it directly rather than set up some sort of in-app distribution channel. This would likely require encrypting the content somehow, so that it can’t be easily modified by end users via programs like iFunBox.

At any rate, Lanica managed to get Exult running in Xcode’s iOS simulator:

Here are the steps to get it going on in the simulator…

Make sure you have done these things first: Install XCode (with iOS support), Install command line tools from XCode (Preferences->Downloads), and Install libsdl-devel using macports ( sudo port install libsdl-devel )

# Get latest code
svn co https://svn.code.sf.net/p/exult/code/exult/trunk exult-test
cd exult-test

# Get libs required for simulator and extract
# URL for libs: https://www.box.com/shared/86qspv7c3bout465oyly
tar -xzvf iphone-simulator-libs.tar.gz -C ~

# Configure
./autogen.sh
./configure --with-iphone-sdk=iPhoneSimulator6.0 --with-sdl-prefix="${HOME}/iphone-simulator-libs/SDL" OGG_LIBS="-L${HOME}/iphone-simulator-libs/vorbis/lib -lvorbis -lm -lvorbisfile -logg" OGG_CFLAGS="-I${HOME}/iphone-simulator-libs/vorbis/include" CPPFLAGS="-I${HOME}/iphone-simulator-libs/vorbis/include"
make
make iosbundle

# Get the Exult ios config and put it in place
# URL for exult-ios.cfg: https://www.box.com/shared/9l7vdzqeacpe8bco8gty
cp -a exult-ios.cfg Exult.app/exult.cfg

# Put game data in place
mkdir Exult.app/game
# NOTE: ~/.exult/blackgate/ should be a place where you have the BlackGate original content files
rsync -auv ~/.exult/blackgate/ Exult.app/game/forgeofvirtue/
# NOTE: ~/.exult/serpentisle/ should be a place where you have the Serpent Isle original content files
rsync -auv ~/.exult/serpentisle/ Exult.app/game/silverseed/

# Put the complete game bundle into the simulator
TMPUUID=$(uuidgen)
mkdir ~/Library/Application\ Support/iPhone\ Simulator/6.0/Applications/${TMPUUID}
mkdir ~/Library/Application\ Support/iPhone\ Simulator/6.0/Applications/${TMPUUID}/Documents
mkdir ~/Library/Application\ Support/iPhone\ Simulator/6.0/Applications/${TMPUUID}/Library
mkdir ~/Library/Application\ Support/iPhone\ Simulator/6.0/Applications/${TMPUUID}/tmp
rsync -auv Exult.app/ ~/Library/Application\ Support/iPhone\ Simulator/6.0/Applications/${TMPUUID}/Exult.app/

# Launch it!
Go to XCode...go to the menu XCode->Open Developer Tool->iOS Simulator
Launch Exult

Until we get #3 and #4 resolved, that means Exult iOS will be for those that have jailbroken devices or are developers.

Testflight could also be a distribution channel, albeit one that’s a bit difficult to manage and would result in the imposition of app installations that have expiration dates.

But I digress. Soon after getting the app working in the simulator, Lanica managed to get it to compile for iOS proper:

It now compiles ALL of the way. Here are the instructions so far. Also…I updated the hardware libs…I also updated the link in the post above just in case…though those steps are little off on the configure line.

# Instructions below are for getting to run on the physical hardware!

# Get latest code
svn co https://svn.code.sf.net/p/exult/code/exult/trunk exult-test
cd exult-test

# Get libs required for hardware (SDL + vorbis) and extract
# URL for libs: https://www.box.com/shared/tnzfscos85qspgiv3soy
tar -xzvf iphone-hardware-libs.tar.gz -C ~

# Run autogen
./autogen.sh

# Build tools required for building (expack, usecode stuff, etc)
./configure
cd files ; make ; cd ..
cd conf ; make ; cd ..
cd tools ; make ; cd ..
cd data ; make ; cd ..
cd gamemgr ; make ; cd ..
cd usecode ; make ; cd ..

# Clean-up pre-reqs from building tools
cd files ; make clean ; cd ..
cd conf ; make clean ; cd ..
cd gamemgr ; make clean ; cd ..

# Configure for build
./configure --with-iphone-sdk=iPhoneOS6.0 --with-sdl-prefix="${HOME}/iphone-hardware-libs/SDL" OGG_LIBS="-L${HOME}/iphone-hardware-libs/vorbis/lib -lvorbis -lm -logg" OGG_CFLAGS="-I${HOME}/iphone-hardware-libs/vorbis/include" CPPFLAGS="-I${HOME}/iphone-hardware-libs/vorbis/include" --host=arm-apple-darwin11 --disable-tools --disable-data

# Build
make
make iosbundle

# Fix-up the Info.plist file in the bundle (refers to Simulator instead of OS ... also needs to be based upon options the user provides on the configure line)
# NOTE: your.cert.exult below to match whatever is valid for your provisioning profile
cat Info-ios.plist | sed "s/Simulator/OS/g;s/simulator/os/g" > Exult.app/Info.plist | sed "s/net.sf.exult/com.ayeapp.exult/g" > Exult.app/Info.plist

# Get the Exult ios config and put it in place
# URL for exult-ios.cfg: https://www.box.com/shared/9l7vdzqeacpe8bco8gty
cp -a exult-ios.cfg Exult.app/exult.cfg

# Put game data in place
mkdir Exult.app/game
# NOTE: ~/.exult/blackgate/ should be a place where you have the BlackGate original content files
rsync -auv ~/.exult/blackgate/ Exult.app/game/forgeofvirtue/
# NOTE: ~/.exult/serpentisle/ should be a place where you have the Serpent Isle original content files
rsync -auv ~/.exult/serpentisle/ Exult.app/game/silverseed/

# Sign the app -- replace "Your Name" below with whatever you have for your cert
codesign -f -s "iPhone Developer: Your Name" Exult.app

# Put it on the device
Connect your device to your mac
Open Xcode
Open Organizer (via menu Window->Organizer)
Drag the Exult.app file from finder to your device in the Organizer
Status seems to show up only if you have a project in the background. If you receive no error, you should be good...go launch it on your device.

# Launch it!
Just touch it!

Yes, lots of tweaking needed. I’m working on making some progress on the SDL2.0 arena…then I can circle back to this. However, anyone can work on the iphone portion while I do that, since we’re going the route of the slow incremental ifdef SDL2.0 change!

And indeed, as Dominus confirms, it works:

Portrait mode, even!

Portrait mode, even!

For now, Lanica has shifted focus to getting Exult working with SDL 2.0. And it should be noted that the app is, at this stage, really just a proof of concept. It will need a lot more work before it is ready for any sort of distribution to end users who aren’t entirely comfortable with Xcode and application compilation.

(Image credit: Dominus)