Very Interesting Problem With StreamingEnabled

This problem seems to pretty obscure but I currently have this issue where in my framework I have a properties table for components, in this components properties table, I have something called “EntityCharacter”. Whenever a model like an npc or player’s character is added I set EntityCharacter to it’s character. Now the framework automatically replicates the EntityCharacter value to the client of all players.

Here’s the issue with streamingEnabled, when a player joins the character’s models are nil on the client since they aren’t streamed in. So when I go to replicate the server value with the character to the client, the client says “huh, yeah that doesn’t exist” and sets the EntityCharacter value to nil.

I’ve tried to think of multiple solutions but none of them work. The only solution I can think of is setting all the models to be persistent, which I rather not do because then there’s almost no reason for me to use streaming..

Other hacky solutions, are checking if a model gets streamed in on the client and checking if its entityCharacter has been set.

Ran into similar problems before, best way to solve it is when you replicate the server values to the client, if the instance exists you load normally. But if the instance isn’t streamed in yet, you need to just cache the data somewhere, and then load when the instance is available. So you’ll have to make a state replication module too probably where it keeps track of the components properties table, and then on the client when the corresponding instance is streamed in, you search that table for the values.

2 Likes

Sounds like a plan, I’ll try that out.

1 Like