Rockenite
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 1444 |
|
|
| 09 Aug 2017 10:30 AM |
I am making a house system for a game that will be FE. I thought to reduce lag I could take advantage of the lack of replication of changes from one client directly to another by creating the models of the house in a local script itself so it only loads for the clients I want it to. This way the house wouldn't exist on the machines of the other players who aren't in the house, reducing lag for them.
My problem is how exactly can I go about this? Given a model or a group of models in server storage, how do I send information about how to recreate this model to the client so that the client can load the house for itself, rather than having a server script cloning the house to the workspace directly so that it's visible on all clients?
Could I pass instances as arguments directly in remote events/functions? Or would I have to send all the information about the house I want to load (i.e. all the positions, rotations (CFrames) of all the parts in each model) and send all those into the client via arguments through a remote event/function, which the local script would use .Instance.new() on?
Thanks in advance for your help.
|
|
|
| Report Abuse |
|
|
|
| 09 Aug 2017 10:36 AM |
"Could I pass instances as arguments directly in remote events/functions" That doesn't work. You need to put them in ReplicatedStorage instead. Don't bother with security, because when someone has the house loaded, they can steal it. It's that easy, don't bother with security for something this trivial anyways. The odds someone's game will get popular because they copied a house from someone else is very small.
|
|
|
| Report Abuse |
|
|
Rockenite
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 1444 |
|
|
| 09 Aug 2017 10:42 AM |
Thanks for your response.
I am not bothered about security for this. I am doing it this way to reduce lag.
If the model is in replicated storage, this means clients can access it but does it also mean the parts/instances are loaded in the game? Or does replicated storage make it so I can have it load only for specific players and not for others?
Basically what I'm asking is if I had a 100k brick model (not saying I do but using an extreme example) and a local script cloned this into workspace, would that model only lag the client whose local script did that or would the whole server be lagging simply due to it being in replicated storage?
|
|
|
| Report Abuse |
|
|
|
| 09 Aug 2017 10:48 AM |
It means the data is loaded, but they won't be simulated, rendered, or updated. Basically, the machine knows what it is but ignores it. It's just a stack of papers in the corner that doesn't stress you out, because they're unimportant. It's there, but it doesn't make a difference. It will take up a bit of memory, yes, but I'm quite certain that Roblox will be able to handle it - especially if you're going to load it in anyways.
|
|
|
| Report Abuse |
|
|
Rockenite
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 1444 |
|
|
| 09 Aug 2017 10:51 AM |
Ah, okay. Thank you. And just one last question, would it be worthwhile in terms of reducing lag to do it that way as opposed to just having a server script clone it into the server for all clients?
|
|
|
| Report Abuse |
|
|
|
| 09 Aug 2017 10:54 AM |
It would indeed be much better on performance, and the more players you have, the worse the alternative is. Fifteen players with houses means 1.5 million parts, according to your figures. Everyone only loading their own house makes it much smoother. Even if you also loaded and synchronised your friends houses, it would still be better.
|
|
|
| Report Abuse |
|
|
Rockenite
|
  |
| Joined: 20 Dec 2011 |
| Total Posts: 1444 |
|
| |
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 11:23 AM |
Also you can clone the house in ReplicatedStorage and make it local, and then delete the house in ReplicatedStorage so it doesn't take up any more memory. This way you already had the memory you started with.
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|
|
| 09 Aug 2017 11:26 AM |
@S3vvy I think simply parenting the house to workspace would save time
|
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 11:26 AM |
Another alternative is using InsertService. This will remove the use of any other service or memory and you can insert your house locally without the other players seeing it.
But then again, you'll have to create some sort of efficient/compatible system with inserting models into your game, which I don't think should be a problem.
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 11:30 AM |
@Extreme
He's aiming for local parts with the lowest lag possible. Even if parent to workspace was "faster", which I don't think it is, the difference would be in a minuscule amount. It would also be SUPER slow especially if there are other players who would have to render the house for no reason at all. So no, I don't think it would be faster.
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 11:31 AM |
And even if they didn't have to render it, the house would still be in their memory for a short while, maybe causing a lag spike if it was a lot of parts to load.
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|
Exzeption
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
|
| 09 Aug 2017 11:56 AM |
he means parent it locally
|
|
|
| Report Abuse |
|
|
|
| 09 Aug 2017 12:03 PM |
"So no, I don't think it would be faster." "And even if they didn't have to render it, the house would still be in their memory for a short while"
What you said refers to your own post, not his. Cloning and deleting means the deleted parts stay in memory for a while, on top of forcing the allocation and de-allocation of RAM, whereas parenting it keeps the memory intact and doesn't have to allocate or de-allocate anything.
|
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 01:46 PM |
@Jarod
Where is your source that says deleting instances takes up more memory?
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|
s3vvy
|
  |
| Joined: 24 Feb 2011 |
| Total Posts: 983 |
|
|
| 09 Aug 2017 01:49 PM |
@Jarod
Also:
" "And even if they didn't have to render it, the house would still be in their memory for a short while"
What you said refers to your own post, not his."
You're clearly confused. Cloning something with a local script doesn't replicate it to other clients. Hopefully you knew that.
Subscribe for scripting tutorials and more videos! www.youtube.com/c/SPiNClan |
|
|
| Report Abuse |
|
|