Author Topic: Organizing code help  (Read 568 times)

I have over 700 lines of code and I think im starting to get in over my head. (I know it isnt even that much yet)
Yeah I know, comments can help organize and so can having multiple files but this is for a single TDM gamemode so I cant really split up the files in any logical way.

Is there any other ways I can organize my code?
General tips on organizing code would also be appreciated

Look at the individual features you need to provide and modularize them as individual script files. For example, if you're making a really complicated weapon, have one file for the particle emitters, one file for the sounds, one file for the item, one file for the image, etc. You can also do this in a individual file by marking sections with comments and writing something so that you can easily find that using search features in editors.

Yes. Also make individual functions for arbitrary actions that you perform several times

I usually split up my code as follows:

User interfacing
Support functions for interfacing
Main Functionality
Packages
   Interface adjustments
   Complete overwrites
   Intercept/modular based
Supporting functions
Non-function based code


This is how I organized my mod. It's pretty big (nearly 7,000 lines) and 184 KB.

isnt that Iban's city RPG?

maybe not, I don't remember an events.cs or commands.cs in that

Here is my layout:


Well you guys are posting humongous mods. He doesn't really need to break it into that many text files

Well you guys are posting humongous mods. He doesn't really need to break it into that many text files
I use this with a very short description of whats below it and sometimes if there is a lot of code or I'm planning on it being a big mod I'll have multiple files.
//=========================================================================
// Description Here
//=========================================================================