Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it a bad idea to have a script with 20,000 lines in it on your game?

Asked by
8391ice 91
5 years ago

I'm creating a combat RPG. I plan for the combat system to all be run from one main script in the workspace so that if I have to make a change, I can just edit one script instead of repeat the same changes over dozens of sub-scripts. The way the combat system will work is there will be one function for every attack in the game. On average, each function ends up being 200 lines long and I plan to have at least 100 attack moves in the game. If I continue with this approach of having one main script, there will be 100 functions in it, bringing the total number of lines above 20,000. Is this a bad idea? Will it lag my game? Is there a better way that I could handle all my attacks while still keeping it easy to make changes? If so, what could I do?

1
It's a very bad idea. I would create a script for each individual attack and use events to trigger those attacks. DeceptiveCaster 3761 — 5y
1
This is where ModuleScripts come in the mix. Ziffixture 6913 — 5y
0
Thank you!! 8391ice 91 — 5y
0
Seems interesting, doesn't it take time to switch tasks in the sheduler? So a hundred scripts vs a single script that does the same would perform differently? But then again, it's harder to manage that, unless you have an index for every function, event, and variables. Don't know if micro-micro optimizations are worth it. Formidable_Beast 197 — 5y

1 answer

Log in to vote
-1
Answered by 5 years ago

no it isnt, unless if the first line is a

game:GetService("RunService").RenderStepped:Connect(function()

but apart from that should be fine

0
Yes it is. RenderStepped won't do anything with 20,000 lines of code. DeceptiveCaster 3761 — 5y
0
tell that to the future ppl who see this, when roblox has made RenderStepped compatible with server scripts. TheluaBanana 946 — 5y
0
RenderStepped won't even be compatible w/ server scripts. Its a local deal. Why would the server have access to everyones frame data? Psudar 882 — 5y
Ad

Answer this question