Android and WebGL discussion

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
marcospampi
Posts: 3
Joined: Mon Feb 22, 2021 10:09 am

Android and WebGL discussion

Post by marcospampi »

So, recently got mad at having Daggerfall on Android without DosBox,
made a fork here:

Code: Select all

https://github.com/marcospampi/daggerfall-unity/tree/android
I had to configure the project to have android builds, deal with Addressable package and so on, but biggest issues are Paths:
Android builds are stored in APKs, and streamingAssetsPath is just a URL of this form:

Code: Select all

jar:file://app/banana.apk/assets!
And cannot be opened with standard System.IO utilities, this is trivial, made the singleton

Code: Select all

DaggerfallWorkshop.Paths
to deal with, it extracts APKs to storage when a DaggerFall folder is not present, and provides paths, yet to be discussed, if ever this game should be officially ported to Android:
  • Package naming and stuff alike must be discussed, or dictated :roll:
  • A zip library is needed nonethless, had some issues with, as there's no official package for this version of Unity
  • Touch screen is a new thing to deal with, yet no issues with gamepads
WebGL, I didn't tried, but manual of course says no filesystem, no (un)friendly System.IO.FIles or System.IO.Directory, one thing I tried before the singleton for Paths is a virtual filesystem library, which has been very painful how I made it, resembling much the official System.IO* APIs, yet my Software Engineering professor would be proud of his student as how many design patterns I applied; quickly discarded, but was working.
A project-fit virtual filesystem library could be made, and may even be a better solution than the Singleton.
Post Scriptum 'cos I forgot:
Things ain't working:
  • Vulkan build for Android
  • IL2CPP build for Android
Apart from Addressables being jerky, the game just works as usual
Issue to deal with before building:
  • Fix your Addressables:
    Spoiler!
    Open up the editor and on the top menu go to Window->Asset Management->Addressables->Groups
    then do Build->Clean->All and Build->New Build->Default Build Script
I DO NOT PROVIDE ANY APK OF MY BUILDS, DO NOT ASK
BE SMART, BUILD IT BY YOURSELF, DISTRUST ANY UNOFFICIAL BUILD
Last edited by marcospampi on Wed Feb 24, 2021 8:24 am, edited 3 times in total.

User avatar
Interkarma
Posts: 7234
Joined: Sun Mar 22, 2015 1:51 am

Re: Android and WebGL discussion

Post by Interkarma »

This is very cool! Impressive work on this.

For my part, I don't have plans to work on ports for mobile platforms, and this has never been a consideration when building the game. But Daggerfall Unity belongs to everyone in the community, and if others want to fork it and create an Android build, I will watch with interest. :)

Are you using a controller in your video?

User avatar
marcospampi
Posts: 3
Joined: Mon Feb 22, 2021 10:09 am

Re: Android and WebGL discussion

Post by marcospampi »

Interkarma wrote: Mon Feb 22, 2021 11:00 pm This is very cool! Impressive work on this.

For my part, I don't have plans to work on ports for mobile platforms, and this has never been a consideration when building the game.
It's not that impressive, it just works as expected, if you see my commit I just deferred paths to a singleton, easy way nonetheless, a virtual file system will just make magic.
Interkarma wrote: Mon Feb 22, 2021 11:00 pm But Daggerfall Unity belongs to everyone in the community, and if others want to fork it and create an Android build, I will watch with interest. :)
That's what I hope, I'm in unfriendly terms with Unity's editor, thus I'm reluctant to continue.
I just made a commit and everyone can see that I just changed a bunch of lines and added the singleton, and it works.
Interkarma wrote: Mon Feb 22, 2021 11:00 pm Are you using a controller in your video?
Not this time, made in a hurry, but it works, I had to setup it as look axis weren't properly configured, there are too many commands though, a command wheel could help here.
I feared for scrolling UI elements not to work, but they work lol, the game is a bit laggy, but that's due to my device, a scale factor may help here, my device was just processing 2160*1080 pixels per frame, too many.
Though there's only a little issue with first time run, exception are thrown when testing resolution, game has to be closed and reopened.

Reddynz
Posts: 1
Joined: Tue Feb 23, 2021 5:32 pm

Re: Android and WebGL discussion

Post by Reddynz »

Hello. I just made a account here just to discuss about this.
First I wanted to thank you for this amazing work. It works surprisingly well for the most part. I'm really happy to see DFU moving on a phone :D
However, I've been testing it for like 2 hours and found some issues.

First one is that I get the <LocaleText-NotFound> error on several UI texts. At the "Add bonus points" screen and at the Save/load screen. But there are more.
Could this be happening because the .apk compilation had issues or something? Or maybe the build version?
I did not compile the apk I'm using, a friend of mine did. And I'm using the game files you can download at the live builds page.
I will leave some screenshots so you can see.
https://imgur.com/a/DdRsxQc

The second one is the framerate. My device is a Shield TV and it runs this game pretty good with all the settings maxed out, 30fps more or less. However, when I get into large cities, like Daggerfall or Wayrest, the game runs at like 5fps. But, if I lower the settings, I see almost no improvement. It still runs at ~5fps. Even with the lowest settings + retro rendering mode.
But... I've been testing it a little more and now Daggerfall town runs good! Like 30-40fps, with the settings maxed out! But Wayrest town still runs really bad...same settings and all... The only setting I remember changing is "Target Framerate" at settings.ini, but that was before I saw the improvement at Daggerfall town.
Maybe it's that the game is loading something that lags?
EDIT: I traveled from Wayrest back to Daggerfall and now the game runs at low framerate... this is weird. I left the game playing for about 10min at Wayrest to see if its simply because the game is loading the whole town, but no.
If you need it, I can upload my saves so you can test it yourself.


