Should i start optimizing my scripts to the death of god?

I have made countless scripts over my course of some 3 years, but one question that i have thought recently is that if i should optimize them to the almost perfection. Like, it makes the game good and not have performance issues. If i feel a script is too long, i shorten it in like 30 lines less.

The reason im saying this is because some of the simplest scripts i make have more than 200 lines, and im worried if i should optimize that.

3 Likes

For example, i have a script that lets you grab objects then rotate, tilt, glue and activate them which contains 200+ lines (no performance issues but whatsoever not happy about it)

2 Likes

Yeah you should definitely start doing so. In the future, when you’re making larger and more complex games, you want to keep your scripts as short as possible to improve performance for players with both good and bad setups. Doing this will also keep your scripts readable,

2 Likes

The length of a script has (almost) nothing to do with how well it will run - that all comes down to the actual method you choose to do whatever it is you’re doing. In my opinion a more verbose script is better than a heavily condensed one because you can more easily see the logic of what’s going on long after you’ve forgotten how it works. If you’re concerned about the organization of a script that has gotten too long, then you may consider splitting it up into separate module scripts.

3 Likes