Skip to content

plaidpants/ANKH-VR

Repository files navigation

ANKH VR

This project runs the original Ultima 4 in VR using the Unity3D game engine. Currently it will run on the Windows PC with an Oculus Rift or Oculus Quest using a link connection or natively on the oculus quest, other systems may be supported in the future. It is functionally complete but there are bugs and minor stuff and improvements to make but I would consider it alpha on the oculus quest and Beta on the PC at this point. It also supports Text to Speech (TTS) using Wit.AI, however you must be connected to a nework for this to work.

The oculus quest version does not rely on patching the original EXE into a modern shared library like the PC version and instead references all internal text and data from the original EXE's. The Android OS current does not allow dynamic linking with non-NDK native libraries https://developer.android.com/about/versions/nougat/android-7.0-changes#ndk

Instructions for PC or Oculus Quest:

Aquire or purchase a free copy of Ultima 4 from gog.com or other source.

https://www.gog.com/en/game/ultima_4

Install the game on a Windows PC in a folder.

e.g. [GOGLibrary]\Ultima 4 - Quest of the Avatar

Download, rename and place in the ultima 4 install folder the original mockingboard music or other suitable music in MP3 or OGG format. FYI, android/Quest is case sensitive.

http://www.applevault.com/ultima/

CASTLES.MP3
COMBAT.MP3
DUNGEON.MP3
FANFARE.MP3
RULEBRIT.MP3
SHOPPING.MP3
SHRINES.MP3
TOWNS.MP3
WANDERER.MP3

or

https://bitbucket.org/mcmagi/ultima-exodus/downloads/u4-voyd-music-12.zip

Move any game save files you would like to use to the root of the ultima 4 install directory.

DNGMAP.SAV
MONSTERS.SAV
OUTMONST.SAV
PARTY.SAV

To run on your PC, download and extract the AVATAR.bps & TITLE.bps patch file for your system from the link below and copy them to the ultima 4 install directory, you do not need to do this if planning to install on an Oculus Quest.

https://github.com/plaidpants/u4-decompiled/releases

Copy the contents of the entire ultima 4 install folder to the Unity Persistant Storage area for the ANKH-VR game on your system and then run ANKH-VR, FYI Android/Quest is case sensitive.

Windows PC ANKH-VR Unity Persistant Storage area location

%APPDATA%\..\LocalLow\SwivelChairGames\ANKH-VR\u4

%APPDATA%\..\LocalLow\SwivelChairGames\ANKH-VR\u4\AVATAR.EXE <- you should have this file at this directory location along with all the other files from the Utima 4 Install directory

Oculus Quest Android ANKH-VR Unity Persistant Storage area location, use SideQuest or other means to copy these files to this location. NOTE: Sidequest sometimes fails to copy all the files when you copy a bunch of them so double check all the files transferred before continuing.

snap2

/sdcard/Android/data/com.SwivelChairGames.ANKHVR/files/u4

/sdcard/Android/data/com.SwivelChairGames.ANKHVR/files/u4/AVATAR.EXE <- you should have this file at this directory location along with all the other files from the Utima 4 Install directory

Extra step is required on the Oculus Quest, if you copy any save game files, the .SAV files, you will need to make them write-able as by default when you upload them to the Oculus Quest they are only readable by the game not write-able, to fix this you need to execute this custom command from SideQuest or from adb directly to change the permission on the .SAV files to allow reading and writing. If you don't copy these files and you create a new game the files will be created write-able by default.

snap

