Hello Developers,
Many of you know that there is a concept or framework called FPS (Frames per second).
If you know how FPS and fps drop-down works skip to the optimization process, if not, here’s a clear explanation of how to do it!
Each time your device renders a frame (think frame as whatever you see on screen, including UI), it counts as 1 frame. For example, each time you see a change on your screen, it’s a different frame.
In other words:
Think frame as an image, when you flip 10 images that are quite similar to each other in a very short time, it will look like a video. The same thing is fps, your laptop renders 1 image on your screen in a very short period, and the speed of changing images is so high that you don’t find it changing images or slide shows but you see it as a video or a gameplay.
Now your devices renders until you leave game, it can be 1000, it can be 1034943034934, or even 200. So why is FPS not 200 or 1000, but some number around 60.
Basically FPS is not the count of frames your device rendered overall, it is the count of frames per second. So if your device renders 30 frames in 1 second, then it is 30 FPS, but not 30 + old frames count.
So each time your device renders, it has to consider physical and user interface objects. So it means every new item you add to a player, it adds up load on the device of the player. So the more the number of objects in the camera viewport and user interface objects, the more laggy the player becomes.
So is the solution for this to remove all objects? No ofcourse not, you won’t have anything if you have 0 objects. You try to reduce the time taken per frame by reducing objects without affecting the game concept or game.
Optimizing the game
This is a pretty hard task and can never be perfect, but helps overall, so if your game is not fully optimized you should be happy it’s at least better than 0 optimization.
Now 3D objects have more impact on the load on the device than 2D objects, additionally, too many user interfaces and scripts on the client can affect the performance, so whatever you do should not break any script and the game should work according to the concept you made.
Now you need to reduce the number of items that are complex and increase the load per rendered frame.
These are a few things that can possibly be reduced:
1. Unnecessary elements: When a player is not focusing on a UI or has too many objects in their PlayerGui
folder that are simply lying without any use, turn off their Visible
or Enabled
properties of those, if your sure, that you don’t need them very soon, then destroy them. And add them back when they should show up, ofc it might take 0.1-3 seconds to load the UI again, but it is better to improve performance and waiting 0.1-3 seconds isn’t something bad and wouldn’t normally affect a player’s experience.
2.Too many loops: If you use too many loops, then each loop should be run in every render of the device, and it will add up a lot of load on their device and their FPS will drop in a very significant amount over time. End and break loops and try to avoid the memory leaks the best you can!
3. Hiding far objects/Streaming Enabled: A player won’t focus on objects which are far from them, most of the games, in those cases, you can enable StreamingEnabled
property in workspace which will not load the 3D objects which are outside the radius you keep.
4. Memory clean-up: Whenever you perform large tasks, make sure you clear the data after it is done because storing a lot of data will increase the CMU, the client memory usage, and the memory consumed by the client, when it increases, the device will have more things active and speed of device itself will reduce not just the game, and reducing this is the best option. And deleting unnecessary data will surely increase the performance of the device, and therefore increasing the FPS.
5. 3D world optimization: Try to use the least amount of triangles possible on a mesh without affecting the shape of the mesh, each triangle counts, so whenever you making a mesh, try to reduce the triangles by merging them or reducing the number of vertices where you don’t have anything to do specifically.
If your using blender, you can use decimate and change the ratio to reduce triangles, but make sure you don’t compromise on your game if you want your game to be the best. But don’t forget the user experience too.
However, optimization of a game differs from game to game, for example pvp games require players to see long distances to shoot them such as arsenal or bedwars. And obby games don’t really need that much of a sight compared to pvp games and ultimately these are the few points which are based on universal validity and more things can be done based on your concept to reduce load on server and client inclusively.