The sake of this post is going to be steps I've personally learned to take in optimizing a function, so please feel free to fill me in on something I don't know, add further comments or ask questions. I'm still an aspiring programmer, and thought it would be cool to have a "full fledged" math library that I could tie into my game engine that's cross-platform in nature.  As such, I thought if I ever needed my own data type, it would be useful to be able to perform mathematical operations on it, which means I might need my own math library; of course I could try converting to a format supported for the hardware, as it'd typically be faster, but at this point I'm more concerned about learning what goes on behind the math library.  And for whatever reason, if you needed a higher precision, then you'd need a custom math library anyway.

So, recently I started looking up how to program a sin function; I didn't find much, but I did find a Wikipedia article that detailed a mathematical model for sin, which you can find here: Trigonometric functions - Series definitions.  You can view the function below:

Now I'm going to write this function in C++, and the main question we're looking at here is: How do I go about optimizing a function?(Not so much concerned about language semantics as basic fundamentals you should try to apply in just about any language) Here's the function quickly typed up, notice I chose to write it as an iterative function than as a recursive function.  A recursive function will always be slower than an iterative function, which are not the details of this post, but it has to do with the stack and storing return variables and unwrapping the stack, etc.

1. Try to always write your performance function as an iterative function rather than a recursive one.
``````// size_t n, is the number of loops; the higher number of loops, the higher the precision
template <class T>
inline T MathUtil<T>::Sin(const T& val, const size_t n)
{
T num = val;

for(size_t i = 1; i <= n; ++i)
{
size_t odd = 2 * i + 1;

// Factorial is written elsewhere
num += powf(-1, i) * powf(val, odd) / Factorial(odd);
}

return num;
}``````

Which you could use like this:

``````double result = Sin<>(1.0,12);
// or:
result = Sin<double>(1,12);``````

So this is a very simple function, and in release mode runs close to what the real thing does.  Here's the results in debug: my sin: 3.57916ms std sin: 0.346908ms   If you look back to the image, you'll see (-1)^n.  This function merely alternates the addition and subtraction of our function, which can be simplified to this:

``````// size_t n, is the number of loops; the higher number of loops, the higher the precision
template <class T>
inline T MathUtil<T>::Sin(const T& val, const size_t n)
{
T num = val;

for(size_t i = 1; i <= n; ++i)
{
size_t odd = 2 * i + 1;

// Factorial is written elsewhere
if(i % 2 == 0)
{
num += powf(val, odd) / MathUtil::Factorial(odd);
}
else
{
num -= powf(val, odd) / MathUtil::Factorial(odd);
}
}

return num;
}``````

This results in new times (remember, times will vary): my sin: 2.68451ms std sin: 0.348312ms Notice this does help our performance, though it's frankly a minimal change.  There are a few more things we can simplify out that are crucial, we're redoing the factorial calculations, as well as the power calculations every loop.  We can add these operations up through the loop.  Look back to the image, you'll notice as we through the loop, we'll start with 1!, then 3!, then 5!.  We're iterating through odd numbers, and we can compound the operations as 5! contains 3!: 5 * 4 * 3!.  3! contains 1!: 3 * 2 * 1!.  So we just need to have a variable to store the factor total, and the number we're currently on; multiply the stored total by the number - 1 and the number, as shown before.  Again, if we're in the loop at number 7, then we have 5! stored from the previous loop, multiply that by 6 then by 7.  In the next loop 7! x 8 then by 9.  Etc.  We can also do this with the odd exponent.  We now have the new function below.

``````// size_t n, is the number of loops; the higher number of loops, the higher the precision
template <class T>
inline T MathUtil<T>::Sin(const T& val, const size_t n)
{
T num = val;

size_t factNum = 3;
size_t factTot = 1;

T mult = val;

for(size_t i = 1; i <= n; ++i, factNum += 2)
{
mult *= -val * val;

factTot *= factNum - 1;
factTot *= factNum;

num += mult / static_cast<T>(factTot);
}

return num;
}``````

So we got rid of the factorial and power functions all together. So this is something you want to keep in mind when trying to make functions faster, try to minimize your function calls as much as possible, I chose "val * val" instead of "pow(val,2)" for this reason. You remember how we have to alternate adding and subtracting over the odd numbers? I do this by negating val and storing it in the variable mult which will flip sign every loop, doing just what I wanted; this is better than the first two solutions. Here's the results: my sin: 0.586781ms std sin: 0.351613ms

