Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
using DCL.Multiplayer.Profiles.BroadcastProfiles;
using DCL.Multiplayer.Profiles.Entities;
using DCL.Multiplayer.Profiles.Poses;
using DCL.Multiplayer.Profiles.RemoteAnnouncements;
using DCL.Multiplayer.Profiles.RemoteProfiles;
using DCL.Multiplayer.Profiles.Tables;
using DCL.Multiplayer.SDK.Systems.GlobalWorld;
using DCL.Navmap;
Expand Down Expand Up @@ -443,6 +445,11 @@ static IMultiPool MultiPoolFactory() =>

var messagePipesHub = new MessagePipesHub(roomHub, MultiPoolFactory(), memoryPool, islandThroughputBunch, sceneThroughputBunch, chatThroughputBunch);

var remoteMetadata = new DebounceRemoteMetadata(new RemoteMetadata(roomHub, staticContainer.RealmData, bootstrapContainer.DecentralandUrlsSource));

var remoteAnnouncements = new RemoteAnnouncements(messagePipesHub);
var remoteProfiles = new RemoteProfiles(profilesRepository, remoteMetadata);

var roomsStatus = new RoomsStatus(
roomHub,

Expand Down Expand Up @@ -471,7 +478,7 @@ static IMultiPool MultiPoolFactory() =>

var worldAccessGate = new PrivateWorldAccessHandler(worldPermissionsService, mvcManager, staticContainer.RealmData);
var realmNavigatorContainer = RealmNavigationContainer.Create
(staticContainer, bootstrapContainer, lodContainer, realmContainer, remoteEntities, globalWorld, roomHub, terrainContainer.Landscape, exposedGlobalDataContainer, loadingScreen, placesAPIService, worldAccessGate);
(staticContainer, bootstrapContainer, lodContainer, realmContainer, remoteEntities, remoteAnnouncements, remoteProfiles, globalWorld, roomHub, terrainContainer.Landscape, exposedGlobalDataContainer, loadingScreen, placesAPIService, worldAccessGate);

IHealthCheck livekitHealthCheck = bootstrapContainer.DebugSettings.EnableEmulateNoLivekitConnection
? new IHealthCheck.AlwaysFails()
Expand Down Expand Up @@ -649,8 +656,6 @@ await MapRendererContainer
// Configure proxies for scene-side masked emote system
staticContainer.EmotesMessageBusProxy.SetObject(multiplayerEmotesMessageBus);

var remoteMetadata = new DebounceRemoteMetadata(new RemoteMetadata(roomHub, staticContainer.RealmData, bootstrapContainer.DecentralandUrlsSource));

var characterPreviewEventBus = new CharacterPreviewEventBus();
var upscaleController = new UpscalingController(mvcManager);

Expand Down Expand Up @@ -780,6 +785,8 @@ await MapRendererContainer
entityParticipantTable,
messagePipesHub,
remoteMetadata,
remoteAnnouncements,
remoteProfiles,
staticContainer.CharacterContainer.CharacterObject,
staticContainer.RealmData,
remoteEntities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ private void OnMessageReceived(ReceivedMessage<AnnounceProfileVersion> obj)

public Bunch<RemoteAnnouncement> Bunch() =>
new (list);

public void Reset()
{
list.Clear();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ public bool NewBunchAvailable() =>
public Bunch<RemoteProfile> Bunch() =>
new (remoteProfiles);

public void Reset()
{
foreach (var kv in pendingProfiles)
kv.Value.Cts.SafeCancelAndDispose();

pendingProfiles.Clear();
remoteProfiles.Clear();
}

private async UniTaskVoid TryDownloadAsync(RemoteAnnouncement remoteAnnouncement)
{
URLDomain? lambdasEndpoint = remoteMetadata.GetLambdaDomainOrNull(remoteAnnouncement.WalletId);
Expand Down Expand Up @@ -107,8 +116,11 @@ private async UniTaskVoid TryDownloadAsync(RemoteAnnouncement remoteAnnouncement
if (profile is null)
return;

// Take the room source from the dictionary as the value could be updated
remoteProfiles.Add(new RemoteProfile(profile, remoteAnnouncement.WalletId, pendingProfiles[remoteAnnouncement.WalletId].FromRoom));
// Reset() may have cancelled and cleared pendingProfiles while we were awaiting.
if (cts.IsCancellationRequested || !pendingProfiles.TryGetValue(remoteAnnouncement.WalletId, out PendingRequest currentRequest))
return;
Comment thread
lorenzo-ranciaffi marked this conversation as resolved.

remoteProfiles.Add(new RemoteProfile(profile, remoteAnnouncement.WalletId, currentRequest.FromRoom));

ReportHub.Log(ReportCategory.PROFILE,
$"{remoteAnnouncement} was downloaded for {(DateTime.Now - startedAt).TotalSeconds} s.");
Expand Down
10 changes: 8 additions & 2 deletions Explorer/Assets/DCL/PluginSystem/Global/MultiplayerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public class MultiplayerPlugin : IDCLGlobalPlugin<MultiplayerPlugin.Settings>
private readonly IRealmData realmData;
private readonly IRemoteEntities remoteEntities;
private readonly IRemoteMetadata remoteMetadata;
private readonly RemoteAnnouncements remoteAnnouncements;
private readonly RemoteProfiles remoteProfiles;
private readonly IRoomHub roomHub;
private readonly RoomsStatus roomsStatus;
private readonly IScenesCache scenesCache;
Expand All @@ -81,6 +83,8 @@ public MultiplayerPlugin(
IEntityParticipantTable entityParticipantTable,
IMessagePipesHub messagePipesHub,
IRemoteMetadata remoteMetadata,
RemoteAnnouncements remoteAnnouncements,
RemoteProfiles remoteProfiles,
ICharacterObject characterObject,
IRealmData realmData,
IRemoteEntities remoteEntities,
Expand All @@ -104,6 +108,8 @@ public MultiplayerPlugin(
this.entityParticipantTable = entityParticipantTable;
this.messagePipesHub = messagePipesHub;
this.remoteMetadata = remoteMetadata;
this.remoteAnnouncements = remoteAnnouncements;
this.remoteProfiles = remoteProfiles;
this.characterObject = characterObject;
this.remoteEntities = remoteEntities;
this.realmData = realmData;
Expand Down Expand Up @@ -141,11 +147,11 @@ public void InjectToWorld(ref ArchSystemsWorldBuilder<Arch.Core.World> builder,
DebugThroughputRoomsSystem.InjectToWorld(ref builder, roomHub, debugContainerBuilder, islandThroughputBufferBunch, sceneThroughputBufferBunch);

MultiplayerProfilesSystem.InjectToWorld(ref builder,
new RemoteAnnouncements(messagePipesHub),
remoteAnnouncements,
new LogRemoveIntentions(
new ThreadSafeRemoveIntentions(roomHub)
),
new RemoteProfiles(profileRepository, remoteMetadata),
remoteProfiles,
profileBroadcast,
remoteEntities,
remoteMetadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using DCL.LOD.Systems;
using DCL.Multiplayer.Connections.RoomHubs;
using DCL.Multiplayer.Profiles.Entities;
using DCL.Multiplayer.Profiles.RemoteAnnouncements;
using DCL.Multiplayer.Profiles.RemoteProfiles;
using DCL.PerformanceAndDiagnostics.Analytics;
using DCL.PlacesAPIService;
using DCL.PrivateWorlds;
Expand Down Expand Up @@ -38,6 +40,8 @@ public static RealmNavigationContainer Create(
LODContainer lodContainer,
RealmContainer realmContainer,
RemoteEntities remoteEntities,
RemoteAnnouncements remoteAnnouncements,
RemoteProfiles remoteProfiles,
World globalWorld,
IRoomHub roomHub,
ILandscape landscape,
Expand All @@ -53,7 +57,7 @@ public static RealmNavigationContainer Create(
var realmChangeOperations = new AnalyticsSequentialLoadingOperation<TeleportParams>(staticContainer.LoadingStatus, new ITeleportOperation[]
{
new RestartLoadingStatus(),
new RemoveRemoteEntitiesTeleportOperation(remoteEntities, globalWorld),
new RemoveRemoteEntitiesTeleportOperation(remoteEntities, remoteAnnouncements, remoteProfiles, globalWorld),
new StopRoomAsyncTeleportOperation(roomHub, LIVEKIT_TIMEOUT),
new RemoveCameraSamplingDataTeleportOperation(globalWorld, exposedGlobalDataContainer.ExposedCameraData.CameraEntityProxy),
new ClearWorldsCacheTeleportOperation(placesAPIService),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
using Arch.Core;
using Cysharp.Threading.Tasks;
using DCL.Multiplayer.Profiles.Entities;
using DCL.Multiplayer.Profiles.RemoteAnnouncements;
using DCL.Multiplayer.Profiles.RemoteProfiles;
using System.Threading;

namespace DCL.RealmNavigation.TeleportOperations
{
public class RemoveRemoteEntitiesTeleportOperation : TeleportOperationBase
{
private readonly IRemoteEntities remoteEntities;
private readonly RemoteAnnouncements remoteAnnouncements;
private readonly RemoteProfiles remoteProfiles;
private readonly World globalWorld;

public RemoveRemoteEntitiesTeleportOperation(IRemoteEntities remoteEntities, World globalWorld)
public RemoveRemoteEntitiesTeleportOperation(IRemoteEntities remoteEntities, RemoteAnnouncements remoteAnnouncements, RemoteProfiles remoteProfiles, World globalWorld)
{
this.remoteEntities = remoteEntities;
this.remoteAnnouncements = remoteAnnouncements;
this.remoteProfiles = remoteProfiles;
this.globalWorld = globalWorld;
}

protected override UniTask InternalExecuteAsync(TeleportParams teleportParams, CancellationToken ct)
{
// Drop in-flight profile downloads and queued announcements from the previous realm must so they don't appear as ghosts
Comment thread
lorenzo-ranciaffi marked this conversation as resolved.
Outdated
remoteAnnouncements.Reset();
remoteProfiles.Reset();
remoteEntities.ForceRemoveAll(globalWorld);
return UniTask.CompletedTask;
}
Expand Down
Loading