I’m in the process of implementing core UI and the basic game loop for my game. This morning I watched a video on some of the myths and fallacies about Yandere Simulator’s code. Now, I’m worried that my code could do the same, because I want to avoid having messy code. I came up with some ideas taken from the video and stuff I came up with after watching, and I just want to know if these strategies will cause performance issues (noticeable performance issues, I’m fine with a bit of runtime with these solutions), or they’ll be as good as the current methods I’m using.
Would it be better to handle multiple buttons with a for loop?
I’m the process of making a simple “desktop” that can open programs that are vital to progress through the game, and I’m styling it based on Windows (7, specifically). I only have two programs right now, each with their own script. However, because I plan to add much more programs later, I’m worried this could become especially inefficient with memory usage and changing any code in the future. Would a solution like this work:
for i, button in pairs (buttons) do
button.MouseButton1Click:Connect(function()
--Pseudo code functions here
openWindow()
end
end
I definitely will add cleanup for garbage collection when the desktop is closed. But assuming apps could have different startup properties, would this be most efficient (I know how to implement extra properties, that’s not the issue)? I assume it would, I just want to check.
Is implementing basic OOP for interactable, furniture types, etc. a good idea? Is it worth the effort, or better to hard code the behavior into each?
I’m thinking possibly having a module that has properties for different interactable objects (e.g. FurnitureBehavior module in ServerScriptService would have functions like CreateFurniture, handling models and behavior for stuff like couches and tables, so it isn’t just decoration and acts accordingly. However, is it really worth all that effort? Would just putting individual scripts be just as dynamic as that strategy?
Does Roblox not render objects when they aren’t in frame?
I don’t need them to render all objects out of sight. My issue is that assuming the player is in their building, will the outside area load (the buildings in a separate area)? Or do I need to add this functionality myself. Yes, I know StreamingEnabled is a thing, but I don’t think all the rooms will be far enough apart to add much functionality to using StreamingEnabled.
Thanks for reading, and any help is appreciated! Let me know if I explained any of the question poorly (because chances are I did).