adb shell chmod 666 /sdcard/Android/data/com.SwivelChairGames.ANKHVR/files/u4/*.SAV

snap3

The Quest version now supports dynamically changing the tile set while playing the game. Press the primary button on your controller to switch between the different tile sets. It supports the CGA, EGA, Apple2 and a custom PNG file. You need to copy the following files to your Quest for this to function, remember filenames are case sensitive on the Quest.

SHAPES.CGA - for CGA graphics - already included in the PC DOS version
SHAPES.EGA - for EGA graphics - already included in the PC DOS version
SHP0.B and SHP1.B - for Apple2 graphics - these must be extracted from the original Apple 2 disks using ciderpress - http://a2ciderpress.com/ and https://archive.org/details/UltimaIV4amCrack
SHAPES.PNG - for custom graphics - https://ultima4.ultimacodex.com/alternate-ultima-4-tileset/

You can disable the text to speech (TTS) by clicking the volume command in the main menu, it cycles through different combinations of music, sound and speech.

Note: this port of Ultima 4 does not support any modifications or patches to the AVATAR.EXE or TITLE.EXE that move any of the data around in these files so many of the randomizer or other patchers will cause trouble and make it not work. It does support patches to the other files (.TLK, .DNG, etc.) so any fixes or modifications to those files would probabaly be supported. I will try and incorperate some of the fixes from other Ultima 4 projects in the future.

This project does not contain any copyrighted game assets or code or data or text or graphics or fonts or any other intellectual property related to Ultima 4 it relies completely on the files from the original game. This project is not licensed by Origin Systems or Electronic Arts.

OculusScreenshot1656893311 OculusScreenshot1656893278 OculusScreenshot1656894520 OculusScreenshot1656889680 OculusScreenshot1657072821 OculusScreenshot1656893632 OculusScreenshot1657072842 OculusScreenshot1656893808 OculusScreenshot1656893966 OculusScreenshot1656894019 OculusScreenshot1657072748 OculusScreenshot1656894104 OculusScreenshot1656894287 OculusScreenshot1656894238 OculusScreenshot1649382760 OculusScreenshot1649382903 OculusScreenshot1650589506

This project make use of the following:
"Effects Pro: Simple Image Effects" from the Unity Asset Store for the magic inverse screen effect, MIT license.
https://assetstore.unity.com/packages/vfx/shaders/fullscreen-camera-effects/effects-pro-simple-image-effects-191099
Combine textures and meshes for tile map mesh and texture generation, MIT license.
https://forum.unity.com/threads/combine-textures-and-meshes-reduce-draw-calls.117155/
ScreenShakeVR for the tremor effect, License: You can freely use/modify the code.
from here https://www.zulubo.com/gamedev/2019/1/5/vr-screen-shake-the-art-of-not-throwing-up
Zulubo Productions zach.tsiakalis.brown@gmail.com
Wireframe Shader for the highlighted box around the party member in combat, License information http://www.shaderslab.com/index.html free to use without any credits.
http://www.shaderslab.com/demo-94---wireframe-without-diagonal.html
Unlit-AlphaTest shader modified for lighting effect in the dungeon, MIT license
Unity built-in shader source
https://unity3d.com/get-unity/download/archive
Native dll invocation helper by Francis R. Griffiths-Keam to dynamicaly load the patched DLL at startup, license: free to use this code as you please.
http://runningdimensions.com/blog/?p=5
BSP file format used to patch AVATAR.EXE and TITLE.EXE to AVATAR.DLL and TITLE.DLL at startup
https://www.romhacking.net/documents/746/
https://raw.githubusercontent.com/TheAnsarya/bps-patch/master/bps-patch/Decoder.cs (was completely rewritten from scratch for mono for unity)
Flips, free file patching tool, used to create AVATAR.BPS and TITLE.BPS from the modified u4-decompiled binaries and the original AVATAR.EXE and TITLE.EXE
https://github.com/Alcaro/Flips
https://www.smwcentral.net/?p=section&a=details&id=11474
lzw algorithm and file format used by ultima 4
https://ultima4.ultimacodex.com/ultima-4-encodedecode/ (was completely rewritten from scratch in mono for unity)
u4-decompiled, used to create a modified binary DLL instead of the original ultima 4 EXE so we can have unity link and run the original game engine, this project also uses a patch file system to create the DLL from the original EXE at startup so no original intellectual property from utlima 4 must be included in the release. there is quite a bit of magic going on under the hood to be able to make this work. This appears to not be possible with Android so I will need to do it a different way for the Oculsu Quest.
https://github.com/plaidpants/u4-decompiled/
https://github.com/ergonomy-joe/u4-decompiled/
ScatterMyStars for the stars and sky, MIT License
https://github.com/ReCogMission/FirstTutorials