Category archive - Code

Some Handy Visual C++ Pre-Processor Macros

Over the last few years, I’ve been writing a lot of C++ that I’ve targeted for multiple platforms and/or multiple compilers. It has always been somewhat of a delicate  task to make C++ code portable, especially when starting with Visual Studio and targeting other platforms like Linux using GCC. Along with multi-target compilations, C++ pre-processor macros can be a useful tool in reducing the amount of mundane, rather simple, and rudimentary code that many C++ programmers find themselves writing. Here’s a few macros that I’ve used to ease my own development pain, I hope someone else can find them as handy as I have. Read more

VS2008 Solution Compile Error C2471 Hotfix

Incase anybody else out there is encountering the annoying Visual Studio 2008 bug where compiling a solution results in Error C2471 (can’t update debug database)… here’s the fix: http://code.msdn.microsoft.com/KB946040

For the longest time I chalked it up to my anti-virus software obtaining a lock on the file and not letting go of it. As it turns out, its a bug in VS2008.

Factory Pattern in C++

Up until now I never really used the factory pattern that often in C++. Recently I found a use for it in a project I was working on and since I found it useful for my purposes, I thought I might share a tutorial on how the factory pattern can be used in C++.

Now I’m not entirely sure how closely my model fits to the typical factory pattern but as far as I understand factory pattern, it is pretty close if not exact.

Basically a factory consists of an interface class which is common to all of the implementation classes that the factory will create. Then you have the factory class which is usually a singleton class that spawns instances of these implementation classes.

Read more

LINQ Audit Trail v2 – DoddleAudit

This looked like a link that was fairly re-post worthy. This is practically a must for any .NET + LINQ + MSSQL developer out there. Very neat way of doing audit trails in MSSQL with LINQ and C#.

A couple months ago I wrote a basic set of extension methods to handle automatic auditing in LINQ to SQL. Well I have received a large number of emails regarding this particular project so I have decided to focus on cleaning up my v2 API and releasing it on CodePlex. There was a lot of room for improvement from version 1 and today I am going to post the all new LINQ Audit Trail code. This new version is significantly enhanced in the previous version.

via LINQ Audit Trail v2 – DoddleAudit.

Gripes about Torque Game Engine on Windows 7

So for my Bachelors degree, we’re using the Torque Game Engine to learn how to create assets and write basic scripts for a game engine… effectively creating a whole game. I’ve used Torque lightly in the past, on Windows XP but never on Vista. Now that I’ve gone Windows 7 I’ve had nothing but problems with Torque. So far, just today, in the last 4 hours, it crashed on me 6 times. No pattern to it either, it usually happens when I just simply try to do something. In one case it crashed when I removed a dynamic property, another case it crashed when I placed an entity inside of a sim group. I’ve also experienced crashes in map2dif.exe as well. So far the Torque Constructor has been fairly solid, though I don’t like the interface at all, but the Torque engine itself has been absolutely terrible.

I really wish my college would use Unity or even UDK for teaching game development, Torque seems like an absolute joke. Of course, they haven’t tried out the new Torque 3D engine yet… they’re still on the archaic “Torque Game Engine” which is probably part of the problem.

Anyway, just felt like bitching there for a second about my Torque woes… its been a total nightmare trying to get this assignment done before the end of the 7th week of class (which is next week).