Skip to content

Fix standalone gameserver definitions#103

Closed
zorfmorf wants to merge 1 commit intouspgamedev:masterfrom
zorfmorf:master
Closed

Fix standalone gameserver definitions#103
zorfmorf wants to merge 1 commit intouspgamedev:masterfrom
zorfmorf:master

Conversation

@zorfmorf
Copy link
Contributor

@zorfmorf zorfmorf commented Mar 15, 2026

Should fix #102

  • The structs were not initialized (causing userdata exceptions)
  • Fix nullpointer after a GamerServerUtil callback function was fired

Things seem to work for me with these two changes, but honestly I am not too sure especially about the second change. The fix was suggested by AI and I am not certain if this is the best way to fix it ... yeah I know. In my defense, I haven't written any C++ in many years 🙇

So feel free to reject or change this PR

@zorfmorf
Copy link
Contributor Author

I think the build references a private repository of the maintainer, so they fail if I trigger them... maybe

@yancouto
Copy link
Collaborator

Just to understand, on game server you just use Steam.GameServerInit() and not Steam.Init() at the same time, right?

Copy link
Collaborator

@yancouto yancouto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'll finish review and push it later today or tomorrow.

bool success = SteamGameServer_Init(ip, usGamePort, usQueryPort, eServerMode, version);
if (success) {
luasteam::init_Common(L);
luasteam::init_structs_auto(L);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes a lot of sense, it is indeed missing.

I just need to double check if there's something else that's also missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SteamNetworkingMessage was also missing! I also updated the documentation. For what it's worth, with the fixes I added, everything in my game works as expected, including networking between several clients and servers using auth ticket handling and client handover.

lua_createtable(L, 0, luasteam::GameServerUtils_count + 1);
register_Utils_auto(L, true);
add_func(L, "SetWarningMessageHook", luasteam_GameServerClient_SetWarningMessageHook);
lua_pushvalue(L, -1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah, this was also wrong, but maybe it's missing from the non-gameserver as well. I will double check later and push the final fix. Hope it's not blocking you.

@zorfmorf
Copy link
Contributor Author

zorfmorf commented Mar 15, 2026

Thank you for taking a look at this!

Exactly, my server is a completely stand-alone, dedicated server, so I dont want to have to run steam in the background.

It is an intended use of the steam api. You use LogOnAnonymous get a temporary steam id or you use LogOn to log into a fixed dedicated account (creatable here).

It works fine in the previous version of luasteam for what is worth.

It's only blocking me in the sense that I can't update to the latest version of luasteam quite yet :)

@zorfmorf zorfmorf changed the title Fix standlone gameserver definitions Fix standalone gameserver definitions Mar 16, 2026
@yancouto
Copy link
Collaborator

yancouto commented Mar 16, 2026

The gameserver initialization I fixed in a previous commit. Thanks for the docs fixes! I have manually merged this PR via c19ed10.

PS. Future PRs will run the CI just fine, I fixed the problems with it.

@yancouto yancouto closed this Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v5.0.0+rc: Crash when exiting OnSteamNetAuthenticationStatus callback

2 participants