Storing many maps in Server Storage opinions?

Hey everyone!
Whats your opinions about this procedure?

Looking to have multiple maps in the same place and not using teleporting to other places.
Maps are stored in ServerStorage, Server scripts will bring each one depending on votes.
The previous map is sent back to ServerStorage, the new map is pulled out from SS and placed in Workspace.

The maps are not big, but, contains many details, parts and meshes

Questions:
1- Because the old map gets removed from workspace, all conections to parts from Core systems in ServerScriptService are lost right?, so should I reconnect the systems again when “placing map” event occurs?

2- About the loading time of all assets from maps, this will cause issues? Sending the map back to SS and bringing a new one, once each 2 or 3 mins.

3- Loading the map part by part or folder by folder could make any difference? instead of just placing one folder containing the whole map into workspace?

4- Separating the maps in the place? Like placing map1 at position 0,0,0 and map2 thousands of studs away, forgeting about bringing the map from ServerStorage, and just let them all to exist in game, just very far from each other, could do a better job than the other approach?

5- Any opinion is useful for me, any different approach I could use?

If you have all of the maps in the workspace then they will all need to replicate at once for each client. It’s better to only have a single map loaded at any given time such that only that map will need to replicate for each client. Instances stored inside the “ServerStorage” folder will never replicate to any client.

1 Like

Those maps exists as small data, isnt? key values and stuff, but has no impact on rendering and lag issues related to that, cause players are very far from the other map, enough to not load any rendering from those parts, or not?

Feel free to do that, Roblox Servers are powerful enough to unload and load big maps. Having all maps stored in the workspace might lag out low end devices.

To prevent memory leaks you can store all “map-connections” in a table. And disconnect them by using :Disconnect() on every connection stored in the table. (Remember to clear the table after).

As mentioned above, roblox servers should be powerful enough. Separating the map into (eg.) 5 pieces might keep the ping low. Example

function loadMap(map,destination)
    local pieceSize = #map:GetChildren() / 5
    for partId,mapPart in pairs(map:GetChildren())
        local currentMapPart = mapPart:Clone()
        currentMapPart.Parent = destination

        if partId / pieceSize = math.floor(partId / pieceSize) then
            wait(0.25)
        end
    end
end

function destroyMap(map)
    local pieceSize = #map:GetChildren() / 5
    for partId,mapPart in pairs(map:GetChildren())
        mapPart:Destroy()

        if partId / pieceSize = math.floor(partId / pieceSize) then
            wait(0.25)
        end
    end
end

Prevents the server from crashing or timeouting, similar to the functions I just sent.

Everything in the workspace is inside the render pipeline of roblox (as far as I know). Placing them thousands of studs away from each other might cause floating point (Floating Point Numbers - Computerphile - YouTube) issues.

Those are the only options I could think of. Of couse you could make a more advanced system with Instance:GetDescendants(), but remember to parent all the stuff correctly!

2 Likes

Thank you so much for your reply, that info is very useful!

I was planning on handling the connections with a table, yup, its gonna be very handy, its a lot to add… but, in that way its gonna work better

Its a great idea splitting the map in that way (the script you sent). Its a better idea to Clone() the part instead of just reparenting it to workspace?
Well its possible some parts will be destroyed during the round… I cant remember right now, but maybe yes, its better to Clone()

A doubt I have with your code. If the map contains humanoids, and I place part by part on a loop, if the humanoid gets “splitted” due to the loop behaviour? I guess its motors will break… Well thats something I should fix when building this, checking each assets handling/placing.

I see that you suggest Destroying() the map in the same way that you cloned it and parent it. I will follow your idea in order to not cause crashing or timeout.

Extremely useful to know, thank you so much!

Could you elaborate briefly? A small explanation will work, no need to send code.
By getting the Descendants of what? should I bring or destroy the map’s parts?

What’s the problem in storing it in ServerStorage? It’s a storage and your best bet.

1 Like

Whew, it strongly depends. Having some flashbacks to my Accelerator project… we stored all our maps in ServerStorage and that bloated our file size to a couple GB (~36?) and caused publishing failures 100% of the time. Engineers told us we had to fragment across several places. A nightmare that was.

ServerStorage is good until you have way too much in it. :joy:

3 Likes

yeah. I think my idea (which is very dumb but might work) is to serialize a map into a table and deserialize it (load it)

That’s just my idea lol.

Also mind sending me a rbxm file of those huge maps? I wanna try out my idea with those maps

Prerendered instances would be very angry. Terrain data (exception: you describe every cell, which would be painful, so please don’t!), MeshParts (can’t write MeshId at run time), anything to do with PBR… mostly would only work for primitives. Ultimately not too scalable especially for detailed maps.

Not a bad idea for certain things though, but maps probably isn’t the one you want to do it for.

2 Likes

yeah your right, my another idea is to use multiple services for map storing(lol, but also terrible idea I think)

I have the best idea. Just put multiple maps in workspace, in different locations and to players tp a random one

Might lag lower end devices but streaming enabled might handle that.

That thing you guys experienced, its very useful info for me right now, thank you so much.
Looks like its really important to handle this carefuly for me in near future