I swear I've tried everything at this point, but no matter what I do, the only way to avoid errors is to throw everything into one file, which ends up a tangled nightmare of code.

There's 3 distinct sets of functions: entry point & proc loop, rendering functions, and the main (editable) functions. The main functions and the entry point use the rendering functions constantly. All three sets of functions need to use the same set of global variables and constants.

Is there any way I can possibly accomplish this in an organized fashion without having to pass everything?