So, I’m making a housing system for my game similiar to Meep City. On the server side I am creating the exterior of the houses including the doors that the players touch to teleport to the interior. When the player touches the door and teleports I send that player the data for the interior and teleport them some 10000 studs away and generate the interior at that place on the client side.
This works fine, but I don’t know how to make it so that the interior door “connects” to the exterior door so that when the player touches the interior door, that is created client side, they are teleported to the exterior door, which is created server-side.
Edit: I was able to successfully make this housing system, if anyone reading this is still stuck feel free to send me a PM.
I would suggest using a RemoteEvent which asks the server to teleport the player when they touch the door.
However, I think the house is more likely to be created on the server in games like this, and are just allocated a space when they’re created.
In my game, I keep track of players location as they move between rooms, so that when they touch a door to request a teleport, the server knows exactly where they’re coming from and where they want to go to. The server then verifies they’re allowed to visit the location and teleports them, otherwise, moves them away from the door and displays a message.
Are you sure? I feel like Meep City and Adopt Me utilizes client side creation of interiors, otherwise it would get insanely laggy with all the stuff to load. There’s no way all of that could be on the server at once…
So do you think that they just space out everybody’s interior 10000 studs away or something? Because I’m not sure how far I should distance people in my game when they go to separate interiors, like how far is far enough?
I’ve just had a look at the dev console in Meep City, and it looks like they store a copy of the houses in ReplicatedStorage, and only replicate them to the client when the client visits the house. This might mean that there is only one interior door, and the rest of the house is loaded around the door.
Each number after “StaticVirtualWorld” seems to represent the house ID.
Yup, that’s exactly how I’m replicating them to the client. When they touch a door, it checks if they can enter, if so, load interior. Then play teleport animation and teleport. Then the inverse when they leave. But what do you mean by there is only one interior door?
I’ve just looked at Adopt Me!'s console too, and I’m thinking that each style of house has its own bare interior as a physical object somewhere within the game, and all they’re doing is loading in the decorations and furniture when you enter the house.
So when the player touches the exterior door, they tell the server whose house they want to visit. The server checks which house model to teleport you to, and downloads the correct furniture for the other players house. When you leave the house, the furniture and decorations are removed again.
If you keep track of players’ locations on the server, you can easily figure out which exterior door to teleport them back to.
Okay that makes sense. Right now I have my doors set up in pairs, so each door basically has a partner. I just changed it so that the entire interior house replicates on the client EXCEPT for the interior door. That is created on the server with it’s exterior pair, so I don’t need to do some janky stuff to pair it back with the interior on the client with a Remote event. It seems like this will work, do you see any problems with doing it this way?
No it works perfectly! I’m just new to working with this client-server relationship so I’m always scared of doing something that might help exploiters or cause lag if I’m not doing it right.
I get that. As long as you make sure you perform adequate checks on the server, you shouldn’t really run into an issue with exploiters. They’ll always find ways to exploit the client, but you can make sure you keep the server secure by implementing things like permission checks; for example, my game has a list of locations stored on the server, some of which are Premium-only. If a user tries to teleport, it’ll check that they’re Premium before teleporting them; otherwise, it’ll just make their character walk away from the door and show the Premium prompt.
On a side note, Adopt Me looks like it has a custom handler for characters too, so that if there are multiple people in one house model, it’ll only show the other characters which have loaded the same house ID that you’re in.
I read this whole comment section, escpecially the posts by RipPull and it really helped me understand, but I’ve never tried exploiting in any game so there’s a lot I don’t undersstand to what they can do.
Years ago, exploiters could have control of the entire server, but since FE became a thing, it’s much harder for them to do anything outside of their own client, without asking the server for permission first. This is why it’s important that your server does the appropriate checks before allowing the client to do things.
In fact, my permission flow for teleports in my game is along the lines of the following (I’ll refer to the location they want to go to as “TO” and where they currently are as “FROM”):
function Controller.CanPlayerVisitLocation(Player, To, From)
Are they an owner of the group? If yes, allow.
Is there a door connecting TO and FROM? If not, decline.
Is the location marked as “Under Construction”? If yes, decline.
Is the location marked as “Open”? If not, decline.
Is the location a Premium-only location? If not, continue to #6.
5.1. Is the player a Premium subscriber? If not, decline.