As a matter of code structure/organization, how do you reduce the amount of code in one script file?
I have one main processing object called "Simulator", and it governs ALL of the interactions in the game. Using pseudocode, its script file looks something like this:
var variable1 = 1
var variable2= "two"
var variable3 = [3]
...
var variable100 = "holy shit there are so many variables"
func _process(delta):
#"apples", "oranges" etc. represent other game objects like player, enemies bullets etc.
update_apples()
update_oranges()
update_bananas()
interact_apples_oranges()
interact_apples_bananas()
interact_banana_oranges()
func update_apples():
for apple in apples:
update_one_apple(apple)
func update_one_apple(apple):
...
#(insert 20 odd other functions here)
The result of the above pattern is that my Simulator's script is huge and only growing larger as the game gets more complex. I'm worried that this would cause some kind of problem down the road, even if that problem is just me getting intimidated by my own code.
So, I was wondering if there was any way to reduce the size of a script like this with minimal refactoring? (I heard some people mention "extracting" the code from the main script somehow but I have no idea what that means.)