Any alternative to streaming enabled?

Ive wondered if there is any alternative to streaming enabled.

For example i have a really huge map with many particles animations and instances (not fr). Ive heard streaming enabled isnt a great option. Are there any better alternatives for content streaming even anything custom or is streaming enabled the only choice.

There are some alternative solutions, but I think streaming enabled is pretty good. Also you can try Reduce Part Count: Simplify your models to use fewer parts and more efficient meshes.
Other ways include:

  • Manual Chunk Loading:
  • Divide the Map into Chunks: Manually divide your map into smaller chunks and load/unload these chunks based on the player’s position.
  • Proximity-Based Loading: Use scripting to load chunks when players are near and unload them when players move away.

2
Instance Management:

  • Deferred Loading: Delay the creation of non-essential instances, particles, and animations until they are needed.
  • Pooling: Use object pooling to reuse instances rather than creating and destroying them repeatedly
3 Likes

Im not really experienced with how to implement any rendering stuff, how would some of the code look?

This one doesn’t require any scripts.

To do the manual chunk loading:

  1. Divide your map into chunks and group each chunk in a Model.
  2. Use a script to load and unload these chunks based on the player’s position.

Step-by-Step Implementation

  1. Prepare Your Chunks:
  • Divide your map into separate Model instances, each representing a chunk. Name these models in a way that makes it easy to identify them (e.g., Chunk1, Chunk2, etc.).
  • Place all these chunk models under a Folder named Chunks in Workspace or a similar location.
  1. Script for Chunk Loading:
  • Create a Script in ServerScriptService to handle chunk loading and unloading based on the player’s position.

Script (You may need to edit this to work for your setup)

-- Place this script in ServerScriptService

-- Define the radius within which chunks should be loaded
local LOAD_RADIUS = 500

-- Reference to the Chunks folder
local chunksFolder = game.Workspace:FindFirstChild("Chunks")

-- Function to get distance between two positions
local function getDistance(pos1, pos2)
    return (pos1 - pos2).magnitude
end

-- Function to load chunks based on player's position
local function loadChunks(player)
    local character = player.Character
    if not character or not character:FindFirstChild("HumanoidRootPart") then return end
    
    local playerPosition = character.HumanoidRootPart.Position
    
    -- Iterate over each chunk
    for _, chunk in pairs(chunksFolder:GetChildren()) do
        if chunk:IsA("Model") then
            local chunkPosition = chunk.PrimaryPart.Position
            local distance = getDistance(playerPosition, chunkPosition)
            
            -- Load chunk if within load radius
            if distance <= LOAD_RADIUS then
                chunk.Parent = game.Workspace
            else
                -- Unload chunk if out of load radius
                chunk.Parent = nil
            end
        end
    end
end

-- Function to handle player character loading
local function onCharacterAdded(character)
    local player = game.Players:GetPlayerFromCharacter(character)
    
    if player then
        -- Connect to the RenderStepped event for continuous updates
        local connection
        connection = game:GetService("RunService").Stepped:Connect(function()
            loadChunks(player)
        end)
        
        -- Disconnect when player leaves
        player.CharacterRemoving:Connect(function()
            connection:Disconnect()
        end)
    end
end

-- Connect to the PlayerAdded event to handle new players
game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(onCharacterAdded)
end)

-- Handle players who are already in the game (reconnect if needed)
for _, player in pairs(game.Players:GetPlayers()) do
    if player.Character then
        onCharacterAdded(player.Character)
    end
end

This should get you started!

1 Like

I did this before for a map unloading system but it always caused some lag when cloning or parenting from server storage to workspace

How many parts in the model were you cloning? If there is a ton try to make them all into 1 meshpart

I couldve but it removes the whole purpose im trying to use content streaming. I needed it to be able to handle a ton of little grass and bush instances in my game.

How laggy is your game anyway? I understand for mobile devices it will be laggy, but I doubt for most laptops and computers it would. If it is just mobile I would recommend making an option for mobile users to decrease the lag by removing things from the map on their view.

Thats a good idea, I just want to know if streaming enabled is the best option for very detailed and large maps not exactly what im working on but just thinking ahead.

Yes it would be. The only downsides of streaming enabled is:

    • It can require more complex scripting to handle the dynamic loading and unloading of parts, especially if your game has specific requirements for certain parts always being loaded.
  • Potential Delays:
  • There may be slight delays as parts of the map are loaded, which can affect gameplay if not managed correctly.
  • Compatibility:
  • Not all game mechanics may work seamlessly with StreamingEnabled, especially if they rely on certain parts of the map being loaded at all times.

I believe in your case it should work just fine.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.