on Thursday 24 June 2010
Today I'm going to discuss how to create a project, organise it in a clever way using a smart directory structure and maintain it using source control. I was inspired to write this by a book called Game Coding Complete by Mike McShaffry et al.

To begin, I am assuming that you will be using Visual Studio, however the directory structure and source control can be adopted by anyone.

Directory Structure


When creating a project, especially in Visual Studio, it can become very difficult to stay organised as more and more code is created/added. To overcome this common problem Mike proposes a file structure that is both diverse and expandable.

Here it is in its basic form:

Project Name
+ Docs
+ Media
+ Source
+ Obj
+ Bin
+ Test

Most of these are self explanatory but here's a simple overview:

Docs- This would typically include anything you would produce in an "Office" package, I would also advise storing all your UML here too.

Source- This can be expanded to include many child folders. Where I work this is usually split to replicate the different teams that will be working on the project, so you may find a DB, UI, Business and Common sub folder. For Games you would likely have AI, Graphics or 3rd_Party.

*Note - as a rule try to stick to the Linux convention of putting a _ instead of white space when naming files e.g. 3rd_Party instead of 3rd Party. I cant count how many times I have been caught out by errors relating to this at work.

Obj- anyone familiar with Visual Studio will be aware of the temp files created when building your project. One way of keeping your solutions folder organised would be to dump the temp files here... I will provide the VS configuration to do this later in the blog.

Bin- When you build a program you will be presented with a package (often a .exe). This is where you should have your compiler store that package. In this folder you would also have a Debug and Release sub folder where you can store your package depending on the configuration used for the build.

Here's a more advanced file structure (based on a typical game)

Project Name
+ Docs
+ Media
++ 3D_assets
+ Source
++ AI
++ Graphics
++ Maths/Physics
++ 3rd_Party
+ Obj
+ Bin
++ Debug
++ Release
+ Test

Visual Studio Configuration


For this it's probably easier to show you with a few snapshots. From within you project Right click the solution, select properties and configure the project as shown below.

General

Debugging

cppHeader

cppOutput

LinkerDebug

When you now build a project you should find that Visual studio now places the temp files in your obj folder and your release in bin. It's up to you to organise your source code but this is easy enough to do in Visual Studio.

Source Control using Google Code(GC) and TortoiseSVN


I'm not going to discuss these here as there's plenty of information on-line about them. All you need to know is GC will act as your repository (a storage place for code) and TortoiseSVN is a GUI (Graphical User Interface) that enables you to use Subversion (a type of source control).

To begin with you will want to create a project on GC - you can call this anything you like just make sure you can identify which project it relates to. One thing to note is its not always possible to name the project what you want (normally as its saved on your PC) as a project with the same name may already exists.

Now that you have created project and given it an elegant directory structure its time to upload it to GC. To do this you will require your Google username and password but note the password is not the same as your Google account password.

To get the username simply log into GC and select the "Profile" menu - this will give you your user id and select "Settings" to obtain your password.

Finally, in windows explorer, right click your project directory to get the Tortoise context menu and choose "Import...". Tortoise will now prompt you for the repository url. Enter:

https://[project name].googlecode.com/svn/trunk

Enter your user id and password obtained earlier and watch your files and directories get uploaded to the GC repository. From now on you can use the
Tortoise repo-browser and other tools to access it via the url above.
on Monday 3 May 2010
So, hello everyone (if everyone is anyone!), this is my first post so I thought I would give you a little information about myself - I'm a 24 year old male from Newport, South Wales, UK.

I currently work for the Office for National Statistics as a Build and Release Engineer. My job involves gathering all code from developers and creating a package that can be deployed to our application servers for the business area staff to do their bit; this generally involves collating data, analysing it then releasing the new information to the public. A few of the higher profile projects would include the 2010 Census, National Accounts and many others. Some of the software that I use on a regular basis is IBM's Rational suite which handles our source control, Apache Ant and Maven for the build framework along with Oracle Database Management System (DBMS) for all that crazy database stuff. I've been in this job for 6 weeks now and I'm enjoying it tremendously, it's my first job since graduating and I'm always learning something new.

I graduated in June 2009 becoming a BSc Computer Games Development, however, since graduating I haven't done much in the way of games programming which upsets me a little; I have however got myself a copy of the latest “Game Coding Complete” by Mike McShaffry which I do plan to read through and start programming examples from. As I work my way through each example I will be sure to post my experiences and error's – as anyone in programming will now are all too unavoidable.
Well, thanks for reading and I hope you come back for more!