Good day,
I've tried to build GDNative version of your module and failed. Then I decided to update it to latest GDNative so it also won't use godot sources. But I'm having problems (mainly with SteamSDK).
I will be grateful if you could suggest me something on this errors:
In file included from include/sdk/public/steam/steam_api.h:392:0,
from include/GDSteam.h:6,
from src/GDSteam.cpp:2:
include/GDSteam.h: In member function 'virtual void GDSteam::CCallbackInternal_OnLobbyCreated::Run(void*)':
include/sdk/public/steam/steam_api_internal.h:195:105: error: expected primary-expression before ',' token
thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
^
include/sdk/public/steam/steam_api_internal.h:187:58: note: in expansion of macro '_STEAM_CALLBACK_3'
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
^
include/sdk/public/steam/steam_api_internal.h:188:45: note: in expansion of macro '_STEAM_CALLBACK_HELPER'
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
^
include/sdk/public/steam/steam_api.h:219:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
^
include/GDSteam.h:294:2: note: in expansion of macro 'STEAM_CALLBACK'
STEAM_CALLBACK( GDSteam, OnLobbyCreated, LobbyCreated_t );
^
include/sdk/public/steam/steam_api_internal.h:195:107: error: invalid use of non-static data member 'GDSteam::m_steamcallback_OnLobbyCreated'
thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
^
include/sdk/public/steam/steam_api_internal.h:187:58: note: in expansion of macro '_STEAM_CALLBACK_3'
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
^
include/sdk/public/steam/steam_api_internal.h:188:45: note: in expansion of macro '_STEAM_CALLBACK_HELPER'
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
^
include/sdk/public/steam/steam_api.h:219:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
^
include/GDSteam.h:294:2: note: in expansion of macro 'STEAM_CALLBACK'
STEAM_CALLBACK( GDSteam, OnLobbyCreated, LobbyCreated_t );
^
include/sdk/public/steam/steam_api_internal.h:198:4: note: declared here
} m_steamcallback_ ## func ; void func( param *pParam )
^
include/sdk/public/steam/steam_api_internal.h:187:58: note: in expansion of macro '_STEAM_CALLBACK_3'
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
^
include/sdk/public/steam/steam_api_internal.h:188:45: note: in expansion of macro '_STEAM_CALLBACK_HELPER'
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
^
include/sdk/public/steam/steam_api.h:219:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
^
include/GDSteam.h:294:2: note: in expansion of macro 'STEAM_CALLBACK'
STEAM_CALLBACK( GDSteam, OnLobbyCreated, LobbyCreated_t );
^
include/sdk/public/steam/steam_api_internal.h:195:132: error: 'offsetof' was not declared in this scope
thisclass *pOuter = reinterpret_cast<thisclass*>( reinterpret_cast<char*>(this) - offsetof( thisclass, m_steamcallback_ ## func ) ); \
^
include/sdk/public/steam/steam_api_internal.h:187:58: note: in expansion of macro '_STEAM_CALLBACK_3'
#define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... ) _STEAM_CALLBACK_##SELECTED
^
include/sdk/public/steam/steam_api_internal.h:188:45: note: in expansion of macro '_STEAM_CALLBACK_HELPER'
#define _STEAM_CALLBACK_SELECT( X, Y ) _STEAM_CALLBACK_HELPER X Y
^
include/sdk/public/steam/steam_api.h:219:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
_STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
^
include/GDSteam.h:294:2: note: in expansion of macro 'STEAM_CALLBACK'
STEAM_CALLBACK( GDSteam, OnLobbyCreated, LobbyCreated_t );
^
Best
Hey there! First, to ask, are you using the Godot 3 stable source to compile for? I haven't tried that one so I don't know what all has changed. Though I indeed to ask Karoffel about it when I get on Discord next. I know that some stuff stopped working and needed changed in the module version of GodotSteam so I assume a lot is broken in the GDNative version. Granted it was experimental at the time it was made.
As for the errors, I know the callbacks were problematic in the experimental version. Seems like they are still problematic and appear to be the only hang-ups you have in the error log. For now, try commenting out all callbacks in godotsteam.h and godotsteam.cpp to remove those errors and it should work. Make sure you get all of the callbacks commented out then see what happens. Do update me back with what happens, if you can.
Like I said earlier, I'm gonna focus on getting the GDNative version up to snuff with Godot 3 stable since it is now out. I'll try to update the library this coming week!
Yep, I'm on a stable version and your module for godo it self works (maybe with little tweaks, don't remember at this point). Karroffel doesn't spend much time on Discord, I tried to reach him there few times.
Yeah, it should work without callbacks. I've updated almost everything so it uses pure GDNative. The other thing I had I don't know how to fix is Vector
Maybe you would have any ideas what I can use to replace it with.
I'll be happy to share my work with you so there would be no need in doing same work again.
Best :smiley:
Yeah, I wasn't sure the GDNative version would work with Godot 3 stable. A fair amount changed after it was made for the beta.
I'll try to track that fellow down and see what all I need to know to get the GDNative branch up on it's feet again. The documentation for it will have to be re-written.
Glad to hear it functions without callbacks. That's a great starting point. Vector in Godot 3 is now something else... don't remember what but will look into it.
Yeah, if you can or want to put in a pull request for the GDNative branch. It would be helpful to start from a good working copy for 3 stable!
Cheers!
I've pushed working version under new branch on fork of your repo here.
Many things have changed from your version as I plan to use this in my projects so please check it out. As I'm using linux I've added cross-compiling scons but I don't have any chance to test windows build. But previous experience with other modules shows that it should work.
If you would have any questions you can find me on Godots Discord server)
Here are a things that are still to do:
[ ] fix Vector
[ ] fix Signals
[ ] Godot singleton - no idea how to make one using gdnative (I'll ask Karroffel as soon as possible)
[ ] replace dependency core/io/ip_address.h
There is also one problem with constants: you can't create any (Karroffel approved)
Best :smiley:
Nice. I'll check out the branch later this evening or early tomorrow. I'm a bit lagged from travel currently. We can actually push your dev branch to the main branch since it was experimental to start with and is now really outdated. If and when, can you put in a pull request?
Yeah, I mostly use Linux for development. I don't remember GDNative working well with Windows during alpha but I assume that's all good.
I think vector is an easy fix but signals were all messed up originally. Though I bet we can get those working. I'll have to double-check the singleton stuff. It's been a while since I did anything with GDNative and a good bit has changed.
No constants! Not sure it really matters or not but if we cannot use them, so be it!
Cheers and thanks for the work, sir!
Actually just checked it out and there is a lot of things different. I'll sit down with Karrofel's documentation tomorrow and see what I can figure out. Like I said, I'll have to re-write the documentation for it too. I'll just have to record my workflow from start to finish.
I will probably rename the GDSteam back to Steam to keep consistency with the rest of the modules, as has been custom. The rest looks great. Once I get it compiled I'll probably make a pre-release pre-compile for use.
Will report back tomorrow! Cheers!
OK. Got it all put together, however it doesn't seem to work for me in Linux. Gives some kind of error.
I tried your version with no edits and that didn't work. So I make a combination of the previous one and yours. I still have to iron out the issues but it has all the latest features from the current GodotSteam branches. My version deviates a bit from Karrofel's setup. I kept everything in the GodotSteam GDNative folder to prevent a sprawling mess.
Feel free to pull the branch and tinker with it.
Did you used my scons configuration, it wouldn't work otherwise.
What kind of errors?
When I tried your version, yes. I don't remember what errors I got though.
With my implementation I get the nativescript_api symbol error when adding it to Godot after compiling. That shouldn't be too hard to fix.
Well I have no problems except written above (signals etc.) with my build, and I successfully use it in my project. So it definitely problem with the fact what scons you've used (mine or yours), if mine, then the question is: do you have all required packages installed.
NativeScript is a different thing. You can't take GDNative module and use it as NativeScript.
Maybe I had yours set up wrong? How do you have it laid out and what steps do you take?
Your script has the NativeScript thing too:
````
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
{
godot::Godot::nativescript_init(handle);
godot::register_class<GDSteam>();
}
````
That's the same and only reference we both have. Not sure why it'd mess up on mine.
godot-cpp/
godot_headers/
GDSteam/
That is also why I have two scons files: SConstruct and SConscript files so that I use same SConstruct between all gdn projects and setup all project dependencies in SConscript.
gcc-5.make linux64.Please let me know I you would still have any kind of problems :)
No idea about this part, just copied it from my other module where I got it from docs or tutorial))
Best :smiley:
OK, I'll try this out and see what happens then report back! Thanks for the breakdown!
Well, I got it to compile correctly finally. However, I cannot get it to play nice in Godot following any instructions on adding it to a project.
Honestly, GDNative is a huge pain in the ass compared to the module version for, as far as I can tell, zero benefit. There are way more steps and way more things that can go wrong.
Nonetheless, I'll keep trying to figure out how to get it fixed. Though there is no way I would use it personally. :smile:
What you've done to it to compile my version and what issues you are having currently?
It takes time to create good software. Same with gdnative. It has very big perspectives IMO.
I'm personally interested in creating something like package management system (composer, npm, pip) for godo. I've written an issue about that on godot's repo.
Well, it is all compiled fine but I can't seem to get it to do anything. How are you calling functions from it? The example in Karrofel's CPP demo doesn't seem to work; adding it through Inspector and calling it from a GDscript attached to a node. My old method doesn't work either, which isn't surprising.
You are right; good software does take time. A lot in some cases. Though, with GDNative, you'd have to end up with a lot less steps to be as easy and useful as the module. Since the module is always present in the engine and can be called at any time from anywhere in the game. That kind of built-in omnipresence is great.
A package manager would be cool. I was hoping that the GDNative version of GodotSteam would be able to be accessible as an asset in the Asset Library in Godot 3.
As this is just a Reference class I load it and use like a normal gd script:
var GDSteam = load('res://GDSteam/GDSteam.gdns').new()
print(GDSteam)
GDSteam = GDSteam.new()
print(GDSteam.isSteamRunning())
print(GDSteam.getPersonaName())

Hmm, felt like I did that but I'll give it a shot and see what happens! If all that works, I'll start updating the branch and documentation for it. Cheers!
Eh, it still doesn't work. I think I'm gonna give up on GDNative for now. Like I said, it's too many steps and too wonky to be useful in production. Especially since signals do not work. Thanks for the assistance though!
That's definitely interesting...
Well, ok then, thank you too)
Yeah, I've sunk more time into it with little results for my liking. I think I'll wait to see if it evolves a bit more down the road. That being said, I currently get the new() is not a function error. So I think I'll stick with the fully functional modules instead since they only require one compile and don't require any other integration.
Updated and functional! Thanks to you and willnationsdev!
Thanks to you too for keeping fighting. I'll have a look at what you've done to make it work :)
Best :smiley: