I have a script, and it generates terrain with perlin noise, however, it generates 2.5x2.5x2.5 size blocks with 6 decals and 6 textures in them, to make grass (dirt layer and grass layer overtop to allow colour change), and when you play your mouse begins to stray away, and have weird acceleration issues.
I believe this is the decals and textures causing this, as I have had players say about lag issues on slower computers. Is there any workaround with this? Could anyone supply any examples on ways to fix this? Thanks!
I have reduced it a lot with fog, removing a couple prints, and increasing the delay between checks for generating terrain. I would still appreciate some help with reducing lag still.
EDIT: Thanks to @Dysche for the help. Apparently decals are much less efficient than textures, and now roblox studio is running without the mouse acceleration issues (The fps is just because it is running out of ram from the terrain I assume.) I will test in game and if it works then I will mark as solved.
EDIT 2: It seems to be working amazingly, and on minimum settings I’m hitting 40+ frames with a lot of terrain loaded. Dysche also recommended converting some smaller blocks into larger blocks with the same texture, repeating, and that should allow the game to run smoothly. Thanks!
I came up with something rather quickly so this may or may not be the best. What you should do is generate textures on the viewable surfaces. Raycast from all lookvectors and see if it hits a part. If the part distance is farther than right next to it, you should texture that face. I would call this update every time a part changes, but make sure to check and see if it’s position changed, went nil, etc. (however you get rid of mined blocks).
EDIT: Raycasting is rather inefficient so I would recommend doing it in chunks, kind of like Minecraft does it. (since that’s the game style you’re making)
I actually have been doing it in chunks. What I could do is raycast from the block I placed to tell other blocks to hide their faces, and hide this blocks face if so, and before destroying, I could tell the blocks around to show again. The problem with this is that you can rotate all blocks, and would make it hide the wrong faces.
Every grass block is 2 parts. One transparent, slightly larger one with the green grass (actually gray but with a Color3 variable set), and the visible part with dirt texture.
Actually, what you should try to do (Not sure if it efficient but might as well try) is to make mesh cubes, then have textures UV wrapped. There, you have a texture as one whole piece, making it more performance friendly since it only has to load one single texture inside of 6.
How about two mesh cubes, one with the grass texture as a UV Wrap, and the other just as dirt. That way, it only has to load a total of 2 textures instead of 12.
Transparent parts with textures on top are terrible for performance. You can just layer the grass texture on top of the dirt texture by applying it afterwards.
(just saying this for anyone reading the thread; I already told you this in-game)
Microprofiler output after the transparent parts were removed.
Late reply but the input delay your experiencing is a bug with Roblox, if your mouse polling rate is above 125hz it will suffer from what your experiencing.
You can see the thread here: Significant input delay ( Camera Lag )
Edit: I read the previous replies as May 19th rather than May 2019