A quick guide i made to optimizing your maps and builds
When making ROBLOX games its an extremely good idea to maintain smooth performance as the ROBLOX engine is notorious for being very unoptimized and slow meaning older hardware (and sometimes even newer hardware) just struggles to keep up when it comes to rendering and playing large scale ROBLOX games with big expansive maps or even smaller scale games
This guide will mostly focus on building and lighting rather than optimizing code but i may possibly make a guide for that in the future if requested
Object collisions and Mesh fidelity
These are 4 collision based properties for Parts, Meshes and Unions
CanCollide - Toggles whether the object can register collision from other objects
CanTouch - Toggles whether the object can be registered by Touched events
CanQuery - Toggles whether the object can be registered by spatial querys (e.g RayCasts)
CollisionFidelity - Sets the underlying geometry of the objects collider (Hull, Box, Precise, Default)
-
If you are not using touch events on the object then set CanTouch = false (Keep this on for Seats and VehicleSeats)
-
If the object isnt being used in spatial querys (e.g RayCasts) set CanQuery = false (Not recommended for fps games where gun RayCasts would be used a lot)
-
If the object is small or insignificant (e.g Plate,Cup,Pebble etc) or the object is inaccessible to the player the then set CanColide = false
-
Do not use the Default or Precise CollisionFidelity options unless absolutely necesery (these options use the mesh as the collider meaning your essentially doubling the triangle count) You should be using Box collisions or Hull collisions depending on how realistic want the object to collide
-
If an object has CanCollide = false always use the Box collision mode (reduces the poly count of the un used collider to just a box)
The property RenderFidelity changes how many polygons a mesh is using to be rendered there are 3 different selections to choose from
Automatic – Uses the built in LOD system to lower detail depending on distance
Precise – uses the original high poly mesh
Performance – uses lowest polygons possible while maintaining its shape
- It is always a good idea to use Performance Fidelity unless doing so makes it very obvious that the object is lower detail in which case you would use Precise Fidelity
Light sources and Shadow casting
Lights have a togglable property called Shadows when enabled the light will attempt to mimic what shadows would look like in real life
- Be very cautious when enabling Shadows it can kill performance quick depending on the amount of light sources you have, it is recommended to disable this in places where it is less obvious to the player
Objects have a togglable property called CastShadow which is used by lights to determine whether the part will be used in shadow calculations
-
If a part is small or insignificant (e.g Plate,Cup,Pebble etc) you should set CastShadow = false as the built in Ambient Occlusion can simulate something similar to its shadow at a fraction of the cost
-
If a part is in shade or unseen by the player then set CastShadow = false (can depend on situations so use your best judgment) this is very good for scenes in which the sun or light sources cant reach it
-
If a part is invisible but has a Decal on it set CastShadow = false as the decal can still produce shadows invisible or not
Surface decals and Mesh textures
When applying decals and texture instances to your objects they will double the surface geometry of which they adorn to which is not good at all
-
Never place a decal/texture onto an object that isnt a cube this is to avoid as much geometry duplication as possible
-
When applying a decal/texture onto an invisible object set CastShadow = false on the object as this will cause the surface geometry to be doubled
-
Avoid using image/texture resolutions over 512x512 (unless you are using a surface appearance or material variant) as they are stored uncompressed in memory
Part count and Geometry culling
When making maps ALOT of parts and different meshes are used to build it however the more instances there are the longer the map will take to load and the more performance loss
-
In areas where parts cant be seen get rid off them to lower overall part count (in semi rare cases this can make lighting in the area look unusual so do this with discretion)
-
DO NOT use unions to reduce part count (thanks to @GamEditoPro for the reply) while part count is reduced memory usage is increased depending on how many unions your using for e.g a build made out of only block parts it will take up the same amount of memory as a singular block part however unioning parts will add extra objects to memory which out ways the lower part count unions also have terrible geometry which increases memory EVEN MORE
All parts on the client have a property known as LocalTransparencyModifier this property is a multiplier to the transparency property and is used to stop rendering parts on a select client
- When big areas are far away or out of sight (subway station, inside of a house) you can set all of the areas parts LocalTransparencyModifier to 1 to stop the place from rendering to the client saving on render cost (do note the parts are still loaded in memory and are simply being culled out for performance sake)
The end!!!
For a first post i would say i did a decent job but i would love feed back if you have any other suggestions on saving performance please comment them and i will attempt to add them to the post