Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Working under the hood

Sign in to follow this  


I spent most of my available time this past week working on not-so-glorious pieces of code. You know the ones that don't immediately pay off, but can save you huge amounts of time down the road. The first of these pieces was a logging class. I wanted something simple, relatively transparent, and able to produce readable output. Here is what I ended up with.

  • Consists of two classes, one encapsulating a log and another encapsulating an object that wants to use the log
  • Few but meaningful options, including indent, message type, contexts
  • Not much to explain here, just wanted to leave as small of a footprint inside my code as possible.
  • HTML output
  • Alternating row background color
  • Context markers

Here is the code:


Here is a screenshot showing some log output

The second piece of under-the-hood code is a generic object factory based on an article I read here at GameDev. I am using it to load objects from my level files and it seems pretty cool thus far.

I also got my hands dirty doing some XML parsing using TinyXml. This turned out to be pretty simple and I would recommend it to anyone wanting fast, basic XML capabilities in their C++ app.

I have also switched gears and plan to use Bullet Physics. Originally I was leaning towards PhysX and I cannot pin down exactly why I changed my mind, but it was just a feeling. Anyway, it will be my first time integrating any type of physics into a game so no mater what I will come away with some knowledge.

Gamewise I have began to hammer out a level file format and am now working on parsing the files and creating appropriate objects.
Sign in to follow this  


Recommended Comments

Very nice logging output. Way nicer than my wad of line-broken HTML.

I eventually stopped using my log stuff altogether when I figured out I was never going back to the log file and that it was messing up my code with constant logging calls.

Share this comment

Link to comment

Yes, I certainly think that logs have their uses and misuses. I believe limiting log output to startup, shutdown, and critical events is probably a good idea. It is probably also good practice to enclose logging calls inside some #define blocks so that once you find yourself not going back to view the logs, you can remove the overhead easily from your code.


Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!