Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS support #7043

Open
1 task done
ribtoks opened this issue Apr 21, 2023 · 26 comments
Open
1 task done

iOS support #7043

ribtoks opened this issue Apr 21, 2023 · 26 comments
Labels
improvement New feature, request or improvement iOS iOS version of the engine
Milestone

Comments

@ribtoks
Copy link

ribtoks commented Apr 21, 2023

Preliminary checks

Describe the problem requiring a solution

I think this game would be perfect on an iPad, but currently there's no way to launch it...

Describe the possible solution

You could provide an .ipa file (like the VCMI project) for side-loading. Ideally it will of course be a paid app on the AppStore (so that you could receive some money)

Additional info

No response

@ribtoks ribtoks added the improvement New feature, request or improvement label Apr 21, 2023
@ihhub
Copy link
Owner

ihhub commented Apr 21, 2023

Hi @ribtoks , as of now we don't have plans to release fheroes2 on iOS due to lack of resources. Android release was necessary due to openness of the platform and amount if potential players. iOS is much more restrictive in this matter and also we have no copyright rights to ask any money for the engine. So free is the only option.

As a conclusion, we are not saying a no but for now we can't focus on it unless someone steps in and helps with porting to iOS.

@ribtoks
Copy link
Author

ribtoks commented Apr 21, 2023

Thank you for your response @ihhub . I hope the situation with iOS will change in the future and I wish best for fheroes2 project!

@dbratcher
Copy link

@ihhub I'm an iOS engineer. I'm new to this project but a long time heroes fan. Just curious, if I wanted to explore adding to iOS support does the project have a general idea on how iOS support would be added? I'm wondering if looking at the Android implementation and straight porting relevant code or investigating however Android reused code would be useful.

@oleg-derevenetz
Copy link
Collaborator

@ihhub

and also we have no copyright rights to ask any money for the engine

Technically, the GPL does not prevent you from asking for money for the engine :)

@dbratcher

Just curious, if I wanted to explore adding to iOS support does the project have a general idea on how iOS support would be added? I'm wondering if looking at the Android implementation and straight porting relevant code or investigating however Android reused code would be useful.

Most of Android code is related to the "companion" toolset app which is used to provide the assets of the original game and manage the save files (since on modern Android versions you can't just read contents of some public directory on SD card or tell a user to copy assets to the app data directory - exactly the same as on iOS by the way). The only our Android class that is directly related to the game engine itself is this one, and it's relatively straightforward.

Here is a checklist, as well as a kind of retrospective of porting this game to Android, many things that are necessary for the game to work on handheld devices with touchscreen (such as emulation of right mouse button) are already implemented. SDL in addition to Android also supports iOS, so technically everything is possible, I believe.

@dbratcher
Copy link

Awesome thank you for all of this, I'll start checking it out.

@ihhub
Copy link
Owner

ihhub commented Apr 25, 2023

Hi @dbratcher , also if you think of an easier way for end-users to install ipa file please feel to suggest.

@oleg-derevenetz
Copy link
Collaborator

also if you think of an easier way for end-users to install ipa file please feel to suggest.

AFAIK there is no way to install an ipa file without jailbreaking.

@dbratcher
Copy link

Yea I'm not aware of another way. I think listing on the Apple App Store for free shouldn't pose too much trouble. It would be easy to have a donate button that would probably pay far more than the fee of having an account.

@ribtoks
Copy link
Author

ribtoks commented Apr 26, 2023

there is no way to install an ipa file without jailbreaking.

@dbratcher @oleg-derevenetz this is not true and it's possible to install - see VCMI instructions. In fact, I have VCMI installed on iPad (using Kodi guide), signed by my developer certificate and it works.

The first hard thing is to build an .ipa file.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented Apr 26, 2023

signed by my developer certificate

So end user needs to have the developer certificate which means that we are no longer actually talking about the "end user" :) People with developer certificate can just build fheroes2 from source using Xcode (and don't use ipa at all), but what is the percentage of such people among the total number of iOS users? And if they did not enroll the App Store Developer program, then their developer certificates will only survive for 7 days.

@ribtoks
Copy link
Author

ribtoks commented Apr 26, 2023

what is the percentage of such people among the total number of iOS users?

This is a valid point. I would just note that a) it will be at least some way to use it on iOS and b) it's good to start somewhere

