Thursday, September 17, 2009

Organize for ease. Part 1 - Coding

One of the main reason I prefer game makers is the ability to organize your resources. Resources pile up, I look at my old projects and am always suprised at how many resources are in it. From graphics(majority) to sound effects, it all ads up and it all can belong to different catagories. Of course even with a handy program to sort the stuff in your application, the original resources need a home too.

Now I can't quite say I have an exact system, its more an evolving one really. So let me break it down into a few catagories, for now on coding...

Coding-
There are many different languages out there to code in. C, Python, Ruby, basic, and so on. They can be similar and different in the way code blocks are structured. Some require ending with ; or containing blocks with {} and the worst off is how some use different symbols to control arrays. That always gets me when jumping from one to the other.

Since I'm no expert coder, just a decent one, I can't give advice on making your code faster, more powerful and the likes, but organizing it will make bug fixing and upgrading much easier.

1) Indents - Without it it would be a wall of gibberish, with it you can seperate your routines, statements and all that junk. Normally editor have indents set to 4 spaces, which I think is twice as much as it needs to be.

2) Comments - Commenting is not just good for other coders to learn from your code, but also a good reference when you get lost in the thick of it. Commenting your predefined variables always helps, as sometimes you may use short names or coded names for them. Routines should also be commented as to seperate them from the rest of the code. Using a comment as a page break is also nice, simply creating a line of * or = or - to split up different sections of the code like start, looping, routines.

3) Sub Routines and Includes - These are your best friends, breaking up commonly used code into subroutines and packaged in include files saves your main program of a lot of unnesscary characters.

4) Folders - If using a more traditional language, or doing it old-school with notepad and a compiler, making folders in your project directory to sort your code and resources is a must. The more complicated and more content, the harder it will be to sift through it.

A generic folder structure I use:

(.. representing prior folder name, * meaning all sub folders)

Project\
..\Graphics
..\..\Working (for multi-layered/editable graphics)
..\..\RAW (for processing images into textures)
..\..\Done (completed graphics)
..\..\*\System (UI, mouse, ect.)
..\..\*\Game (Items, portriats, ect.)
..\..\*\Textures
..\Audio
..\..\SFX
..\..\..\RAW
..\..\Music
..\Archive (for old builds)
..\Releases
..\..\Demos
..\..\Snapshots
..\Models
..\..\Working
..\..\Done

So thats how I organize my files and coding, next time I'll cover my graphical procedures.

No comments:

Post a Comment