1. Minimize function calls as much as possible, get rid of any that you can.

And as we already started to do...

1. Try to simplify the mathematical operations, using any tricks based off of patterns and mathematical properties you notice.

Anything else we can do? Look back at the image of our functions and refer to some of the variables we're now using. We're trying to simplify the exponential and factorial calculations using a factorial total and mult for the exponential totals. As we're using multiplication, we can concatenate the results from an earlier part of the equation and use it for a later one so we have to do less calculations.

``````// size_t n, is the number of loops; the higher number of loops, the higher the precision
template <class T>
T Sin(const T val, const size_t n)
{
const T val2 = -val * val;

T num = val;

T mult = val;

size_t factTot = 1;

const size_t odd = 2 * n + 1;
for(size_t f = 3; f <= odd; f += 2)
{
mult *= val2;

factTot *= f - 1;
factTot *= f;

num += mult / static_cast<T>(factTot);
}

return num;
}``````

I'm still looking into other ways to improve this function, but this is all of what I have thus far.  Notice I moved "-val * val" to it's own variable so it's doing one less negation and multiplication every loop of the algorithm; it doesn't affect t he performance that much, but it's something that seems to me should be done.  I'm currently reading this paper on Optimizing C++, which I highly suggest you give it a read, as well as consider reading this site on Writing Efficient C.  You'll notice that in Optimizing C++ they mention that it's a performance hit to switch between integers and floats, however, the extra time in the algorithm to calculate factTot and f as the float calculations override that performance concern, so what I have above is the best way from what I've tried, by casting factTot to double, or whatever type you're using, and dividing it by mult. The following is the test code I used to generate my results:

``````Benchmark std = Benchmark();
for(int i = 0; i < 100000; ++i)
{
std.Start();
double result6 = sin(1.0);
std.Stop();
}
Sleep(50);
for(int i = 0; i < 100000; ++i)
{
std.Start();
double result6 = sin(1.0);
std.Stop();
}
Sleep(100);
for(int i = 0; i < 100000; ++i)
{
std.Start();
double result2 = sin(1.0);
std.Stop();
}

sTrace(make_string() << "std    Sin:" << std.Get_AvgMicroSeconds() << "ms");
sTrace(make_string() << "std MinSin:" << std.Get_MinMicroSeconds() << "ms");
sTrace(make_string() << "std MaxSin:" << std.Get_MaxMicroSeconds() << "ms");

Benchmark mys = Benchmark();
for(int i = 0; i < 100000; ++i)
{
mys.Start();
double result6 = Sin<double>(1,6);
mys.Stop();
}
Sleep(50);
for(int i = 0; i < 100000; ++i)
{
mys.Start();
double result6 = Sin<double>(1,6);
mys.Stop();
}
Sleep(100);
for(int i = 0; i < 100000; ++i)
{
mys.Start();
double result6 = Sin<double>(1,6);
mys.Stop();
}

sTrace(make_string() << "my    Sin:" << mys.Get_AvgMicroSeconds() << "ms");
sTrace(make_string() << "my MinSin:" << mys.Get_MinMicroSeconds() << "ms");
sTrace(make_string() << "my MaxSin:" << mys.Get_MaxMicroSeconds() << "ms");``````

What the results show you is the average run-time, the minimum run-time, and the maximum run-time during my benchmarks.  Here is my first set of results in debug x64:

```std    Sin:0.15552ms
std MinSin:0ms
std MaxSin:61.4676ms

my    Sin:0.194272ms
my MinSin:0ms
my MaxSin:61.4675ms```

Here is my second set of results in debug mode x64:

```std    Sin:0.154726ms
std MinSin:0ms
std MaxSin:48.567ms

my    Sin:0.192029ms
my MinSin:0ms
my MaxSin:55.7761ms```

Here is a result from a release build x64:

```std    Sin:0.0923657ms
std MinSin:0ms
std MaxSin:48.9464ms

my    Sin:0.0920976ms
my MinSin:0ms
my MaxSin:24.2835ms```

Here the next result from the same release build x64:

```std    Sin:0.0919509ms
std MinSin:0ms
std MaxSin:4.55315ms

my    Sin:0.0920293ms
my MinSin:0ms
my MaxSin:10.624ms```

Result from release build x32:

```std    Sin:0.190925ms
std MinSin:0ms
std MaxSin:184.78ms

my    Sin:0.187989ms
my MinSin:0ms
my MaxSin:173.777ms```

Result from the same release build x32:

```std    Sin:0.183714ms
std MinSin:0ms
std MaxSin:25.4215ms

my    Sin:0.183407ms
my MinSin:0ms
my MaxSin:77.0233ms```

Just as a disclaimer, for those of you who don't know, these kind of benchmarks aren't an end-all be-all of determining what is or isn't better.  Also, my benchmark util has it's own overhead so your own results may be different if you compare algorithms, though the results should be comparatively similar.  And, obviously these functions didn't take 0ms, it has to do with the accuracy of the timer, which uses the Windows function QueryPerformanceCounter and QueryPerformanceFrequency, which I've read are accurate only to 1ms and these measurements are smaller than that.  I'm running an Intel Core i7 920 and during these tests was clocked at just 2.8322GHz. It seems this algorithm runs close enough to the standard solution, however, keep in mind that depending on the hardware you're using that the standard function could be calculated using hardware and could be even faster; unless of course my build is already doing that, then I'd be impressed at how well this algorithm is running.  You can also use this algorithm with smaller precision Sin<double>(1,3) instead of Sin<double>(1,6).  In case you couldn't gather, the first number is the number we're taking the sin of; and the second number represents the amount of looping being done to increase the precision, so the higher the number the higher the precision.  Realize however, there is a point where these floating point calculations won't be accurate due to the limitations of double and float.  There should be a function to calculate the level of precision necessary for each data type for this algorithm, I just don't have it at my fingertips at the moment.  Frankly these numbers start to not mean too much as it's hard to get accurate results, but this was more of an academic goal than anything, so it's up to you if you'd find something like this useful.  Honestly, this endeavor was so I could learn how to program a sin and cos function so I can program a compile time version which has no run time costs; it has limited uses, but is still something that is cool and useful.  I'll detail this in a later post, but for now, here's the cos version of this algorithm, which builds off of even numbers instead of odd numbers.

``````// size_t n, is the number of loops; the higher number of loops, the higher the precision
template <class T>
T Cos(const T val, const size_t n)
{
T cosResult = 1;

size_t factorialTotal = 1;

T multiplicationTotal = 1;

const T val2 = -val * val;

const size_t even = 2 * n;
for(size_t f = 2; f <= even; f += 2)
{
multiplicationTotal *= val2;

factorialTotal *= f - 1;
factorialTotal *= f;

cosResult += multiplicationTotal / static_cast<T>(factorialTotal);
}

return num;
}``````

This is used similarly to the sin function, Cos(1,6) or Cos<>(1.0,6).   I have done everything I sought out to do with this post, and I'll continue to experiment and see if I come up with anything else while doing more reading on C++ optimization, thinking if there are other algorithmic shortcuts I can make (Yes I realize there wasn't tooo much optimization I did here, it was merely doing what I needed to, to reduce the factorial calculations and other multiplication.  Also, again, these basic steps for optimization are general things to keep in mind. ).  I'll post updates when I find something, or if you have something you'd like to contribute please feel free, this is a good learning opportunity for all of us! (: [UPDATE - 11/9/2011] I forgot how large factorial results could get, and recently realized that as I'm compiling for Win32, size_t won't get me far for storing said results.  So, rather than just changing it to a long long or something, I'm changing it to be the same datatype as specified by the template, even if it means a little calculation cost time of not using integers.  Actually, if I used a custom datatype with a large precision, I would need to do this anyway, otherwise the function wouldn't be very precise. Anyway, this update comes as I somehow stumbled across this site:  super fast trig functions.  And a disclaimer for this thread, they're not really any faster than the built in solution unless you are willing to lose precision, which the specified functions don't specify as they loop until "INFINITY".  If you want super fast trig functions, you should look into something like Cordic functions, as mentioned in the Game Engine Gems 1, the important part being that you only need to use integers to calculate sin; though of course, it's an approximation, and there are other integer based methods besides this one as well if you do a little digging. So, here's the final sin function with the little tweaks:

``````template <class T>
T Sin(const T val, const T n)
{
const T val2 = val * val;

T num = val;

T mult = val;

T factTot = 1;

const T odd = 2 * n + 1;
for(T f = 3; f <= odd; f += 2)
{
mult *= -val2;

factTot *= f * (f - 1);

num += mult / factTot;
}

return num;
}``````

I realized from reading the mentioned thread on super fast trig functions, that I can cut a few things out of my function. I'm maintaining a variable for storing the exponents and the factorial results, which can both be cached in a single variable with the risk of the loss of a little precision, which isn't a big deal from what I've tested; actually, it still provides pretty accurate results.

``````template <class T>
T Sin(const T val, const T n)
{
const T val2 = -val * val;

T num = val;

T expDivFact = val;

const T odd = 2 * n + 1;
for(T f = 3; f <= odd; f += 2)
{
expDivFact = expDivFact * val2 / (f * (f - 1));

num += expDivFact;
}

return num;
}``````

So, the above Sin function is probably the fastest using the theory of Taylor series; though of course there might be other tweaks one could make.   If you want something faster look into this: CORDIC.

Just a shoutout, I'm not dead, just trying to figure out things in my life!  I'm working on a blogpost concerning a multi-threaded load balancing server, am re-organizing and working more on my Warp engine, though with starting anew I may rename the engine and lead it in a slightly different direction.

Concerning what I'm trying to figure out: I had lost hope in going to gradschool given that I would be in debt for a ridiculous amount of money with my combined debt from undergrad and the cost of the program as well as the cost of living.  However, financial aid may save me, maybe.  I was planning on applying to various game development companies, but I'm not going to say as to not hurt my chances. ;P  Even with the possibility of financial aid saving me, I've grown a bit fond of the idea of getting a job now, as there's going to be a lot more competition in 2 years from all the new game development programs that have popped up.  So, maybe I will just try getting a job in the industry, as it'll be harder down the line.

I just bought Masters of Doom, and I must say it's quite good thus far.  The book concerns the two Johns, John Carmack, and John Romero, the founders of Id Software, the creator's of Doom, and pioneers of the First Person Shooter (otherwise known as the FPS, for those of you who don't know).  So, important guys.  I've found it interesting and comforting to know that both of them at my age hadn't quite settled down yet, so I still have some time. ;p  Just graduating, and the condition of the job market, I can't help but feel a little anxious.  I would also like to point out that this book is so far quite inspiring, and as the fire of my passion has been a bit lacking in fuel, this is re-ignited it a bit.  So I must say I'm glad I picked up this book! :)

I'm possibly starting a new project, though thinking about the undertakings I'm planning on scaling it back a bit.  Essentially I'm looking into creating a Farscape fan-game, mainly for educational purposes, at this point anyway.  The Farscape game that was made, was a let down to fans, it seems.  As such, I wanted to take a stap at it, modeling the game after Mass Effect and the Star Wars role-playing games, possibly bringing the game into an MMO form.  I've been doing networking lately, and would love to setup the possibility of players running dedicated servers and having a Farscape universe that they could sculpt and explore.  Of course, the reason I want to scale back, is that I realize there is a lot of content creation that would be needed; and right now the art assets needed for the game, are too great in magnitude to make this feasible with the small number of people that would originally be involved.  If anything, I'm going to start by making a tech-demo of sorts and using it to attract people who want to devote time and effort to the project.  You can find a thread concerning project ideas here: Farscape video game? We're trying to gather ideas, so please feel free to post there or on this page! :D

Anyway, I'm working on designing an interface for my networking solution, then reprogramming the backend so a server can support more users, and use the appropriate Windows functions to calculate how many connections can be supported on a port.  So, I'll be messing around with lots of C++ networking, and doing research and coming up with ideas for how to deal with security issues that may arise.  Look forward to more details!

I find my life to me quite busy, and there never seems to be enough time in which to complete everything I want to complete. Because of two classes, Computer Graphics 2, and Foundations of 3D, I find I don't have as much free time as I'd like.

I have to work on my ray tracing homework, which I need to rewrite to be multi-threaded, and improve the organization and design of it. I have to work on a project which uses that same ray tracing framework, and add a UI to it. For my 3d project I also need to add a UI. For this other personal project, Upwards, I need to finish the HUD stuff. Also for 3d, I'm working on a multi-threaded server with load-balancing capabilities. I'm also working on my own personal engine Warp, during the process of all of the above. I'm finishing up a Graduate school application for SMU. Also, my gf is staying with me, so I have to take care of her; however, I think she's helping me relieve stress, so I'm really glad she's here.  (Thank youu Becky! :O<3 )

On top of it all, my parents want me to use my free time to apply to jobs and try to get my life figured out before I graduate.   Um yeah, what free time again? I'm at school, and it's consuming my life, I don't have much time for anything else.  Thanks for being loving and considerate though.

So, there's a lot of research and development I want to do, as this is an educational endeavor and I love learning new things.  Something I've seen a need for, is a bit buffer for the manipulation of bits; I've already started writing one for my huffman coding exercise, though I think if I put it into my engine I'll want to rewrite some things.  I also want to look into various techniques for compression, though also even writing a float class that's not just 32 bits, perhaps 24 or even 16 bits; I just have to look more into the storage format and see how much precision I lose by doing this.

FARSCAPE! Frelll this is an awesome show! ;D

On that note, my girlfriend Beck has mentioned the possibility of us working on a Farscape fan game.  Turns out there has already been a Farscape game, but from what I gather it sucked.  Here's a vid you can check out of the old game: Farscape: The Game gameplay video And here's a page with some reviews: Amazon. Doesn't seem like the game did very well, or was any good at least.  From briefly thinking about it, I'd model the game after Mass Effect or Knights of the Old Republic.  After talking about it a little, I figured the player shouldn't be able to play an existing character; the player would get to follow a new character, an addition to Moya.  I think I want the game to play out like a Shooter RPG, and leveling up a character and customizing them doesn't make much sense to me on an already developed character.

Anyway, making a Farscape fan game is merely an idea at this point, if not one to help drive the development of my engine.  But, if you have comments concerning this "project," please feel free to drop me a line.

[Disclaimer] I'm a fairly new Farscape fan, and still haven't seen all seasons.

[Disclaimer : All benchmarks were done in debug mode on an i7 920 system with no compiler optimizations]

After browsing some cool C++ util functions today on StackOverflow, one of the cool util functions was for trimming strings, so I became intrigued and decided to compare them against my own, as they used some cool C++ std library tricks that I've never seen before. After doing benchmark tests, I was excited to find my own implementation appeared to blow his out of the water. After 1,000,000 tests, his averaged about 27 microseconds, while mine at first averaged less than 5 microseconds. After tweaking mine a bit, my trim_trailingWhitespace function averaged close to 4 microseconds after averaging 1,000,000 samples. Also to note, his function works directly on the original string, while mine returns a new copy; so it's even more impressive.

Here's another benchmark using 1,000,000 samples.
Using the following string: "          "
His: 37.88 microseconds
Mine: 4.03 microseconds

Benchmark 3 using the same # of samples as before.
Using the following string: "  The world ends with you!   "
His: 30.37 microseconds
Mine: 6.26 microseconds

The reason for this post, is because I was excited to find out my implementation is extremely fast, and I felt like sharing it with the world to see if it's possible to do even better! I'm still thinking of ways to improve my functions, but please let me know if you can best me in any way, I'm here to learn!

The only header you should need is the following, with the proper using statements too of course:

```#include <iostream>

using std::basic_string;```

This is the trim function used by my trim_trailingWhitespace

```template<typename CharType>
static basic_string<CharType> trim(const basic_string<CharType>& str, size_t index, size_t len)
{
size_t length = str.size();
if(index >= length)
{
return basic_string<CharType>();
}

length -= index;
length = length > len ? len : length;

return str.substr(index, length);
}```

And this is my function to trim the whitespace at the end of the string:

```template<typename CharType>
static basic_string<CharType> trim_trailingWhitespace(const basic_string<CharType>& str)
{
size_t length = str.size();
if(length == 0)
{
return str;
}

register size_t index = length - 1;

while(' ' == str[index])
{
if(index != 0)
{
--index;
}
else
{
return basic_string<CharType>();
}
}

return trim(str, 0, ++index);
}```

You'll notice I'm using some funky template stuff here, and basic_string; this will allow you to use whatever kind of string encoding you want, 1Byte ASCII characters (string), or 2Byte unicode characters (wstring), or whatever. And the beauty of it is, if you pass in the proper string type, like string or wstring, you don't need to define the template parameters; your compiler will automatically fill them in for you so you only just need to call the function name without worrying about the template details!

I haven't gotten a chance to rewrite my trim_leadingWhitespace function, so that will be coming soon; and yes, I will rename these once I decide upon a better name.

After doing some further research I stumbled across this implementation.  I realized my above comparison to the first algorithm wasn't entirely fair as the implementation wasn't even competitive, even though it worked in-place.  So, here's the source for an actually efficient implementation of rear trimming white space:

```void rtrim(string& str, const locale& loc)
{
string::size_type pos = str.size();
while (pos > 0 && isspace(str[pos - 1], loc)) pos--;
str.erase(pos);
}```

By replacing the isspace with ' ' == you can make this function much faster, though obviously this works with our locale, and may be different across other languages. Another possible reason this isn't as fast as it could be is because of the str[pos - 1], he's doing an extra calculation per loop besides the pos--. His solution gets around the problem of using an unsigned int (size_t) that mine originally had, but lucky for me my rewrite made mine even more efficient because of this trick he had to do.

And here's the details on isspace. I think my check works fine for both string and wstring and the like; if not, please let me know.   You could pass the locale space/seperator in as a parameter to the function if that's an issue.

As the above solution works in place, I decided to tweak my original function to work in place on a string, and am excited to say that it beats out this obviously improved implementation.  Here's my new in-place implementation:

```template<typename CharType>
static void trim_trailingWhitespace(basic_string<CharType>& str)
{
size_t length = str.size();
if(length == 0)
{
return;
}

register size_t index = length - 1;

while(' ' == str[index])
{
if(index != 0)
{
--index;
}
else
{
str.clear();
return;
}
}
str.erase(++index);
}```

So, my implementation provides shortcuts for an empty string, and for the case the entire string contains spaces (where you see str.clear()). It also provides an interesting way to loop through the string compared to the other implementation, allowing mine to be a bit quicker, probably because I only have to use str[index] (besides the above mentioned shortcuts).

Benchmark 1:
String: "      "
His: 2.97 microseconds
His + my tweak: 2.68 microseconds
Mine:2.54 microseconds

Benchmark 2:
String: "  The world ends with you!   "
His: 3.93 microseconds
His + my tweak: 3.68 microseconds
Mine: 3.65 microseconds

As noted at the header, the above tests were done in debug mode with no optimizations.  If you turn on optimizations you'll notice the two algorithms at the bottom here are neck and neck, it doesn't really matter what you use.  Heck, if you look at the algorithm from StackOverflow that's not nearly as efficient in debug, suddenly becomes nearly comparable.  Though, it's still nice to have a code that runs fast in debug too; but it does raise the question whether it was worth the time to do this research; as they say, don't optimize until you have to.  It's been a nice educational endeavor so far, so I don't really care if it might be considered wasted time, as I've learned more than a thing or two.  Thoughts?

And here's the link to the StackOverflow page of useful C++ utilities: Most Useful C++ Utils.

Here I sit, among fellow Game Design and Development (GDD) students in the GDD Computer Lab, my last quarter at Rochester Institute of Technology. There are so many things I want to do, and only so much time to do it; there's so much research I would love to do, but I'd have to sacrifice too much of my personal life, besides I'm not being paid to do it yet anyway. So, I've come to further realize, I think I would love to be paid to do research in the Video Game programming, related to graphics, user tools, etc. etc. There are A LOT of things I could do with user tools alone, especially when it comes to graphics, and it's something I'll be doing a bit of during this quarter so I can get a platform-independent Gadget System (UI and Application system) working!

I'm actually a little sad I haven't posted to my blog more, as there's much I want to share with the world, and I would love it for people to see I'm bursting with ideas and helpful thoughts.  I have knowledge I want to share with the world, to help make it easier for people like me to get started and break into developing video games!  So, I'll have to start tackling this more.  I have a Matrix Tutorial/post I plan on releasing, it'll be about using them in games, not necessarily implementation; as from a programmers perspective, you don't need to know about the implementation to use it, as long as you understand it.  There is soo much math behind all that goes into video games, and it would take a long time to get a grasp and derive every single thing that goes behind it all.

Right now I'm working on some utility functions, setting up a INI file for loading, saving, and editing INI files.  From there, I plan on setting up a Settings class where you can setup automatic loading from the INI file; I was tossing around the idea of being able to monitor an INI file in realtime so if you make a change to it your settings will load them up, which in response will throw events and re-apply the settings to your current game.  This seemed like a powerful debugging feature, though obviously should be a configurable option.

I think I may make a post on tools ideas, or at least make a post on the gadget system I'll be working on.  One of the tools I thought would be neat would be to use a networked mouse or keyboard, which in reality is more useful for consoles, but I thought still could be a powerful feature.  I know I can't wait to add networking features to my engine, I want to be able to use FTP or something like it for streaming files, either for transferring levels mid-game for user content, distributed processing, or what have you.  I also thought it would be neat to pull in files from the web as well, though I'm not yet sure if it's entirely necessary yet; granted, I haven't thought about this in a while.  I pretty much plan on using gadgets for managing everything that I can in the engine, to make it as easy as possible to work with, so you can tweak things in realtime with the utmost control.