Yeah, it's honestly the hardest part. I slowly work through the code to make things better as my personal knowledge expands (and tolerence for blockcode diminishes). Still, with the sheer size of the game, it is hard to get this all done in a timely manner alone. moving from the whole MegaSpaghetti backend to the new javascript backend took almost three months including post-release support, it was brutal but had to be done.
2nd advice.
By nature computer code are actually math formula and objects.
So coding obeys similar laws like math.
It is important be cause it can save coding time reduces variables reduces typo in code in the long run.
In math and logic ppl use formulas you do not use the original objects to calculate like"apple" or"orange" instead you use perishable substitute like a or b that loose its value outside the page/ in twine it looks like _a and _b . This kind of coding does not create extra garbage variables and actually reusable with other variables.(be in mind that the result has to be converted back just like in math)
Complex code can and has to be broken down to smaller and more manageable parts, paired with comments so you will know what is in there.
Giving telling names are not substitute to comments!
Giving telling names very useful in individual code enbeded in text.
3rd advice.
Events:
There are 4 typ of events:timed,random,conditional,chain
You can argue that they are the same but their implementation and usage is different.
1.timed event: it is an event that fires in predetermined time from game start or from result of an other event.
It is used for milestone events like playing rent or exam day. It is strongly advised that you make it inescapable if important.
2.random event: it has functions as a filler event not critical in relation to story line
3.conditional events:it fires given certain conditions normally used for minor story progression.
4.chain events:actually it is a chain of events above timed random, conditional. The main factor is events has to create an internal chain of happenings that semi independent from the game engine.
I know it is confusing You can look at it like this:They are events that reques for subsequent of events.
It is the way to mix timed random and conditional events into a story line/tree.
Common mistakes related to event chains:1.give all events to exact date...congratulations you have created a fixed story that brokes if not forced.
2.place too much random events in the story line ....players will curse you to no end.
3.place a lot of conditional event together or use too many condition....the walkthrough is longer than the game
Be in mind that there are endless coding stiles present for endless way of thinking most for lazy bugs who skimp on proper steps for higher speed. What i wrote down will make coding/game creation more manageable not faster, and does not mean a complette guideline.(Look up the support forum for that)