Open bfelbo opened 3 years ago
This will be supported for Android in 4.0 since https://github.com/godotengine/godot/pull/39855 was merged.
Amazing! Then this proposal can be focused on adding support for iOS and documentation on how to use it 😊
@bfelbo Quick clarifications:
res://android/build
directory. So if you just need the ability to embed Godot as a library on Android with Godot taking over the full screen when invoked, you should be good to go with the current stable version. If you need the ability to embed/restrict Godot to a specific view, then that feature will be available in Godot 3.2.4. I'd still recommend starting the process of integrating the Godot library in your target application to get familiar with the process.
And since this is an open source project, any feedback, learnings, documentations or examples you'd like to share or contribute back would be much appreciated :)
@bfelbo Would you mind splitting this proposal in two. The iOS portion remains, so there should be a proposal focusing on the iOS side of the equation. For the Android side, based on the current proposal, only the documentation portion is missing, so the updated proposal should reflect that.
@bfelbo Would you mind splitting this proposal in two.
Definitely! I've separated out the documentation into https://github.com/godotengine/godot-proposals/issues/1518.
If you need the ability to embed/restrict Godot to a specific view, then that feature will be available in Godot 3.2.4.
Thanks for the detailed explanation. It's really cool that it's already possible to do this on Android!
And since this is an open source project, any feedback, learnings, documentations or examples you'd like to share or contribute back would be much appreciated :)
Yes, we'd love to contribute in any way we can :)
- Use many mobile features like microphone permissions (#1272), in-app purchases (#242), VoIP push notifications, ForegroundService, CallKit. Godot doesn't support these, but there's lots of battle-tested iOS/Android libraries for these features and it would be great to rely on those libraries.
This should be possible with new iOS plugin system once or if it gets merged. Plugin Proposal, 4.0 PR, 3.2 PR.
In PR for 4.0 I've also gave some kind of example for using native UI. I guess integrating it with React Native should be possible too.
I also plan to make AppDelegate
class more extendable as well as enabling ARC usage. This should give a more easier access to PushKit and RemoteNotifications as well as simplify iOS specific implementation.
As for making Godot embeddable.
It should probably not be an embeddable UIView
, but UIViewController
, which should give some control over app lifecycle.
Switching to NSNotification
instead of AppDelegate
method would be needed, but some things might be missing there, I'm not entirely sure.
Also Godot uses it's own main
method, so moving it into iOS template is required, otherwise iOS application will get a duplicated symbols
error.
This should be pretty much all the work needed on platform side. But with current 3.2
state I would probably wait for some refactoring done first.
Thanks for the detailed explanation @naithar! Makes sense that it might require some refactoring first before working on making Godot embeddable.
I just saw that 3.2.4 will include Android embedding support 🎉 Would be awesome to also have it on iOS in the near future so this can be used by all the devs building cross-platform mobile apps.
@naithar, what kind of refactoring do you think should be done before working on this? Anything I can help with?
@bfelbo most of the work that are needed was already merged (https://github.com/godotengine/godot/pull/42459, https://github.com/godotengine/godot/pull/42582 and some other PRs), only PRs with fixes are left, like https://github.com/godotengine/godot/pull/42648. Maybe Motion manager should also be moved in separate class, like joypad, but I'm not sure.
I'm also waiting for https://github.com/godotengine/godot/pull/41230 to be merged. It'll allow to build plugins for iOS without rebuilding the whole engine.
After that I think it'll be safe to implement embedding Godot game into another iOS application.
@naithar Happy holidays! It's great to see that the blocking PRs you mentioned have been merged. I'm sure more changes will be needed to allow exporting as an embeddable iOS view, but it's nevertheless incredible to see the rapid progress! Thanks so much for your good work! :)
Is it possible to implement a "godot-widget" for flutter ? :) like this open source lib: https://pub.dev/packages/flutter_unity_widget
Is it possible to implement a "godot-widget" for flutter ? :) like this open source lib: https://pub.dev/packages/flutter_unity_widget
Once/If this proposal is implemented, it should be possible to some extent.
@naithar, seems like implementing this could involve some breaking changes. Would it make sense to include this in 4.0?
seems like implementing this could involve some breaking changes
I guess it can. But it mostly depends on implementation. I can't really say for sure, since I haven't really touched this topic.
What I've came up with will probably involve creating separate export template which will include .a
or xcframework
file with headers which will provide integration API. But I can't really tell if it will work for now.
Would it make sense to include this in 4.0?
Making it 4.0 only will probably remove the need to check for breaking changes as long as it doesn't break anything else :)
Making it 4.0 only will probably remove the need to check for breaking changes as long as it doesn't break anything else :)
Sounds good, that should dramatically reduce the testing effort. Do you know what's the process for marking this issue as part of the 4.0 GitHub milestone? :)
Sounds good, that should dramatically reduce the testing effort. Do you know what's the process for marking this issue as part of the 4.0 GitHub milestone? :)
Setting a milestone on a proposal means that we commit to delivering the feature in that version, and I'm not 100% sure if anyone will be able to make this in time for 4.0 (whose release is expected in 2022).
Thanks for clarifying @Calinou. Makes sense to avoid setting the milestone to prevent committing to including this.
@naithar, if you have time, it'd be awesome to include this as a 4.0 feature, which should also simplify testing as you mention :)
is it available now?
@dboylx No, not yet. There is no ETA for implementing this feature either, as no contributor is available to work on it.
ok, thankyou , plz tell me when it's ok
Any updates?
Any updates?
Same as above. We need a motivated contributor to do the work :slightly_smiling_face:
We (www.voxels.com) would be happy to create a bounty or sponsor a developer to get this working for ios so we can embed our godot 3.5 renderer into a swift ui app.
Hello, has this issue been picked up? I've got many years of mobile development and thought I'd have a go at this.
Hello, has this issue been picked up? I've got many years of mobile development and thought I'd have a go at this.
No contributor has tried to tackle this yet. Feel free to give it a try :slightly_smiling_face:
We’re keen to support this!
On Wed, 21 Sep 2022 at 12:06 PM, Hugo Locurcio @.***> wrote:
Hello, has this issue been picked up? I've got many years of mobile development and thought I'd have a go at this.
No, not yet. Feel free to give it a try 🙂
— Reply to this email directly, view it on GitHub https://github.com/godotengine/godot-proposals/issues/1473#issuecomment-1253036101, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAEIWZI2HWWZINEHPLLZA3V7JGRBANCNFSM4Q7BBOIA . You are receiving this because you commented.Message ID: @.***>
-- Regards, Ben Nolan
Hi, has any progress been made on this?
Having the ability to embed a Godot game into SwiftUI would be an amazing feature.
Im willing to help finically support a bounty along with @bnolan on this.
Hi, has any progress been made on this?
No contributor has tried to tackle this yet. Feel free to give it a try :slightly_smiling_face:
This would likely be a starting point: https://github.com/migueldeicaza/SwiftGodot
Since Godot can't be used as a library, it would need SwiftUI called from the Godot side.
I'd be willing to provide significant financial support to anyone who wants to tackle this. It's currently a blocker for us in using Godot.
While I am happy to see folks point to SwiftGodot, that won’t really do much to reach the stated goal. It doesn’t do much to help you. And sadly neither would SwiftGodotKit, which is more of a “drive Godot from swift” and not the “make Godot render into a UIView I can control at will” or the more ambitious “make Godot render in these five views, each with their own thing”
Hey @bruvzg I see you've self-assigned this proposal. I'm sure you're extremely busy, was just wondering if there are any near term plans for implementing this.
Hey @bruvzg I see you've self-assigned this proposal. I'm sure you're extremely busy, was just wondering if there are any near term plans for implementing this.
I'm not currently working on it. I have self-assigned when I was trying to implement Godot Editor support for iOS, but this requires a lot more changes (running multiple Godot instances in the one process in particular) than just an embeddable view.
I had just filed an issue for a tangentially related issue that touches on both @jbromberg request and @bruvzg 's comment:
Any news? :)
Not sure how far you already are @migueldeicaza, but I had already implemented this for Unity, since we needed to go back and forth between Unity game and our native part of the app (we added Unity games in existing app that's been on the market 5+ years). We also wanted to run Unity in background (without sound) and run certain Unity C# scripts. That was made possible by taking control of Unity bootstrap code and making it render on a UIView
instance that would be in background. Basically you can do anything with this UIView
, add it to a custom controller, open half of a native UIView
above, even use it with SwiftUI views (through UIHostingController
of course). That helped us to get our Unity assets all downloaded in background (by common C# code). The only limitation remained, that only one instance of the view could be used on screen at the same time, same as here as mentioned in other threads because singletons are used. However in theory, if macOS can run multiple windows in same process, then iOS should be able as well.
So since the fiasco with Unity runtime fees, we're considering switching to Godot and this does seem like a limitation for us as well.
With some financial support, maybe I'd be interested in doing this for Godot as well. Doesn't look too complicated looking at platform export code and Godot view in Objective-C++ here: https://github.com/godotengine/godot/blob/master/platform/ios/godot_view.mm
However, I'm new to Godot and all and would likely need someone to guide me a bit to get started. By the looks of it, Godot cannot be exported as a .framework
like Unity can, which is usually the easier way to include it as embedded view.
Is there any work being done here and is the interest still around?
There is already a patch developed that I believe is being upstream in the 4.3 window
Thank for all the hard work. I just wonder if the feature embed ios Godot game to ios, make game and native app communicate is work? Really need this feature. If that already work please help me with the link to the docs or sample please. I can't find anything about it.
I don't think there are docs yet because as far as I can tell the patch has not been submitted yet.
Describe the project you are working on: Multiplayer game for iOS and Android
Describe the problem or limitation you are having in your project: Due to the social nature of our game, we need to:
Describe the feature / enhancement and how it helps to overcome the problem or limitation: Godot added support for embedding your game inside an Android app and it would be amazing if Godot added support for iOS as well.
A few benefits:
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Similar to https://github.com/godotengine/godot/pull/39855 for Android, it would be possible to export your game as an embeddable iOS view.
A developer would create their own Android/iOS app from scratch and use the Godot embeddable view. Inside the app, the Godot view could be displayed for the actual gameplay. For instance, consider the popular mobile games Brawl Stars, Fortnite, and PUBG. The developers could code up all the UI, app permissions, ad tracking, etc. in any language and then use Godot once the user clicks "Play" and enters the actual gameplay.
One way to think of the current default Godot app exports is that they're a embeddable view + a wrapper. The view has all the core functionality and the wrapper handles things like setting the right permissions in the
AndroidManifest.xml
. If this was separated, it would be easy for anyone to export a complete app or to just use the embeddable view depending on their use case.If this enhancement will not be used often, can it be worked around with a few lines of script?: Not that I know of.
Is there a reason why this should be core and not an add-on in the asset library?: Porting/exporting is best handled in core and this proposal would alleviate the need for many other core proposals (see linked issues above).
EDIT: Updated to split out documentation and focus on iOS support based on @m4gr3d's suggestion.