I’ve played mini cities 2 today, and after some time i realized that cities 10x bigger than this in the photo had almost no lag at all, even with about 1.2k buildings, and not small ones but rather large skyscrapers with a lot of windows which are pretty detailed
I want to ask, what scripts are used here to optimize this, i’m pretty sure that 1 building is at least 50-100 parts, but multiply it by 1000 and you have almost 12k parts with no lag, any ideas?
EDIT: I post in scripting because i ask about what kind of systems are used to decrease lag, ik that you can disable propertiess and stuff of parts to make them lag less
thx but this post is old and many things changed since then, also it don’t tell you how to optimize stuff but rather how to prevent memory leaks i really want more of a scripting guide, thx anyways
It depends on what you are trying to script. You can create a mesh for each type of part or for each part color. For example, a large classic building might have one mesh for all the walls and another for all the windows, etc. If you want to script the windows to change between normal and neon during the day and night, you can group all these windows into a single mesh and script that mesh.
Good idea, but will this really be performance booster? i mean consider meshes need to be preloaded cuz roblox loads them from website, soo they might cause network performance issues which are far worse than rendering ones
Drawscene shows what is in camera’s view, and for me at this angle it shows 1600, take into consideration invisible 2 sides, which is still 4-5k parts for me which is not that perfect considering bigger cities are possible in this game without lag
I’m 100% sure they are and still those are micro-optimizations, there must be something that makes those buildings not lag at all, as i said players have few times larger cities with a lot of cars, trains and buildings without any lag
I’m not sure where you got that information, but having a few hundred additional meshes won’t cause any network performance issues, especially if most of them are reused. While it may slightly increase loading times, it significantly improves performance because the engine has fewer parts to render and calculate.
Most regular simulator games on Roblox already contain thousands of meshes, and users run them smoothly. For example, Pets Sim 99 probably has tens of thousands of meshes and there’s no network performance problems.
Are you referring to the ContentProvider service? Nop, it will be much worse. While it ensures that all meshes are loaded correctly, it can take a significantly longer time, potentially several minutes, depending on the amount of content you’re trying to preload.
It’s a matter of personal preference though. Personally, I would rather prefer to have a few meshes out of thousands that fail to load than a game that takes several minutes to load.
There are many things you can remove from these parts to make them easier to render and maintain. Locked, Anchored and Massless with almost everything else set to false or everything else. You can create false parts to handle things like collision.
Shadows can really hurt performance, and if it’s never seen, there’s no need for one. No need for physics if the part never moves. Just lighten the load where you can. Blurring distant things, mesh parts with textures, and similar optimizations.
There are deeper ways of doing this, some already built into Roblox. LOD (Level of Detail)
this is a test script that moves 100 part every frame
add a folder in workspace
add a part to the folder
set the part size to 1,1,1
turn castshadow, canquery, cantouch, cancollide off
if you want to test this, use it as a local script
there shouldn’t be many fps drops
task.wait(1)
local RunService = game:GetService("RunService")
local rn = math.random
local folder = workspace.Folder
local clones = 100 -- change this if you want to
for i=1, clones do
local part = folder.Part:Clone()
part.Color = Color3.fromRGB(rn(0,255), rn(0,255), rn(0,255))
part.Position += Vector3.new(0, 0, 1*i)
part.Parent = folder
end
local parts = folder:GetChildren()
local cFrames = {}
for i, part :Part in parts do
table.insert(cFrames, part.CFrame + Vector3.new(0.01, 0, 0))
end
local moveMentIncrement = Vector3.new(0.1*60,0,0)
RunService.Heartbeat:Connect(function(dt)
workspace:BulkMoveTo(parts,cFrames)
for i,cFrame in cFrames do
cFrames[i] = cFrame + moveMentIncrement * dt
end
end)
As far as LOD, I bring that up because it is seriously powerful done right. Even a simple almost manual way of doing it works well. a few different models depending on distance.
Yes client-sided rendering absolutely helps but, you gain and lose things with that also.
If LOD can be enabled without streaming and via script it would be best idea, but otherwise i think i should make some client-sided rendering system to see if position is in camera FOV and determine if parent/unparent it to workspace