How would someone optimize their game very very well

what would someone need to do to optimize their game where it uses like the least resources possible… i mean like micro optimizations.

1 Like

I can tell you the most important things about optimization:

  1. cast shadow
    roblox uses deferred render method, so the shadows are only rendered on the screen. they update everytime there is a motion on the screen, that causes lags when rotating your camera.
    Solution: Get rid of shadow casting on tiny and unnecessary parts, that will not affect visual a lot, especially on future technology.

  2. future local light
    they lag a lot with shadows on, use them as rarely as possible and let your players disable shadows if they want

  3. geometry
    use streaming for terrain and small models, and you can also write your own LOD system to reduce geometry from bigger models/meshes with better results.

  4. transparency
    transparent objects are very laggy, many trees/bushes from toolbox are using transparent leaves.
    for bad leaves, add surface appearance, set it to transparent mode, and add leaves texture. don`t forget to set mesh transparency to 0 after that.

  5. terrain
    complex terrain will eat more memory, remove caves and hollow spaces under terrain to optimize memory. grass decorations can be mixed with any other material so less grass will be rendered.

  6. parts
    too much parts can lag the game, use streaming or your own LOD system to reduce part count

I think that`s all

1 Like

I can tell you some optimizations that I have done before.

  1. Always defer updating things except for user input, for example the moving leaves of trees or motion blur. You should also have a tick queueing system for these updates.
  2. Avoid creating and destroying instances every frame. Creating instances is very expensive.
  3. Avoid very large particles. Overdraw wastes an insane amount of GPU power.
  4. Avoid division. The / operator is very slow. Try to cache division first if possible (for example 1/2, 1/8, etc), and use the * operator.
  5. Cache calculation results if it’ll be used later to lower CPU overhead.
  6. Avoid nested if statements. You should also cache if conditions in a variable first if you’ll need it later.
  7. Use timed task.wait()s using tick() in loops that are using very large tables to avoid stuttering and script timeouts.
  8. Add --!native at the top of your server scripts to enable native code generation. It’s basically a free performance boost.
  9. Use actors and multithreading for heavy calculations. This boosts performance for things like generated terrain.
  10. Finally, avoid printing things into the console multiple times each frame. This is really bad.

That’s all that I can remember.

1 Like

so its faster to do 1 * 0.5 than 1 / 2?

wait could you elaborate more? how would i make a tick queuing system

Plenty of resources already. Why reinvent the wheel?

Just keep looking. These are just the tip of the iceberg.

exactly… they are just the tip of the iceberg…