Giter VIP home page Giter VIP logo

Comments (15)

Gramps avatar Gramps commented on June 12, 2024 3

Yeah, in my projects I use the Engine singleton check and then pass Steam to another object steam_api. No autcomplete but at this point I have memorized most everything I use.

However, I was thinking about this issue on my morning walk and want to try building something into GodotSteam itself. To not make it a huge undertaking, I may make a small test that is just the basics to see if the idea works.

This probably won't happen until after GDC but I'll drop it in here when ready. Or I may get a wild hair and do it this weekend.

from godotsteam.

yancouto avatar yancouto commented on June 12, 2024 2

We had the same issue, we couldn't use Steam directly on the code or it would crash on startup in Android (even if said code was never called).

The solution was to use Engine.has_singleton/Engine.get_singleton to dinamically check Steam was there. The issue is that makes us lose all static typing (so for example, there's no more autocomplete).

I've seen some Android plugins working around that by providing an autoload that uses the underlying lib (and is correctly typed), so that it works even on desktop where the plugin doesn't make sense. Not sure if there's a better solution in Godot atm.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024 1

Actually it's early, it's Friday, and afternoon... so I am gonna try to cobble a test together now.

from godotsteam.

yancouto avatar yancouto commented on June 12, 2024 1

I'm not sure this "disabling modules" is very useful, given you still need to access the singleton anyway (I'm not sure how I'd use it in my project at least.)

I haven't done addon work before, but I imagine that the types that Godot uses for autocomplete and stuff are directly retrieved from the C++ types, since I didn't see any .gd specific code in this repo. I thought about having a dummy godotsteam.cpp for other platforms that would at least have the types right. But I think that may not be possible because you would still need to compile it for other platforms?

The only other possible fix I can think of is providing a .gd lib that uses the underlying library and is independent of platform. Like here and here.

The annoying bit is that it needs to be kept in sync with the C++ code or stuff will stop working.

from godotsteam.

TCROC avatar TCROC commented on June 12, 2024 1

So I built godot from source with steam as a module. The editor has steam support. My Android templates DO NOT include steam. However, my mono glue and rust bindings still generate with steam since they are being built from the editor. And my Android is crashing in random places. Previously it was when updating the player's skeleton. Now it is on application load. I'm wondering if its possible that because the mono glue and rust bindings are generated from an editor that has a module that the android template does not may be causing some UB (undefined behavior). I'll test some things today and let you guys know what I find.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Hey there! This is a good question and one I have on my list to solve. Someone else asked about having a version of their game where GodotSteam can easily separated for Android export. Apparently it works well on other desktop operating system but for some reason Android, it doesn't. I'm not totally sure why just yet.

Typically if you can avoid the calls by checking what platform the game it on, it should just work. I know with GDExtension, there is a file that need to be altered to make this easier. I think another issue that is open talks about this.

I will try to fold in the user who originally brought this up to see if they can also weigh in with some tips about what they have working and where stuff breaks.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Well, my test was a partial success / failure. I added the ability to turn everything off at module level. It still requires the Steam object to exist, obviously. There is no functional way to cut that out. However, with this, you can turn it off and any calls to Steam will return default / dummy information. It negates the need for some "non-integration" solutions I've seen. I mean, it stands to reason that if GodotSteam isn't present, we can't use it to "remove" itself. it has to be handled in the game itself.

I believe the only way, thus far, is to use what @yancouto mentioned which we have in our docs under the "Remove Steam" tutorial.

Not sure if I should keep this disabled functionality or not. If it even has any use.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Yeah, basically what I did was recreate that inside the module (C++). So now, I don't have to check for the singleton's existence, it can just be "shut off" and feeds back similar dummy data in a similar fashion. Haha, as you said, I'm not sure it is useful. Still requires the Steam shared libraries to exist; still requires the singleton too.

With the GDNative plug-in, we could just add that logic to the included steam.gd file but GDExtension does not do this; it just "exists" if present.

I'm still tinkering with some other C++ tricks to see what I can get away with.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Sadly, all my attempts failed thus far. There is a proposed fix with Godot for removing extensions a bit cleaner, which may help but not sure when that'll happen.

from godotsteam.

denisvitez avatar denisvitez commented on June 12, 2024

So basically now the problem is that my script doesn't get loaded on Android, because I'm using Steam calls inside it (even if the calls never get executed because there is platform check, which then uses the current platform APIs. I'm thinking now the only way to get the functionality to work is to now split my "Helper" node and have separate nodes for Android/Steam and then use signals to communicate with them. So in that case even if the node won't get loaded it won't break the functionality for other platforms. This of course adds more complexity to the application, is there any other simpler way how I can tackle this problem? If someone more experienced in Godot have some ideas I'd be glad if they will be able to share their thoughts :)

from godotsteam.

denisvitez avatar denisvitez commented on June 12, 2024

So basically now the problem is that my script doesn't get loaded on Android, because I'm using Steam calls inside it (even if the calls never get executed because there is platform check, which then uses the current platform APIs. I'm thinking now the only way to get the functionality to work is to now split my "Helper" node and have separate nodes for Android/Steam and then use signals to communicate with them. So in that case even if the node won't get loaded it won't break the functionality for other platforms. This of course adds more complexity to the application, is there any other simpler way how I can tackle this problem? If someone more experienced in Godot have some ideas I'd be glad if they would be able to share their thoughts :)

I have decided to try the approach that yancouto mentioned, using the Engine.has_singleton, since I really don't want to add more complexity to this simple app

from godotsteam.

TCROC avatar TCROC commented on June 12, 2024

That does not appear to have been the issue on my end.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

So basically now the problem is that my script doesn't get loaded on Android, because I'm using Steam calls inside it (even if the calls never get executed because there is platform check, which then uses the current platform APIs. I'm thinking now the only way to get the functionality to work is to now split my "Helper" node and have separate nodes for Android/Steam and then use signals to communicate with them. So in that case even if the node won't get loaded it won't break the functionality for other platforms. This of course adds more complexity to the application, is there any other simpler way how I can tackle this problem? If someone more experienced in Godot have some ideas I'd be glad if they would be able to share their thoughts :)

I have decided to try the approach that yancouto mentioned, using the Engine.has_singleton, since I really don't want to add more complexity to this simple app

Does that method work with Android? To check if it is running.

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Checking up on this issue. Has everyone resolved it?

from godotsteam.

Gramps avatar Gramps commented on June 12, 2024

Will close it unless there is new information or errors!

from godotsteam.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.