Where would I store a map to offload it on the client?

I understand this is a really basic question, But I can’t really think.
This game has 2 maps, Playground and Neighbourhood. You can only be in one at a time. I’d like to offload the one you aren’t in while you’re in the other. Where would I parent the map to to store it? Would replicatedstorage suffice? I would think there would be some client server hijinks but I’m not sure. Thanks

Yes,

ReplicatedStorage Can be Accessed by Both Server and Client which is quite beneficial. However on the Client, you cant access ServerStorage or ServerScriptService as they are only for Server Scripts to Access.


On the Other hand, ReplicatedFirst is for stuff you want to Replicate before anything


ReplicatedStorage Can be Accessed by Both Server and Client

That’s what I’m worried about, if say 20 players had the map in ReplicatedStorage, and it replicated to the Server, wouldn’t it cause some issues? Or am I overthinking it

Tbh, I think you are

It may be better to put Map Related items inside ServerStorage tho

If you allow only the server to do the reparenting and store the maps in ServerStorage then they won’t take up any client memory.

Then you can just clone/move them into the workspace when you need them and they’ll load to the client.
After you’re finished with the map you can just move it back to ServerStorage or delete it (if it was cloned).

If I had the Server do the parenting, then it would replicate it to all the clients, no? It’s for multiple players on either map. Think toontown or something. The only solution I can think of is parenting the map to nil on the client. The replicatedstorage solution is still making me doubtful - As it’s replicated.

ServerStorage is better for Storing Maps, Items, etc, Any changes by the Server will replicate to all Players, If you want it to be accessed by the Client or only be Replicated to one Player, then you use ReplicatedStorage, or workspace for the Client to access it,

Storing it in either ServerStorage, ReplicatedFirst, and ReplicatedStorage prevents the object from Rendering
(To put it simply, Anything that isn’t inside workspace, or a ViewportFrame wont Render Objects)

Small Ranting about the 'Workspace' Part

or workspace

workspace? But Clients cant run inside the workspace!

You are able to change the RunContext of the Script to Client

Oh I see, in that case you could have the server clone it to ReplicatedStorage when it’s needed and then the clients that need it parent it to the workspace and the clients that don’t need it delete it.

This means you don’t start rendering it, and only clients that need it will move it to the workspace while clients that dont need it will not incur any extra memory usage since it’s stored in ServerStorage and they have deleted the copy they don’t need in ReplicatedStorage.

2 Likes

Какой-то не понятной ерундой вы озабочены…

  1. Оптимизируйте карты, по максимуму заменив парты на меши.
  2. Раз карт всего две и активна только одна - сделайте из них модели и храните обе в… workspace одну под другой. Т.е. вторую держит под уровнем земли активной карты.
  3. Нет никакой разницы будет карта в ReplicatedStore или вне поля зрения в рабочей области игры. Нагрузка на ОЗУ клиента одинакова.
  4. При необходимости поменять карты местами через SetPrimaryPart можно сделать мгновенно и без каких либо задержек. В отличии от загрузки в Workspace из RS.
  5. Жертвовать удобством уже задержавшихся игроков в угоду тем кто, случайно вошёл - плохой моветон. Главное - удержание игрока, а не привлечение.
  6. Не зацикливайся на внешней составляющей - и игры ААА классы с супер-пупер графикой, сотнями спецэффектов и студийной озвучкой улетают в мусорку, если геймплей скучный.

Мой совет - сделай так чтобы работало. А уже об оптимизации стоит думать после того, как игроки будут. Оптимизация штука такая странная - ей всегда найдётся место. Да и сами игроки начнут подсказывать что стоит сделать лучше и на что стоит действительно обратить внимание. Особенно когда игроков будет достаточное количество. Вылезут, обязательно, такие нюансы о которых даже не задумываешься на этапе запуска игры. И если зациклится на шлифовке игры, то можно её никогда и не выпустить в свет.

You could parent the map to the players “PlayerGui”, it will be replicated to that client but not all the clients