CollectionService and StreamingEnabled - How do they work together?

I am trying to create a system of managing objects client-side and making it easy by using CollectionService instance tagging. However, because my team is trying to build a large world and a game that will run on mobile, we also believe we will need to use the StreamingEnabled feature. I was curious if any engineers would know how CollectionService instance added/removed signals would work with StreamingEnabled?

1 Like

When an object streams in, the GetInstanceAddedSignal will fire. When an object streams out, the GetInstanceRemovedSignal will fire. We used collection service with StreamingEnabled in our game VentureLand to load in destructible scenery around the player. Server-sided ‘Spawn’ parts would stream in/out which would then let the client know what should/shouldn’t be loaded.

13 Likes

I’m the one that implemented CollectionService. Smooth is right.

CollectionService’s GetTagged method is defined to return all of the instances with a tag in the current data model. With streaming, streamed-out parts don’t exist in the client’s data model, so they will not show up.

InstanceAddedSignal/InstanceRemovedSignal have the same semantics as GetTagged: they fire when an instance with the given tag is added or removed from the current data model, or of course when the tag is added or removed from an object already in the data model.

CollectionService and streaming actually make for a pretty good combination. It makes it easy to make sure your code is catching newly streamed objects and cleaning up on streamed out objects.

One thing to note though is if you tag a Model, model instances will never be streamed out. They will just have all the parts inside of them streamed out. This also means that if you have a PrimaryPart set, it can be nil sometimes.

11 Likes