Levels System Advice

Hello I am currently working on a game that includes multiple levels but because of the amount of levels I plan to add I made a system which moves maps from server storage to workspace and keeps the map active until no players on the server are using it.

For example:

Player A joins server and decides to play on level 6.

  • Level 6 loads into workspace

Player B joins server and decides to also play on level 6.

  • Level 6 is already loaded so player is just teleported

Player B leaves game or decides to play on different level

  • Nothing happens

Player A decides to play on a different level

  • No players left on level so level is destroyed and touch events disconnected

Everything in the level is being animated on the client and only the level the user is playing is animating no matter other levels loaded.

The reason I did this instead of handle it on the client is because I want touch events to be handled on the server so a client cannot just fire a remote to put themselves at the last checkpoint of a level and also because I have never really handled touched events on the client and am not sure if there will be any downsides in the future.

Despite this I’m still unsure whether to move my level manager system to the client so that all other levels people are playing are not visible to the client apart from their own current level which I imagine will improve performance.

So my question is does my current system to load and unload levels on the server actually make much sense for performance and discouraging exploiters or am I overthinking this?

It really depends on scale. I wouldn’t worry about focusing on refactoring it to be completely client-side unless you can gain something from it in terms of development (easier map design, don’t have to worry about the position of a map within the workspace, etc.) or absolutely have to for performance reasons. As is, the system will keep client RAM down, which is important for mobile, but the impact of this is heavily dependent on how much RAM your maps were taking up in the first place.

From a performance standpoint, selectively-replicating maps to clients and having clients unload the maps themselves when they aren’t needed is better, but it’s also much more annoying to manage; moreover, the benefits aren’t really realized unless you’re on a full server where everyone is on a different map.

From a security standpoint, the server-side hit detection really only matters if you have server-side physics simulations. If you’re only concerns with the players’ characters, they can just invoke the .Touched event on its own (I think, anyway, can someone verify this?) or teleport themselves to the checkpoints anyway.

1 Like

Thanks for the response. I realised while reading this that both ways of doing it have the same issues when it comes to security since yes they can just teleport themselves to a checkpoint but you can implement magnitude checks for both scenarios anyway. I think I will have to experiment and see what will be easier to work with.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.