Skip to content

Cannot find my test lobby in match list #4

@Lem0nLem0n

Description

@Lem0nLem0n

Hi, thanks for the great example project!

When testing this project I ran into an issue:

I cannot see the test lobby I created with another Steam account in the match list. I’d like to know what could be the possible reason for this. The lobby list looks completely different on each account.

As a quick workaround, I wrote a very lazy way to display friend lobbies in the lobby list. Maybe it can help others who run into the same issue. (Note: both sides need to be online in Steam for it to work.)

Here is the modified code:

func get_friends_game_list() -> Dictionary:
	var results: Dictionary = {}
	
	for i in range(0, Steam.getFriendCount()):
		var steam_id: int = Steam.getFriendByIndex(i, Steam.FRIEND_FLAG_IMMEDIATE)
		var game_info: Dictionary = Steam.getFriendGamePlayed(steam_id)
		
		if game_info.is_empty():
			# This friend is not playing a game
			continue
		else:
			# They are playing a game, check if it's the same game as ours
			var app_id: int = game_info['id']
			var lobby = game_info['lobby']
			
			if app_id != Steam.getAppID() or lobby is String:
				# Either not in this game, or not in a lobby
				continue
				
			if not results.has(lobby):
				results[lobby] = []
				
			results[lobby].append(steam_id)
	return results 
func _setup_ui():
	#Should be customizable, ultimately
	Steam.addRequestLobbyListDistanceFilter(Steam.LOBBY_DISTANCE_FILTER_CLOSE)
	
	Steam.lobby_match_list.connect(
		func(lobbies : Array):
			var friend_lobbys = get_friends_game_list()
			var all_lobbys = friend_lobbys.keys() + lobbies
			
			for sample in all_lobbys:
				var lobby_name : String = Steam.getLobbyData(sample, "name")
				var member_count : int = Steam.getNumLobbyMembers(sample)
				
				var join_button := Button.new()
				if friend_lobbys.has(sample):
					join_button.set_text(str(lobby_name, ": ", 
						member_count, " joined (Friend)"))
				else:
					join_button.set_text(str(lobby_name, ": ", 
						member_count, " joined (Public)"))
				join_button.set_size(Vector2(100, 5))
				
				lobby_container.add_child(join_button)
				join_button.pressed.connect(
					func():
						steam_connect.hide()
						steam_players.show()
						gamestate.join_lobby(
							sample,
							player_name.text)
				)
	)
	
	_request_lobby_list()
Image

Do you have any idea why the match list does not return my test lobby?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions