Jump to content
  • Advertisement
  • entries
  • comments
  • views

Codin' Frenzy!

Sign in to follow this  


Wednesday, October 20th

Well I managed to accomplish quite a lot in just four hours of coding tonight. I'm still working on Tanto, the log reporter for my Katana engine. I started posting about it back on the 1st of this month. Tonight my goal was to code the log data loading system, which I did - yey. I only coded in loading for text output messages, but that's a good start. Some highlights:

I was stymied for a bit trying to decide how to define what output type got assiged what color. At first I thought of just randomly choosing RGB values, but that could produce colors that wouldn't read well on the screen. Finally I came up with using an image as a palette. I simply create a bitmap with each pixel a different color, aligned in a row. I then load in the bitmap, lock the surface, and use a GetPixel() function to get and store the color of each pixel. Ta da! Now I have colors to assign to text output types, and I can change those colors without having to recode anything.

Another problem I had was a result of a new feature I wanted to implement in my loging system. Currently the logger dumps everything to a file in real time. This can drag performance, having to keep a file open and writing to it possibly dozens of times per frame. Instead I want to impliment a memory buffer and a dump limit. So when something's sent to the log system to be outputted to a file, instead it's stashed in memory. If the used memory exceeds a set limit, it dumps its contents to a file and clears the buffer for new data. So if you have a small buffer and play long enough, you could end up with more than one log file. The multiple log files will have numbered extensions, like RAR files: debug.log1, debug.log2, debug.log3, etc. When the app shuts down, it will dump the remains of the buffer into debug.log, along with the log header. Now, how do I open and input data from multiple files? I don't use recursive functions much, but this was a situation too good to pass up. The user opens the main log file (with the .log extension) and at the top there's a batch number. The function then appends that batch number onto the log file path and calls itself. So say we have 3 batch files:

// opens file, batch number is 3
// opens file, batch number is 2
// opens file, batch number is 1
// opens file, batch number is 0
// begin loading data
// load data
// load data
// finish loading data

Suhweeeeeet. Thanks to the wonderfulness that is recursion, I can now dump log data into multiple log files, and then load that data in proper order. Take notes kids.

So that's really all the cool stuff I did tonight. Now that I've figured out the new format for my log text, I can change the way I log stuff in the engine. I've got this warm happy fuzzy feeling you get when know you've coded something proper. I'm going to wait until tomorrow to test it, because my fuzzy feeling'll prob go away quick when the damn logistical errors crop up, like they always do.

So... off for some cherry pie, cookies and brownies - celebration time for a job well done!
Sign in to follow this  


Recommended Comments

  • Random Observation of the Day!!!!
    Brownies and Coke do NOT, I repeat, do NOT mix well!!

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!