So for example, sliding draws, sliding doors, elevators, etc. I’ve gotten good at using prismatics now so I was thinking, isn’t it a better idea to use these over tweens? Because with tweens you gotta do fireallclients from the server otherwise it’ll be slow, and then you’re calling fireallclients. Over and over and over again which could cause pressure. Especially if its a E to slide Door for example. Also with the elevator example the prismatic would add weight to the elevator and it’s also more stable. Tweens don’t rely or respect physics, so an elevator would lead to alot of bugs I assume.
By the way I’m only going to be using the prismatics for sliding, I will still need tweens for other things you know.
Roblox’s physics constraints are great when you’re trying to, well, simulate physics. If you want a realistic elevator, that gets weighed down when you put heavy items in it, then sure. But for most cases, a tween is better.
This is for numerous reasons:
-
Tweens take up less network resources
Just because constraints don’t require any action on your part to replicate to clients doesn’t mean it has no network cost. In fact, they have more network cost,. Instead of a simple event telling clients that the door has closed, it now has to replicate the exact position of the door. Constantly. -
Constraints, obviously, are bound by physics
Sometimes, accurate physics simulation is a bad thing. While Roblox’s physics engine has gotten better, it is not infallible. It will break sometimes. Tweens ignore physics and keep moving. So, if a player puts something in the elevator shaft, for example, a constraint-based elevator would break and a tween-based elevator would clip through the object. This would probably lead to the object either being flinged to oblivion or inside the elevator, but regardless, the elevator remains functional. -
And being bound by physics, players can exploit the system
Roblox distributes the task of simulating physics to players to save server resources. This is even after FilteringEnabled. This means an exploiter could, in theory, break the elevator if the server lets it simulate the elevator’s physics. There is probably a setting to stop this, but I’m not sure.
Using tweens for platforms shouldn’t be a problem if you tween one Anchored Part and Weld all the Parts that a player would be touching (the CanCollide Parts) to the tweened Part. Unanchored Parts follow physics.
Before tweens were released I used Prismatics pretty well for elevators.
You may notice some lag when other people get on because the server is running the Prismatic and each player’s Position is updated from the server to the client & back to the server when other people view your avatar.
Yeah I know tweens have some advantages I guess, but i’m sure there’s a way to prevent the exploiting thing. Like using setnetworkownership or something.
I’m pretty sure you can counteract this by just using customphysicalproperties which is what I did for the elevator, I gave the elevator alot of density to give it more mass. You could also just you know, anchor the part that its sliding on. Although that would be less realistic because no added weight, you could do that. And it would still slide. Also with a tween elevator I’m pretty sure I made one when I was new into scripting and just learnt about tweens and I saw the players easily clip through and fall.
So I guess I learnt prismatics for nothing. Well that’s great. One constraint down, and it wasn’t even useful.
I’d also like to give an honorable mention to another possibility: a fake elevator.
As you mentioned,
Both methods have downsides, because both methods use physics in some way. The elevator, being controlled by a tween but interacted with by physically simulated objects (players), may lead to unexpected results.
But if your players can’t actually see the elevator from outside, why actually make the elevator move?
From a player perspective, nobody except an exploiter is going to know that the elevator isn’t actually moving, You can simulate the experience of an elevator going up and down, but with none of the physics trouble, by simply teleporting players around.
Of course, you’ll still need to animate stuff like the doors sliding. You’ll have to use a prismatic constraint or a tween—no trickery allowed. And this doesn’t work if players have to see the elevator moving up and down, perhaps because it’s a fancy glass elevator or something.
I’m pretty sure doors does this but, I gotta move the elevator. No ifs or buts, I have to 100%. Unlike doors they can just get away with it since they just spawn the player on the elevator after the player get’s teleported and the floor is right on it. But, my elevator is for a lobby. They need to actually move from floor 1 to floor 2.
By the way I’m refering to the game DOORS if you’ve seen it before.
You can also just kinda tell, the player can feel the moving. Well you can’t but I think yk what I mean.
I presume you are talking about the subtle lighting glitches that happen in moving objects. If you are insistent on having it move, then I suppose you’ll just have to decide whether a constraint or a tween is right for you.
Keep in mind that teleportation doesn’t necessarily mean you have to break immersion for everyone. The doors can still close, and players can still have to wait for the “elevator” to come to their floor—it’s just that the “elevator” doesn’t really exist. Players won’t notice if the elevators are identical, and they are teleported to the same place inside the elevator.
Problem is though, I’m not allowed to do work-arounds on the elevator thing. I’m doing a horror game for a commission and, gotta add a real one. The hirer said specifically he wants a real one.
In that case, I would present these two options (constraint vs tween) with their pros and cons and ask them to pick one.
If they don’t care, I would do whatever is more accurate. If you aren’t paid enough to care, I would do whatever is easier. In both cases, a constraint is probably the best choice.
Prismatics work well for physics based items. Take a couple of friends to my Yeah, steampunk… place and try out the elevators there. As @uvic1rn said, if your elevator is visible from the outside (mine are cages on sloped sliding rails) you’ll need to actually make them move.
All 3 elevators are prismatic based, as are their sliding doors.
I did add a couple of seats to keep players from lagging due to the server/client/server lag, but you don’t have to sit and can still move around on them on your client. They are very smooth. If you have another player moving riding on the same elevator as you their avatar will appear a little twitchy.
Wanted to try it but it was too laggy, but I did get to try the sliding doors and it was cool. (not the prismatics the actual game was lagging idk why)
There’s a lot of stuff going on there.
My computer and phone will play it but they’re both only a couple years old. If you have a lower end device it may lag for you.
The thing is, it’s not a lower end device. So I’m not sure. I have a gaming PC.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.