The third one is that when talking to a npc, I can't select any dialog option. The dialog window doesnt cover the whole screen, and I can see the 3D part of the game running at the borders. If I try to select a dialog option, I can see the camera moving at a very low framerate at the borders, which could be the reason the game won't register my clicks.


And the last one is that if I kill a enemy, it will straight disappear, leaving no corpse behind. This happens with bats, rats, and probably every enemy. Haven't tested it out.


Those are the only issues I've encountered. Again, thanks for this amazing port! :) :D

User avatar
marcospampi
Posts: 3
Joined: Mon Feb 22, 2021 10:09 am

Re: Android and WebGL discussion

Post by marcospampi »

Reddynz wrote: Tue Feb 23, 2021 7:51 pm
First one is that I get the <LocaleText-NotFound> error on several UI texts. At the "Add bonus points" screen and at the Save/load screen. But there are more.

This is a buggy feature of Unity, yet easy to deal with, you have to fix Addressables :
Open up the editor and on the top menu go to Window->Asset Management->Addressables->Groups
then do Build->Clean->All and Build->New Build->Default Build Script
Reddynz wrote: Tue Feb 23, 2021 7:51 pmCould this be happening because the .apk compilation had issues or something? Or maybe the build version?
I did not compile the apk I'm using, a friend of mine did. And I'm using the game files you can download at the live builds page.
You should build the game by yourself.
Reddynz wrote: Tue Feb 23, 2021 7:51 pm The second one is the framerate. My device is a Shield TV and it runs this game pretty good with all the settings maxed out, 30fps more or less. However, when I get into large cities, like Daggerfall or Wayrest, the game runs at like 5fps. But, if I lower the settings, I see almost no improvement. It still runs at ~5fps. Even with the lowest settings + retro rendering mode.
That's 'cos it may be rendering in native resolution, say 1080p, and the Shield just cannot handle, as my phone.
I didn't get that much in this issue, I set the game to run on fixed dpi and added the command setdpiscale <value> yesterday, still I die like an idiot on the first dungeon lol so haven't tested outside, but audio works better as I did this.
Reddynz wrote: Tue Feb 23, 2021 7:51 pm EDIT: I traveled from Wayrest back to Daggerfall and now the game runs at low framerate... this is weird. I left the game playing for about 10min at Wayrest to see if its simply because the game is loading the whole town, but no.
If you need it, I can upload my saves so you can test it yourself.
No, that's your device not having enough resources for the game, try lowering your render distance or save and reopen the game.
Reddynz wrote: Tue Feb 23, 2021 7:51 pmThe third one is that when talking to a npc, I can't select any dialog option. The dialog window doesnt cover the whole screen, and I can see the 3D part of the game running at the borders. If I try to select a dialog option, I can see the camera moving at a very low framerate at the borders, which could be the reason the game won't register my clicks.
Fix your Addressables.

User avatar
Azora Husky
Posts: 1
Joined: Sun May 15, 2022 11:48 am

Re: Android and WebGL discussion

Post by Azora Husky »

Hello, I decided to try this out. I built the APK and made sure to fix the Addressables, but once I have installed it and launched it, it gets through the "Made with Unity" Splash Logo, and then nothing, just only a grey screen.

I have tried adjusting settings, checking Logcat (Which Logcat gave me nothing), but I am at a loss.

Healer2022
Posts: 14
Joined: Thu Mar 17, 2022 6:22 pm

Re: Android and WebGL discussion

Post by Healer2022 »

How can I make an apk under Linux?

Why isn't there an official apk? For instance it could be uploaded on f-droid.

What Android version is required?

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Android and WebGL discussion

Post by BadLuckBurt »

Healer2022 wrote: Tue May 24, 2022 12:56 am How can I make an apk under Linux?
Install Unity. https://docs.unity3d.com/2019.3/Documen ... ocess.html
Healer2022 wrote: Tue May 24, 2022 12:56 am Why isn't there an official apk? For instance it could be uploaded on f-droid.
Because there are no Android devs around here as far as I know. Running Daggerfall on mobile isn't really high priority either for most modders.
Healer2022 wrote: Tue May 24, 2022 12:56 am What Android version is required?
No idea. Guess the person who builds the APK will find out.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

Lucianoob
Posts: 1
Joined: Thu Jun 29, 2023 3:06 pm

Can someone provide me a daggerfall unity android build?

Post by Lucianoob »

i saw the post Android and WebGL discussion, It says to do it on our own but I don't know how to do it (I'm not a programmer), I was wondering if there is any kind person who can compile an android build please! There is no tutorial on how to do it and I would really like to play Daggerfall unity on my cell phone like in the video , my computer doesn't work and I'm only working on a tablet with a keyboard and mouse.

Video:
[youtube]https://www.youtube.com/watch?v=QOcwkhgvhG4[/youtube]

Anyway, Thank you kind sir :D .

User avatar
Jay_H
Posts: 4059
Joined: Tue Aug 25, 2015 1:54 am
Contact:

Re: Android and WebGL discussion

Post by Jay_H »

The above request relates to this topic, and I have merged them :)

Post Reply