Skip to content

[4.0] [tvOS] Basic tvOS Support #45830

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

Closed
wants to merge 5 commits into from

Conversation

naithar
Copy link
Contributor

@naithar naithar commented Feb 8, 2021

Same as #45829 for master and basic Metal Support (via MoltenVK)

Added basic tvOS support.
Implements already closed but not implemented proposal: godotengine/godot-proposals#224

Platform code is based on iOS platform code with minor changes (some iOS stuff isn't available on tvOS).
Audio interruption was also removed - AppleTV don't seem post interruption notification correctly or in right order, which results in game freezing after application loses focus.
Keyboard input backed was changed so keyboard input actually works.
Input is handled by controllers. Apple/Siri Remote are also considered controller (micro)

Export code (including plugins) is also based on iOS platform since both of them export into Xcode project.
But export is also simpler:

  • Launch screen is storyboard based (no need for launch images)
  • tvOS project supports empty Apple Team ID
  • Icons, Signatures and certificates are handled by Xcode project

Core code has been modified to address tvOS unsupported features - no fork and execvp.
Rendering code has been modified for tvOS to use same paths/methods as iOS's.

Mono haven't been ported.
GDNative uses same configuration as iOS platform.

@naithar naithar force-pushed the feature/apple-tv-4.0 branch 3 times, most recently from d0b34b3 to 6d722f2 Compare February 9, 2021 08:20
@Chaosus Chaosus added this to the 4.0 milestone Feb 9, 2021
@naithar naithar force-pushed the feature/apple-tv-4.0 branch 3 times, most recently from ee0c6b7 to 3fa409c Compare February 12, 2021 11:43
@naithar naithar force-pushed the feature/apple-tv-4.0 branch 3 times, most recently from b611bfe to c7d8efc Compare February 18, 2021 22:21
@naithar naithar marked this pull request as ready for review February 19, 2021 19:38
@naithar naithar requested review from a team as code owners February 19, 2021 19:38
@naithar naithar force-pushed the feature/apple-tv-4.0 branch from c7d8efc to 6ae7810 Compare February 20, 2021 17:03
@naithar naithar requested a review from a team as a code owner February 20, 2021 17:03
@BastiaanOlij
Copy link
Contributor

Is there an option to change this so the iOS platform can be used or is this a case once again that Apple will flat out reject your bundle if it contains code not applicable to the platform you're deploying on?

It feels very messy to have a complete duplication of the iOS platform just to apply a few minor changes. It will be a nightmare to keep them in sync.

@naithar
Copy link
Contributor Author

naithar commented Feb 24, 2021

Is there an option to change this so the iOS platform can be used or is this a case once again that Apple will flat out reject your bundle if it contains code not applicable to the platform you're deploying on?

It feels very messy to have a complete duplication of the iOS platform just to apply a few minor changes. It will be a nightmare to keep them in sync.

We could probably try hiding platform's tvOS/iOS only methods behind TVOS_ENABLED flag as well as using objc availability API - this would allow to use same godot_view for both platforms. We can probably also use some stuff without changes that's currently are the same between platforms - joypad should be among them. But I'm not sure how well it could be supported/scaled if thing become more separate between this platforms. There are also plugin that can only partially be migrated without changes.
Xcode project also should be separate - there are stuff that don't share as well as works differently. We can probably work it out by using targets, but it would really be a mess to support.
And I'm also not sure how App Store will react to it - fighting bitcode stuff is hard already :)

I do agree that repeating the code might not be the best option, but I'm not sure that using defined and other precompile checks is better for basically different platforms.

Edit:

On the other hand we can place base classes that have almost same functionality somewhere like platforms/uikit/ and just subclass them in case it's needed (touch support/press support).
I guess changes to scons configuration would be required to exclude uikit from platform list as well as linking uikit's sources from ios/tvos configuration.
But I would probably prefer having platform working correctly first and then refactoring/moving all the stuff, just in case, especially since it could affect already working platform.

@naithar naithar force-pushed the feature/apple-tv-4.0 branch from 6ae7810 to c5c4136 Compare March 1, 2021 12:18
@godotengine godotengine deleted a comment from paulocoutinhox Mar 2, 2021
@naithar naithar requested a review from a team as a code owner March 6, 2021 09:08
@naithar naithar force-pushed the feature/apple-tv-4.0 branch from f034d47 to b4966bb Compare April 1, 2021 20:17
@naithar
Copy link
Contributor Author

naithar commented Apr 1, 2021

Coming back to this PR I now think, that keeping single code base might be a better solution after all.
But would it be possible to have two different exporters for iOS and tvOS in this case?

naithar added 2 commits April 1, 2021 23:30
Added delay for 'end' press. This should allow to use Input.is_joy_button_pressed with JOY_START.
Added separate tvOS delay settings in project settings.
Added 'tvOS.overrides_menu_button' value. This allows to enable system's default processing of menu button.
@naithar naithar force-pushed the feature/apple-tv-4.0 branch from b4966bb to fcf2d40 Compare April 1, 2021 20:30
@akien-mga
Copy link
Member

Coming back to this PR I now think, that keeping single code base might be a better solution after all.

If we can keep a single code base that would look much better to me indeed, like we do with Linux/FreeBSD/OpenBSD/NetBSD.

But would it be possible to have two different exporters for iOS and tvOS in this case?

Depending on how similar the export presets would be, this could be hacked in like it's done for JavaScript's three separate templates (regular, threads, gdnative) to have a checkbox or an enum to select tvOS support while using the common preset.

If the presets need to be fully separate, then some additional work might be needed. That's probably something we want to consider anyway if we ever want to provide some official form of support for *BSD platforms (currently to export for those platforms you have to replace the Linux templates by custom builds made for the BSD platform you want to target), or for Linux embedded (Raspberry Pi, etc.).

@naithar
Copy link
Contributor Author

naithar commented May 7, 2021

If the presets need to be fully separate, then some additional work might be needed. That's probably something we want to consider anyway if we ever want to provide some official form of support for *BSD platforms (currently to export for those platforms you have to replace the Linux templates by custom builds made for the BSD platform you want to target), or for Linux embedded (Raspberry Pi, etc.).

tvOS and iOS export template are completely separate, but I think it should be pretty simple to register both platform-specific exporters. The way register_exporters.gen.cpp is generated is pretty descriptive and it shouldn't be hard to do in the end.

The only problem I see right now is detect.py file that is made specifically for iOS export. I don't see any way of changing methods like can_build, get_name to support both platforms in single configuration.

@naithar naithar marked this pull request as draft June 17, 2021 12:36
@paulocoutinhox
Copy link

Hi,

Any news when it will be available?

@michael-garofalo
Copy link

Any news when it will be available?

I stumbled on this thread while researching why someone would pick Godot Engine over other game development software. I think the better question is, "What needs to be done?"

So far, I see a few issues...

And I'm also not sure how App Store will react to it - fighting bitcode stuff is hard already :)

Heh, that's a constant issue with Apple. 😄

I think that's a testing problem. Someone is going to have to try and get their game through Apple's review process. Actually, probably a few someones, to show that Apple TV games built with Godot Engine are consistently approved.

But, it looks like this Pull Request needs some work first. I'm not quite sure where it's at.

The only problem I see right now is detect.py file that is made specifically for iOS export. I don't see any way of changing methods like can_build, get_name to support both platforms in single configuration.

So, if I'm understanding this correctly, it looks like there's a debate of a single iOS / tvOS codebase, but there's a blocker with configuration. New to this, I had to figure out what that meant... is this an issue with Swift / Xcode or Godot Engine. Apparently, after seeing this webpage, it's the latter.

I don't think I'll be able to help with that problem right now, as I should actually try installing the Godot Engine first. HA HA! 😄

...but this is interesting! It looks like it's a milestone for version 4.0 — nice!

@naithar
Copy link
Contributor Author

naithar commented Sep 22, 2021

Right now the problem I see is figuring out the way to not have complete code duplication on iOS and tvOS platforms.
A branch linked to 3.x PR version is a step in that direction, but requires some more work. In my opinion 3.x changes should also be compatible with third party iOS plugins that are already there.
There is also an issue with time, so it might take longer to finish and might not be ready for 3.4 and 4.0.

3.x PR version can already be used if tvOS support is required, it only requires scons to build a tvOS binary and editor.

Any news when it will be available?

As I mentioned earlier, you should be able to build both editor and tvOS template on macOS. GitHub Actions might help with that. But you might want to rebase from current 3.x branch first to have latest changes and fixes.

And I'm also not sure how App Store will react to it - fighting bitcode stuff is hard already :)

Heh, that's a constant issue with Apple. 😄

I think that's a testing problem. Someone is going to have to try and get their game through Apple's review process. Actually, probably a few someones, to show that Apple TV games built with Godot Engine are consistently approved.

As far as I understand the latest PR state was good enough for Godot's tvOS game to pass AppStore checks, so keeping current functionality and fixing duplication should be enough.

@paulocoutinhox
Copy link

Hi,

I have two games running on my Apple TV, but godot don't publish support for it.

There is any way to get a recent editor version with tvos support?

Thanks.

@naithar
Copy link
Contributor Author

naithar commented Sep 22, 2021

@paulo-coutinho you should be able to fork and build editor and template using branch from this PR #45829.
It might be necessary to rebase from Godot's 3.x before building to have all newest features and changes.

@naithar
Copy link
Contributor Author

naithar commented Mar 10, 2022

Superseded by #58976 and #58977

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants