Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer fixes and Improvments #809

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2cadbf3
Make Room Name Persistent.
sbanca Jan 5, 2025
91b99b8
Fix sync percentage tracking
sbanca Jan 6, 2025
0f0e15b
Spatialized Sound
sbanca Jan 11, 2025
7e85eba
Merge branch 'main' into multiplayer-fixes
sbanca Jan 12, 2025
83a7cc1
Fix positioning of the Speaker Prefab
sbanca Jan 12, 2025
13de82b
Merge branch 'multiplayer-fixes' of https://github.com/icosa-foundati…
sbanca Jan 12, 2025
502d3cd
Enhancing the Aesthetics of Sync Progress
sbanca Jan 12, 2025
83e8822
Update HMD Font
sbanca Jan 14, 2025
ff0fc39
Adjust Spatialized Audio
sbanca Jan 15, 2025
8c674bf
Merge branch 'main' into multiplayer-fixes
sbanca Jan 17, 2025
a7879bb
Prepare Remote Player List for Display
sbanca Jan 18, 2025
cd49bb8
Adding Room Options Pop Up Window
sbanca Jan 18, 2025
6968607
Apply .gitattributes normalization
sbanca Jan 19, 2025
1fc6efb
Adding dynamic Player List to the PopUpWindow
sbanca Jan 19, 2025
6ceebe2
Update MultiplayerAudioSourcesManager.cs
sbanca Jan 20, 2025
91f3ab4
Update MultiplayerAudioSourcesManager.cs
sbanca Jan 20, 2025
24ac381
Nickname
sbanca Jan 20, 2025
ab58699
Update MultiplayerPanel.prefab
sbanca Jan 20, 2025
3c1bd2a
Mute Unmute -> turn off local audio source
sbanca Jan 20, 2025
973e6ef
Max Players setting add to Multiplayer Panel
sbanca Jan 25, 2025
e8547c9
Show hide room settings button
sbanca Jan 25, 2025
23313a7
Transfer Ownership RPC Method
sbanca Jan 26, 2025
9aa3142
Mute/Unmute -> Toggle
sbanca Jan 26, 2025
8ac62df
Toggle View mode only
sbanca Jan 26, 2025
781d0e1
Update MultiplayerManagerEditor.cs
sbanca Jan 26, 2025
53f6d4d
Kick users
sbanca Jan 26, 2025
cdb6355
Mute All and View Only All
sbanca Jan 26, 2025
cf7f4d8
Update MultiplayerPanel.prefab
sbanca Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Assets/Editor/BrushLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ public static void AppendValidBrushString(BrushDescriptor brush, bool experiment
}

}
}
}
2 changes: 1 addition & 1 deletion Assets/Editor/ConvertNormalMaps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ private static bool RemoveConversion(string assetPath)
}
return true;
}
}
}
43 changes: 28 additions & 15 deletions Assets/Editor/MultiplayerManagerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class MultiplayerManagerInspector : Editor
{
private MultiplayerManager multiplayerManager;
private string roomName = "1234";
private string nickname = "PlayerNickname";
private string oldNickname = "PlayerNickname";
private bool isPrivate = false;
private int maxPlayers = 4;
private bool voiceDisabled = false;
Expand All @@ -25,7 +27,16 @@ public override void OnInspectorGUI()
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
GUILayout.Space(10);


roomName = EditorGUILayout.TextField("Room Name", roomName);
nickname = EditorGUILayout.TextField("Nickname", nickname);
if (nickname != oldNickname)
{
SetNickname();
oldNickname = nickname;
EditorUtility.SetDirty(target);
}
maxPlayers = EditorGUILayout.IntField("MaxPlayers", maxPlayers);

//State
string connectionState = "";
Expand Down Expand Up @@ -98,10 +109,10 @@ public override void OnInspectorGUI()

//Remote Users
string remoteUsersRegistered = "";
if (multiplayerManager.m_RemotePlayers != null && multiplayerManager.m_RemotePlayers.Count > 0)
if (multiplayerManager.m_RemotePlayers != null && multiplayerManager.m_RemotePlayers.List.Count > 0)
{
remoteUsersRegistered = "UserIds:[ ";
foreach (var remotePlayer in multiplayerManager.m_RemotePlayers)
foreach (var remotePlayer in multiplayerManager.m_RemotePlayers.List)
{
remoteUsersRegistered += remotePlayer.PlayerId.ToString() + ",";
}
Expand All @@ -116,19 +127,6 @@ public override void OnInspectorGUI()
EditorGUILayout.LabelField($"{remoteUsersRegistered}");
EditorGUILayout.EndHorizontal();

// Display and edit Nickname
GUILayout.Space(10);
EditorGUILayout.LabelField("Nickname", GUI.skin.horizontalSlider);
string currentNickname = multiplayerManager.UserInfo.Nickname;
GUILayout.Label("Nickname", EditorStyles.boldLabel);
string newNickname = EditorGUILayout.TextField("Edit Nickname", currentNickname);
if (newNickname != currentNickname)
{
ConnectionUserInfo updatedUserInfo = multiplayerManager.UserInfo;
updatedUserInfo.Nickname = newNickname;
multiplayerManager.UserInfo = updatedUserInfo;
EditorUtility.SetDirty(target); // Mark the target as dirty to apply changes
}


Repaint();
Expand Down Expand Up @@ -160,6 +158,21 @@ private async void ConnectToRoom()
}
}

private async void SetNickname()
{
if (multiplayerManager != null)
{

ConnectionUserInfo ui = new ConnectionUserInfo
{
Nickname = nickname,
UserId = MultiplayerManager.m_Instance.UserInfo.UserId,
Role = MultiplayerManager.m_Instance.UserInfo.Role
};
MultiplayerManager.m_Instance.UserInfo = ui;
}
}

private async void DisconnectFromRoom()
{
if (multiplayerManager != null)
Expand Down
80 changes: 80 additions & 0 deletions Assets/Editor/MultiplayerRoomOptionsPopUpWindowEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#if UNITY_EDITOR
using OpenBrush.Multiplayer;
using TiltBrush;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(MultiplayerRoomOptionsPopUpWindow))]
public class MultiplayerRoomOptionsPopUpWindowEditor : Editor
{
RemotePlayers remotePlayers = new RemotePlayers { };

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

MultiplayerRoomOptionsPopUpWindow popupWindow = (MultiplayerRoomOptionsPopUpWindow)target;

if (GUILayout.Button("Add Player"))
if (!Application.isPlaying)
AddPlayer(popupWindow);

if (GUILayout.Button("Remove Player"))
if (!Application.isPlaying)
RemovePlayer(popupWindow);

if (GUILayout.Button("Populate Players list"))
if (!Application.isPlaying)
RegeneratePlayerList(popupWindow);

}

private void AddPlayer(MultiplayerRoomOptionsPopUpWindow popupWindow)
{
if (popupWindow.m_playerGuiPrefab == null)
{
Debug.LogWarning("Player GUI Prefab is not assigned!");
return;
}

int newIndex = remotePlayers.List.Count > 0
? remotePlayers.List[remotePlayers.List.Count - 1].PlayerId + 1
: 0;

remotePlayers.AddPlayer(new RemotePlayer
{
PlayerId = newIndex,
Nickname = $"testPlayer{newIndex}",
});

}

private void RemovePlayer(MultiplayerRoomOptionsPopUpWindow popupWindow)
{
if (popupWindow.m_playerGuiPrefab == null)
{
Debug.LogWarning("Player GUI Prefab is not assigned!");
return;
}

int RemoveIndex = remotePlayers.List[remotePlayers.List.Count-1].PlayerId;

remotePlayers.RemovePlayerById(RemoveIndex);

}



private void RegeneratePlayerList(MultiplayerRoomOptionsPopUpWindow popupWindow)
{

if (popupWindow.m_playerGuiPrefab == null)
{
Debug.LogWarning("Player GUI Prefab is not assigned!");
return;
}

popupWindow.GeneratePlayerList(remotePlayers.List);
}
}
#endif
11 changes: 11 additions & 0 deletions Assets/Editor/MultiplayerRoomOptionsPopUpWindowEditor.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Assets/Editor/PanelLister.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ static void ListPopups()
Debug.Log($"{popupList}");
}

}
}
16 changes: 10 additions & 6 deletions Assets/Fonts/NotoSansCJK-Light SDF.asset
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: NotoSansCJK-Light SDF Material
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
Expand All @@ -17,6 +19,7 @@ Material:
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -70,9 +73,9 @@ Material:
- _OutlineWidth: 0
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 1
- _ScaleRatioB: 1
- _ScaleRatioC: 1
- _ScaleRatioA: 0.8333333
- _ScaleRatioB: 0.6770833
- _ScaleRatioC: 0.6770833
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
Expand Down Expand Up @@ -117,9 +120,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 71c1514a6bd24e1e882cebbe1904ce04, type: 3}
m_Name: NotoSansCJK-Light SDF
m_EditorClassIdentifier:
hashCode: 0
hashCode: 1416160341
material: {fileID: -3903529720270446558}
materialHashCode: 0
materialHashCode: -1938541483
m_Version: 1.1.0
m_SourceFontFileGUID: 501eea5417f248044ac830eb146b46cb
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: 501eea5417f248044ac830eb146b46cb,
Expand Down Expand Up @@ -38758,7 +38761,8 @@ Texture2D:
m_MipCount: 1
m_IsReadable: 0
m_IsPreProcessed: 0
m_IgnoreMasterTextureLimit: 0
m_IgnoreMipmapLimit: 0
m_MipmapLimitGroupName:
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_VTOnly: 0
Expand Down
9 changes: 6 additions & 3 deletions Assets/Fonts/Oswald-Bold SDF.asset
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: Oswald-Bold SDF Material
m_Shader: {fileID: 4800000, guid: 68e6db2ebdc24f95958faec2be5558d6, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 5
Expand All @@ -17,6 +19,7 @@ Material:
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
Expand Down Expand Up @@ -128,7 +131,8 @@ Texture2D:
m_MipCount: 1
m_IsReadable: 1
m_IsPreProcessed: 0
m_IgnoreMasterTextureLimit: 0
m_IgnoreMipmapLimit: 0
m_MipmapLimitGroupName:
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_VTOnly: 0
Expand Down Expand Up @@ -2897,8 +2901,7 @@ MonoBehaviour:
m_FontFeatureTable:
m_GlyphPairAdjustmentRecords: []
fallbackFontAssets: []
m_FallbackFontAssetTable:
- {fileID: 0}
m_FallbackFontAssetTable: []
m_CreationSettings:
sourceFontFileName:
sourceFontFileGUID:
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/CSharp/ColorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ public static class Colors
public static readonly Color lightpurple = new Color(0.75f, 0, 1, 1);
public static readonly Color fuscia = new Color(1, 0, 0.75f, 1);
public static readonly Color rose = new Color(1, 0, 0.05f, 1);
}
}
Loading
Loading