How is using the client to handle certain things beneficial in terms of server memory? What things can be done?

I am trying to create a game but I want it to be as memory efficient as possible. As it being quite a large game, I’m worried that the server will use too much memory and be “laggy”.

For example, in this tweet, you can see how Belzebass saved 1GB of server memory, simply by switching to the GUIs being cloned from ReplicatedStorage to PlayerGui.

This got me thinking: what other ways could this be done?

I know Phantom Forces for example, handles a lot of things from the client and makes the game a lot smoother and easy to run. StyLiS Studios’s expertise in networking is absolutely phenomenal and I can only look up to them and applaud.

However, what other ways could we save memory? I thought, perhaps loading in maps from the client, rather than the server? Who knows!

In a game I’m developing, one of the things we have is a timer. So, instead of creating a loop counting down in the server, I merely used kept an IntValue in ReplicatedStorage with the value of os.time() 10 minutes into the future for example. Then, from the client, I calculate the change in time. I believe this to be more efficient than using .Changed(), however I can’t be sure to be honest.

Anyway, what are your thoughts? I want to hear what tricks developers out there are using to make their games run smoothly and save as much memory as possible.

Use the client when handling events that don’t have to be done on the server. Make sure your whole game isn’t based on LocalScripts. They’re only a good idea to reduce stress on the server and rely on the Local Memory to function, a good idea for doing things that’ll only affect a certain player.

The thing you said about the timer:

The server is the one who creates the time being 10 minutes into the future. The round ends when the server says so and the timer is only there for cosmetic/design purposes. It’s merely a little informational UI. If an exploiter were to change the value, it would affect them and them only. The round would still end at the same time and everyone else in the server would still see the clock correctly.

What do you think of loading a map from the client and do it on all clients? Do you believe this could optimize performance or should I clone it from the server? That way the server only has to keep in the memory the map in replicated storage and not the one in workspace, whereas the client handles both. Does that make any sense? Haha.

I don’t know, I’m not very experienced and aren’t sure what a difference it would make but I’m learning and hope to become better with time. Thanks for your input :slight_smile:

Alright, the timer’s safe and sound.

Depending on if the map is big or not, it can be a hard time for the players to load everything on their own. Plus, there are people on mobile and those on lower end computers that can have a hard time with all these things running on their device. Like I said before, maintain a perfect balance. There’s also client memory. You shouldn’t raise that up too high either. That’ll be better for memory than cramping everything into the client!