Now, I am a 100% sure that lag is one of the most common problems and struggles a developer/Builder usually has. Throughout the years I’ve been told been told by people to avoid making my places laggy by using Unions, adding fewer parts and models as well as avoiding very basic mistakes like accidentally duplicating something over and over again. Though I’ve tried my best to follow these very basic tips, It’s still been a real battle to “not make my places lag” especially for me, since I love putting a lot of detail into my builds.
My question is though:
How do I fix a place that already is pretty laggy and make sure it actually can handle around 25-50 People on a server without crashing?
I have this issue with my most important and recent project.
As you can see there are a lot of detailed structures in this place as well as an entire terrain built with bricks. I’d appreciate if you could give me your tips on how to effectively reduce lag at my place.
This is also partly because its such a huge Issue every developer has to go through.
Shift + F2 and Ctrl + F6 - Ctrl + P are your friends.
After having played it for a couple if minutes I can confidently say that the castle in the back is the source of your performance problem, too many triangles are drawn when looking in that direction and people with weaker computers will suffer from it.
Reducing the amount of triangle-heavy unions/meshes in the castlearea would help a lot.
For action gameplay, usually by using client side prediction and server side lag compensation.
If your server straight up crashes you’re using too much RAM.
If your framerate is low then the things you can do to speed it up are turning on StreamingEnabled, using simple meshes instead of objects composed of a lot of smaller meshes/parts, reduce the number of moving parts, using multiple of the same object instead of multiple different objects (instancing), reducing the number of triangles in meshes, and getting a better device to run the game on.
Lag most of the times is careless use of remotes. Example:
When you press the “F” key, the character punches.
The bad approach: firing to the server when the F key is pressed and the server does the punch.
This approach results in latency which to most players appears as lag.
In order to combat this bad approach, you can make it so that when the F key is pressed, animation and sounds are played in the client (to tell the player his input was taken immediately and seem like no lag) and fire to the server for the Hitbox damage.
That way, this careless event usage is solved.
However, this is just one scenario of seemingly Lag. Lag can still occur for more basic reasons such as loads of parts, etc.
some players combat this by making their map load in chunks over a distance, that way not the whole map is currently loaded, only what you need at that time.
First thing is to diagnose it. If the servers slow to a grind and crash you’re running out of RAM. If it’s sudden, report it to Roblox as a bug. For even more details press F9 in game, then go to the memory usage tab.
Actually they load geometry (structure) of meshes, but they’re pretty “standard” I don’t think meshes contribute too much of the in game lag although it will delay the loading of the game, meaning some devices and old computers will not be able to enter.
Hey! One really helpful thing I discovered is if there are parts that don’t need collision, disable CanCollide. If you have stuff that the player won’t be able to reach, by disabling collision to it, the engine won’t bother generating the collision surfaces for it, and would only focus on rendering it. Sacrifice unneeded detail whenever possible. Like others say, use meshes rather than complex unions. a simple export, triangle polish up in blender, and reimport should really improve stuff. Lastly, things like particles, loads or images, etc are very heavy on the client, so be wise when using them.
sorry to talk late Marcus i was busy xD i wanted to say that your comment was awesome and correct. they load polygons. sometimes they give a bit of lag but yeah. i preffer deleting excessive scripts, or so many structures. the structures can lag because if you see any games with excessive territory it lags, for me yeah only depending of your computer quality.
I used to believe this, but that is actually false. In fact, it’s worse. Unions actually are worse for your game in most cases than not using them. Parts are already extremely optimized, so if you don’t need the union for design reasons, do not use it.