@ribtoks
Copy link
Author

ribtoks commented Apr 26, 2023

People with developer certificate can just build it from source using Xcode (and don't use ipa at all)

Can I build it today using XCode and install on an iOS device?

@oleg-derevenetz
Copy link
Collaborator

Can I build it today using XCode and install on an iOS device?

No, not today :) At a minimum, some refinement will be required, although, I hope, not much (compared to desktop -> Android), since some changes (related to handheld devices in general) are universal.

@dbratcher
Copy link

Teaser of what I have running so far on iPad 😂image

@dbratcher
Copy link

I'm working to add support here: https://github.com/dbratcher/fheroes2/tree/ios_support

@dbratcher
Copy link

Very very hacky... but working 😁

image

@oleg-derevenetz
Copy link
Collaborator

Very very hacky... but working 😁

I suppose a kind of "launcher" UI will be needed on iOS as well to handle issues with original game assets in some user-friendly way. Also I'm not sure how iOS works with MIDI (macOS has native support for MIDI playback).

@ihhub
Copy link
Owner

ihhub commented May 3, 2023

Hi @dbratcher , once you are ready please create a pull request. I believe we can do a launcher later. Also are you able to build it using GitHub Actions?

@dbratcher
Copy link

dbratcher commented May 4, 2023

@ihhub I'll clean up the code first, I'd be a bit embarrassed to make a PR in its current state 😅 things on my radar:

  • structure code to be more dry
  • improve loading logic to load all relevant assets (only loads one map at the moment)
  • fix introduced warnings
  • properly gate code so it doesn't break other platforms
  • run GitHub actions and fix any issues
  • create a PR with documentation

Long term efforts

  • add support to data is missing screen to import assets from Apple Files and have instructions
  • go through Android platform checks and see if similar changes are needed for iOS
  • go through Android development checklist and see if similar work is needed
  • determine if it's worth putting on the App Store (could we bundle the demo assets with it?)
  • maybe add a donate button for support

@ihhub
Copy link
Owner

ihhub commented May 5, 2023

Hi @dbratcher ,

improve loading logic to load all relevant assets (only loads one map at the moment)

Are you sure about it? Don't you use a demo version of the game?

@dbratcher
Copy link

Yea I'm sure, if you look at my code it's real hacky. I use a good old game version

@ribtoks
Copy link
Author

ribtoks commented Jul 16, 2023

Hey @dbratcher No pressure really, just curious if you had any luck with your proof-of-concept? Do you think what you did is somewhat reproducible so that for example I can try it "on my computer"?

@drewbratcher
Copy link

@ribtoks unfortunately I haven't touched it since that first effort awhile back. If you wanted to try and replicate what I did you could checkout my branch and then look at how I added the required data files in this commit. The data files are ignored by the git repo so they're not checked in and you'll need to get them from a game install. That commit also shows the very hacky code I added to load the data files, I don't know c++ and had a lot of trouble with it. You have to make sure the files are copied over to the app bundle as well I believe.

Let me know if you try anything out and get it working 😁 If not, I do still plan on making this easier to set up and use when I get some more time.

@peterpaulis
Copy link

+1 would love to play this on iPad similar as H3 VCMI

@ihhub ihhub added this to the 1.2.0 milestone Jan 14, 2024
@ihhub ihhub added the iOS iOS version of the engine label Jan 14, 2024
@oldyfoz
Copy link

oldyfoz commented Jan 29, 2024

Being able to play on iOS devices is fantastic

VCMI project forced me to handle how to operate with AltStore to play H3,
and I'm looking forward now to the timeless classic H2 :)

Thank you for your contribution!

@dbratcher
Copy link

hey all, really sorry I haven't been able to spend more time on this. I put what I had in a pull request here. Unfortunately I can't spend much time on it right now, but maybe it can help someone else if they want to clean it up for possible future iOS support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement iOS iOS version of the engine
Projects
None yet
Development

No branches or pull requests

7 participants