Use Yucon Framework to optimize your code
https://devforum.roblox.com/t/yucon-framework-next-level-optimizing-and-organizing
Can you send another link that link isn’t working
Sure
I am using yucon framework, the laggyness didn’t changed
Did you watch the video? If you didn’t you have to watch it.
I did watch the videooooooooo.
Did you just import Yucon Framework and left it like that or you scripted a bit?
I scripted itttttttttttttttttttttttt
Well, test your game (not in studio) you will notice in game memory.
I can’t publish game so i can’t test it in game, I had this publishing problem few months now
Turn on streaming enabled, properties of workspace.
With this turned on your game will render chunks around your character in a certain radius instead of having to load the entire game.
I already have my own chunks generating system, do I need to use 2 of them?
Hmm, make a new place so you can publish your updates there.
Does not work. it said publish failed.
Well, reinstall studio hope this works after doing it.
Reinstalled, It still does not work.
Maybe, restart your computer I don’t know lol.
I appreciate my framework being linked! However, it is not something that just makes your code not laggy. When speaking in terms of optimization, the framework seeks to encourage optimization, not just create it. This is done by the structure of things, such as integrated object-oriented programming and code-to-code communication. You can’t just put code in the framework and hope it runs faster, unfortunately.
(P.S. that tutorial is super old, PolyHall has a new series of tutorials that are phenomenal though!)
I assume the lag comes from the mass of instances you are creating. I’m also assuming that you are just creating them all with Instance.new()
individually.
What minecraft does is culling. In a sense, a very large grid of invisible blocks are placed evenly across the area. When a player is within render distance, the block becomes visible, and when they walk away, it becomes invisible again. It’s not a noticeable thing, but behind the scenes it’s incredibly smart.
However, Minecraft takes it a step further. Instead of pre-creating all of the blocks for the whole map, it has a set number of blocks around them that can render. For example, if your radius is 10 blocks, then your area is 10x10, meaning you have 100 blocks that exist at maximum at all times.
In your case, instead of creating and destroying chunks, re-use existing blocks. When a block is created, have it check a table to see if any blocks are “culled,” or as you can imagine it, unused. If so, use that block instead of creating a new one.
When a block is destroyed, instead of actually destroying it, set its transparency to 1, and mark it as “culled.” Changing transparency is incredibly efficient and beats other methods of culling, such as positing far away or sizing to 0.
This is much more efficient than constant construction and destruction.
Hope this helps!
Thanks, this helps reduce the lag!