ok so im just making a mining game thingy and i decided to make it pretty big and just 1/10th of the parts needed already make my roblox studio lag ALOT do you guys have an idea on how i could optimize it
If there is alot of parts that the player cant do anything to them (like mine them) just modle them to make 1 part
and if the player mine straight down and lets assume that when ever you go down there is new type of blocks like first dirt then stone then…
just put the stone and other stages in replacted storage and when ever player is close. like he reached 3/4 of dirt stage make a script that clone them down and like this
there is one problem with this. if another player mined allready down:
just make the other stages is not visible to the player clinte
Also, if the player is down by alot make the upper stages not visible
so:
-
changes in the actuall stage are server-side
(like if somone mined a block in it) -
changes in the visibility of the stages are clinte-side
if u go to popular mining games you will notice that thay are doing it like this
and when i say make a stage visible or not, i mean by that is to replace it and make it in a place isnt loaded for tha player (:
probably have 1 giant part that divides into more upon getting mined (voxbreaker module kinda does that) and I heard theres culling that hides the stuff that player doesnt see so if you dont look at 1000 parts they dont lag clients
It might sound like too much but you might want to consider scripting your own rendering system as @ksa_ab65 introduced. I don’t know what type of mining game it is, if you only have a small field that can be mined down into, you can make stages render in specific cases. If you have a big world which can be changed via mining everywhere, you might want to consider other methods like chunk systems (similar to Minecraft). There are very different approaches to this, but as Roblox Studio provides default Modules that are supposed to be okay for every game, it can’t handle such specific games like you want to make one.
Custom systems are the way to go here in my opinion.
Yeah. At the end our goal us developers is to make all users have similar experience, whether the user plays on high end pc or an old phone.
Agreed. If this already lags on your PC (I don’t know your specs), this might even run worse on low-end devices like phones or tablets. This can potentially lead to loosing players aka. customers if you are offering gamepasses or other micro-transactions and have financial benefit in mind.
To avoid lags and excessive memory usage, you should place only the blocks that the player can see, using a local script.
For example, if you have a brand new 10x10x10 block grid that has not been mined yet, you should only place the 10 blocks of the top layer in the workspace and nothing else. When a block is destroyed, you can then add a new block in the next empty place. You can also place up to two layers of blocks, the ones that are visible to the player and an additional layer behind them.
this is genius… do you create/destroy new blocks whenever they are shown/hidden or reparent pre-generated ones?
I don’t do this yet since I’m not that advanced but evantually I may end up atleast trying this considering it’d help with performance
There are many things you can do to a part to make it less taxing.
CastShadow false
Locked true
EnableFluidForces false
CanCollide false - only the few you really need true
CanQuert flase
CanTouch false
Anchored true
Massless true