SteamworksPy icon indicating copy to clipboard operation
SteamworksPy copied to clipboard

CreateLobby function returns None

Open P0stf1x opened this issue 6 years ago • 11 comments

I'm using CreateLobby(0, 2) to create private invite-only lobby for 2 player co-op game, but it doesn't return me anything, just None. I'm testing with 480 appid. The code is

from steamworks import *

Steam.Init()
print(SteamMatchmaking.CreateLobby(0, 2))

P0stf1x avatar Oct 13 '19 16:10 P0stf1x

Hey there! CreateLobby shouldn't return anything as it is a void function in Steamworks. It should, however, send a callback when the lobby is created with the lobby Steam ID. It should also make the user join the lobby they just created.

Gramps avatar Oct 13 '19 19:10 Gramps

That being said, I don't know there are any callbacks set up for it just yet. Gonna make some commits today to address that and a bunch of other things!

Gramps avatar Oct 13 '19 19:10 Gramps

Oh, probably misunderstood Russian steamworks translation. By the way, could you please show me example of how to do this? I kinda understand it in C++ but not in Python

P0stf1x avatar Oct 14 '19 13:10 P0stf1x

I don't know the callback exists for it yet, so I'll need to update that code first. Which, hopefully, I should have up by next week.

That being said, you need to in your main loop something like: Steam.RunCallbacks() This will look for callbacks from Steam and should be running constantly in the background. When it finds the callback for _lobby_Created() that will return the Steam lobby ID. It will also send back a _lobby_Joined() callback which effectively moves the player into the lobby in Steam.

I'll write more code once I get the callbacks added to the experimental branch.

Gramps avatar Oct 14 '19 15:10 Gramps

You can leave the issue open and I'll add code to it.

Gramps avatar Oct 14 '19 17:10 Gramps

Just to add to the issue, RunCallBacks need to always run whenever you do calls. Example in Unity would be every time an object gets updated callbacks would need to be called. In standalone C# you would run RunCallBacks() in a separate thread for them to get trigger properly. I think in python it would be somewhat similar to C# standalone, I think Gramps will post a proper code snippet for the python version

labanau avatar Dec 19 '19 16:12 labanau

Yeah, the callbacks stuff is tricky. It should be in whatever main loop you have going on unless you don't have anything that requires a callback. Considering the variety of set-ups I've seen in Python, it's tricky to show folks.

I do plan on getting some tutorials up much like the ones I did for my GodotSteam library.

Gramps avatar Dec 20 '19 23:12 Gramps

And yeah, still trying to streamline the callbacks for Python. Once I get them down the rest of this will be easy-peasy.

Gramps avatar Dec 20 '19 23:12 Gramps

Once I get connected to a lobby, what can I do with it? I don't see any methods like SetLobbyData implemented

FreezeDriedMangos avatar Nov 21 '21 21:11 FreezeDriedMangos

Once I get connected to a lobby, what can I do with it? I don't see any methods like SetLobbyData implemented

Well, I haven't been following versioning and what is implemented on the wrapper. However, it opens a lot of possibilities. For example setting the data as you mentioned, or receiving players steamids on server etc.

labanau avatar Nov 22 '21 10:11 labanau

Thanks! How do I access SetLobbyData and functions like it? The steamworks object doesn’t have an attribute named SetLobbyData

ghost avatar Nov 22 '21 13:11 ghost