Custom Streaming System

I’m trying to reduce memory usage in my game, and with the way it’s structured it parents planets in and out of the workspace, parenting them to a folder in replicated storage when not in use. This works fine for visuals, but I’d like to be able to destroy the planets that aren’t being used and load them back from the server when the player goes to the planet to reduce memory usage. StreamingEnabled wouldn’t work, just because I don’t want it loading a planet whenever the player flies close to it, and I’d like your current planet to stay visible.
Are there any ways to emulate streaming but have more control over it? Is there a module that packs instances in a table that can then be sent in a remote, or some way I can send instances through some network pipe or remote?
If there aren’t any already made solutions, is there some way I would be able to get all properties of an instance; such as an Instance:GetProperties() function that returns a table of all the instance’s properties?

4 Likes

Excuse my bump here, but I created a solution: Instance To Table - Roblox
This module allows for instances that don’t exist on the client (or in some cases on the server) to be sent across the network. It is not complete, so as of now it is missing some key features I would eventually like to be able to add, such as being able to send instance properties (adornee, primaryPart, objectValue values, etc). Some limits that roblox has prevent this module from doing some things, such as not being able to write to MeshId on meshparts, setting a script’s source, and not being able to get any assetId for unions.
Documentation is inside the module in a large comment at the top.
I have used it and my memory usage went down ~35MB because of streaming planets in and out, instead of simply parenting to the folder in replicatedstorage.
Hopefully this is able to be of use to someone else, and please PM me if there are issues with it.

2 Likes