Skip to content

Conversation

@chunloklo
Copy link

Updating steam lobbies to work with latest Facepunch Steamworks api.
Makes sure that lobby data is set for steamlobbies and that member data is updated.

readonly SteamLobbyManager _manager;

public SteamLobby(Steamworks.Data.Lobby lobby, SteamLobbyManager manager) : base() {
public SteamLobby(Steamworks.Data.Lobby lobby, SteamLobbyManager manager, bool connected) : base() {
Copy link
Member

Choose a reason for hiding this comment

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

Please make this default to false.

Copy link

Choose a reason for hiding this comment

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

Leave a comment

Copy link

Choose a reason for hiding this comment

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

Leave a comment

}
//if (!_lobby.SendChatBytes(ptr, msg.Length)) {
// Debug.LogError("Failed to send Steam Lobby Packet.");
//}
Copy link
Member

Choose a reason for hiding this comment

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

Any reason this was commented out?

Copy link
Author

Choose a reason for hiding this comment

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

Sending chat bytes are no longer supported through facepunch. I'm just going to throw a NotImplemented error then.

Copy link

Choose a reason for hiding this comment

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

Leave a comment

throw new InvalidOperationException("Cannnot set the metadata of a Steam lobby member other than the current user.");
}
_lobby.SetMemberData(new Friend(handle.Id), key, value);
_lobby.SetMemberData( key, value);
Copy link
Member

Choose a reason for hiding this comment

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

Remove the extra space before key.

SteamMatchmaking.OnLobbyMemberDisconnected += OnLobbyMemberLeave;
SteamMatchmaking.OnLobbyMemberKicked += OnLobbyMemberRemoved;
SteamMatchmaking.OnLobbyMemberBanned += OnLobbyMemberRemoved;

Copy link
Member

Choose a reason for hiding this comment

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

Remove extra line here.

var lobbies = new Lobby[result.Length];
for (var i = 0; i < lobbies.Length; i++) {
lobbies[i] = new SteamLobby(result[i], this);
lobbies[i] = new SteamLobby(result[i], this, false);
Copy link
Member

Choose a reason for hiding this comment

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

Once the default has been set to false, remove this change.

var comp = (LobbyComparison)((int)comparison);
_query.AddStringFilter(key, value, comp);
//var comp = (LobbyComparison)((int)comparison);
//_query.AddStringFilter(key, value, comp);
Copy link
Member

Choose a reason for hiding this comment

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

This actively breaks the search builder. Is this now deprecated?

Copy link
Author

Choose a reason for hiding this comment

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

Yup it's deprecated now. I'm going to fix it to work with the new API then.

var comp = (LobbyComparison)((int)comparison);
_query.AddNumericalFilter(key, value, comp);
//var comp = (LobbyComparison)((int)comparison);
//_query.AddNumericalFilter(key, value, comp);
Copy link
Member

Choose a reason for hiding this comment

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

Same here with this commented out section.

Copy link
Author

Choose a reason for hiding this comment

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

Same comment as above. See the new merge (I'll push it in a bit)

return;
}

Debug.Log("member changed!!!");
Copy link
Member

Choose a reason for hiding this comment

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

If this is just to debug. Please remove this.


static LobbyMember() {
MessageProcessor = new LZFCompressor();
MessageProcessor = null;
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason this was removed?

Copy link
Author

Choose a reason for hiding this comment

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

Using LZFCompressor instantly crashes Unity. I'm not sure where it goes wrong so I just commented it out.

Copy link
Member

Choose a reason for hiding this comment

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

OK, that's a sign we have a memory access violation somewhere in our code. I think we can keep this for now, but please leave a TODO(james7132) comment to investigate this. The LZF compression is part of the reason why we have been able to keep our bandwidth usage low despite sending a network message basically every tick in Backroll.

@james7132
Copy link
Member

OK this looks good enough, sans the SendChatBytes change. This is just pending an updated Facepunch UPM package to merge this in.

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.

3 participants