DM Organization

So after years and years of programming games on BYOND, I've been through almost every kind of organizational system to keep my code organized, and I've never came up with one solid system. The other day I decided to sit down and think of how I could organize my code in such a way where I can easily access all my systems and objects and procedures in a non-bulky and clean way. I came up with something that I just had to share with you guys, out of all the years I've spent programming, this is probably the best method I have used/created. Please, feel free to share your organizational methods, as I would be very interested in seeing other people's systems.
So basically it goes like this:
defines.dm                           //all global variables and #defines
+datums                                 //folder
    -defines.dm                 //in this file, simply define all the datum paths, variables and proc \
                                                names, nothing else
    //create a sub folder of the name of your datum, some examples:
    +missions
        //here define each procedure as a new .dm file
        -new().dm
        -process().dm                                   
+defines                //ive seperated the code into two main categories. defines and procedures
                //under the defines, you simply NAME procedure names and variables and paths
                //under procs you actually write the procedure for that type
    -areas.dm
    -atoms.dm
    -turfs.dm
    //for types that have a lot of sub-types, like mob and obj for example, make a folder
    +mobs
        //define each sub-type of mob as a new .dm
        -mob.dm
        -npc.dm
        //if you wanted to go more in-depth:
        -headmaster.dm
        -first_mission_guy.dm
    +obj                                
        -items.dm       //a definition file of the item path and its variables and procedure NAMES
        +equipment
            //now if you have a lot of equipment you can name each .dm file as a piece of equipment
            -armored_vest.dm
            //or if you want everything in one .dm because your only defining them anyways,
            -equipment.dm
            //and simply define each type with their own variables
        
        //and do the same with these
        +gadget
        +weapon

+procs  //this is where your actually going to put the procedures
    //for each type, make a folder
    
    //now for each folder, enter the procedure as its own .dm file
    +area
    +mob
        
        -login().dm
        -die().dm
        -process().dm
        
        //you can go more in-depth by adding sub-folders for each sub-type of mob
        +npc
        +player
        //etc..
    
    //same idea throughout        
    +obj
    +turf
    
    //now here is where all the procedures that don't belong to anything go
    //for example a name parser
    +procs
        name_parse().dm
        //or a round starter
        start_round().dm

And thats pretty much it. I just wanted to share this with you guys, it may help some of you. It did me!

Posted by Smokey Joe on Thursday, July 02, 2009 10:57PM - 3 comments / Members say: yea +1, nay -1

game_del()

A small proc I've made that I find very helpful in my games, I thought I would share it.

This deletion method wont return your code like the built-in del does.


proc
    game_del(atom/a)

        var/list/built_in = list("type","parent_type","gender","verbs","vars","group")
        for(var/v in a.vars)
            if(!(v in built_in))
                a.vars[v] = null


Posted by Smokey Joe on Thursday, October 23, 2008 09:21AM - 4 comments / Members say: yea +0, nay -0

Smokey Joe

Joined: Jun 27, 07

Learn how to love, and forget how to hate.

Blog Calendar

October 2008
Su Mo Tu We Th Fr Sa
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
 
  Jul»

My games