You are currently browsing the archives for the Open Source category.
- 3D Stuff (12)
- AI (1)
- BumpTop (5)
- C/C++ (22)
- Open Source (8)
- Radiant (11)
- Seneca (6)
- Stuff (17)
- The Mortal Realm (2)
- Uncategorized (14)
- win32 (12)
- July 9, 2010: On Visual Studio 2010...
- December 22, 2009: Efficient Rendering, A La Mark.
- December 3, 2009: A Simple Opponent
- December 3, 2009: Blog++
- September 7, 2009: Food Budgeting
- July 3, 2009: Too Busy...
- March 26, 2009: How Do Patents Apply To Me?
- February 27, 2009: U.S. And Human Rights
- February 7, 2009: I've Been Busy...
- November 10, 2008: Radiant Update
Archive for the Open Source Category
Food Budgeting
September 7, 2009 by Mark.
A food budget is a little bit different then a financial budget because you are budgeting quantities of ingredients rather then a lump sum of money. It is something that my wife just introduced me to and I am very excited to start doing it. Say you purchase a pound of ground beef but you only use up half of it. For example, rather then making the same dish again in order to use up the rest of the beef, you could make another dish with that exact amount of beef. However, she is having a difficult time trying to manage the data especially when you have more then one or two ingredients to work with.
So, I’m setting out on a journey to build her an application that would manage a database of ingredients. It would link the ingredients table with a table of recipes, making it easy to search. To be honest, I’m not a database person. In fact I have not done any DB work since first year at Seneca. I might need to pull out my old text books in order to re-learn how to use a DB. I’m thinking of using SQLlite for the back end and straight up C++ on the front end (though C# has crossed my mind). It will be all open source obviously.
Posted in Open Source, C/C++, Seneca | No Comments »
How Do Patents Apply To Me?
March 26, 2009 by Mark.
I’ve been diligently working on a scene partitioning system which combines an Octree with a Uniform Grid. Basically, the way it works is that you build a loose Octree, which starts 4 levels deep. When each node reaches a critical mass, it subdivides into another level. The max levels you can have (While still being optimal) is 7. So, let’s assume that we have a detailed scene with a 7 level Octree. At the bottom of the Octree, each node is 128th the size of the entire area you are encompassing and it is also uniformly proportional to the entire area. You can build a Uniform Grid out of the bottom most nodes giving you the best of both worlds.
When all this is built, to add and remove items from the grid is a matter of doing simple division of finding out the exact spot in the Uniform Grid where the object belongs. Since pointers are being shared between Octree Nodes and Uniform Grid Nodes, you essentially add an item to the Octree in O(1) time (Adding to a Tree structure usually Takes O(Log n) time). Collision detection with simple objects is O(1) time while with complex objects it is O(Log n) time. What I have done is made the Octree a bit faster in some areas. Good idea, isn’t it?
Here is my problem. While randomly googling on this topic, I found a patent for this idea. The patent is very similar to what I just described. What I want to know (For all you Law junkies out there) is how does this effect me? Can I get sued? Does it matter that my implementation is my own and not copied from the patent? Does it matter that my implementation is Open Source? Are there ways to get around this patent (My implementation is different but algorithmically similar)?
Any suggestions are welcome.
Posted in Radiant, Open Source, 3D Stuff, C/C++, Stuff | No Comments »
Results
September 7, 2008 by Mark.
I finished writing my own Thread Pool subsystem and then put it through its paces. The results are obviously not that shocking because anything that is multi threaded is more efficient on dual core machines. The machine I was running it on has a AMD Turion 64 X2 CPU and sports two 2.0Ghz cores. It’s not the best machine but its quite speedy for what it is.
Anyway, as I mentioned in the previous entry, threads are great and run best when they have a dedicated core. When there are more threads then cores, the OS then has to time-slice in order to give the threads equal time on the CPU. Having a dual core machine, the optimal amount of threads that I can handle is 2. The following is a graph of the time it took to process 50,000 square root calculations, 100 times in succession:

On the first run, I did not use any threads. Rather, I let the calculations run in sequential order on the main process. The blue bar represents the thread priority at normal and the purple bar represents the thread priority at Highest. I did this in order to measure the speed difference between the normal and highest priority setting. I should also note that even though the thread priority can be manipulated, it is up to the OS to enforce that. In some cases the OS may decide not to enforce the request for higher priority and give the processing power to other threads.
The second and subsequent runs were using the Thread Pool with an increasing allotment of threads. Each 50,000 calculations were plugged into its own Job and sent off to a worker thread. Having only one thread was not much of a boost over a single process (Took about 1920ms). The main process was put to sleep using the WaitForSingleObject() function call while the worker thread did the processing. At two threads there is a massive increase in time. Just as one would assume, the amount of work was spread over two cores and the time it took to process it all was cut in half (About 950ms). This is the optimal amount of work my CPU can handle because each thread has a dedicated CPU core. Increasing the amount of threads actually increased the amount of time it took to process the calculations. The reason being is that the OS had to time-slice the different threads on both cores. The time increased by about 20ms each time I increased the number of threads.
Thread Pools are very efficient at what they do. As mentioned in the previous entry, creating a thread and destroying a thread could have increased the amount of time required to process a batch of 100 calculations. Regardless, the work I done is Open Source and as is my engine. You can download it here (I’m not responsible for unexplained fires, deaths, or alien abductions due to using this code).
Posted in Radiant, Open Source, 3D Stuff, C/C++, win32 | No Comments »
Work++;
June 4, 2008 by Mark.
Some of you may know already that I have received an employment opportunity from a company called Parallel Worlds Labs (PWLabs). I took the job without hesitation for several reasons. Firstly, my yearly salary was increased substantially. To some, this might have been enough to switch companies, but for me, it was not the main reason. Secondly, PWLabs makes 3D, interactive games and displays for museums and other such institutions. I saw this as my chance to pursue a career in Game/Graphics programming. Lastly, its mostly a work form home job, so my commute time is cut down from 40mins to about 10 seconds (The time it takes me to walk into my living room). So, as you can see, I am thrilled to start my new job.
Unfortunately, this will mean that I will be leaving my ever-vigilant post at BumpTop. The last year flew by quickly and from my perspective as a code monkey, it was not a bad job. Code was my passion and focus. I literally re-wrote the vast majority of BumpTop, made it stable and robust, and its something I would definitely put on my portfolio.
Posted in Open Source, C/C++ | 2 Comments »
SIMD And Randomness
May 20, 2008 by Mark.
Alright, I ended my zealous trek through the inner workings of SIMD just because I wasn’t using it enough in my project. Don’t get me wrong, its a really nice piece of technology to dabble in, especially when doing math on a large scale (say, Matrices). But for the day-to-day programmer in me, I really don’t get to use it as much as you might think.
But, I’ve done some detective work and most compilers nowadays optimize the code in such a way that SIMD gets incorporated automatically. Therefore, learning SIMD should be put in the same category as learning Assembly. Its nice to have but in reality it will be rarely used, if ever. I have a feeling that I’ll run into a situation where SIMD is required and its the only thing that can save the world from total destruction. Well, until then, I’ll just shelve it.
On the bright side, I finally gave my game/rendering engine a real name: ‘Radiant.’ I don’t know why I named it that, and for some reason, I never second guessed it. It was one of those spur of the moments that I hit F2 and started typing. Don’t ask me what or why, I’m still in the wilderness on that one. Anyway, progress on the engine is a bit slow just because the only time I get to work on is during bus trips to and from Hamilton, or other places. If there were more hours in the day, I could actually get something done.
I should also say that I’ve re-worked the way the engine is laid out because all my singletons were not working well with DLLs (I think I wrote about that, somewhere). This quickly because a mess. SVN likes things to be done in order and in small chunks, else it starts bugging you about cleaning up the repository. I like to do things in big chunks, literally taking a +1 Battle Axe to the tree and then rebuilding it from scratch. Bad tactic, I know. Lets just say, SVN was in pain. Poor thing.
As a side note, I found out something interesting today about the MSVC build system; It supports multi-core compilation! Its like your own distributed build but on your own machine, Hooray. More on this later.
Posted in Radiant, Open Source, 3D Stuff, C/C++ | No Comments »
To OSG, or not to OSG.
March 17, 2008 by Mark.
I have been working on my game engine (Which still does not have a name; Suggestions are appreciated) for a while now. It has seen its share of refactors ever since I started on it back in 2006. But recently, I have come to a fork in the road. I am overwhelmed with the amount of things that I need to keep track of which makes me second guess some of my design decisions that I have made. One of which, is weather or not to write my own scenegraph or to use a stock one, say, OpenSceneGraph.
From experience, I can tell you that the amount of time that it would require to learn, implement, and test OSG’s implementation would be comparable to the amount of time it would take me to write one from scratch. I have been plagued with these sorts of decisions ever since I started the rewrite of my code. The benefits of using a library over writing your own can only be determined by the ease of use of the library. For example, if its easy to build, incorporate and debug then it probably is better to choose it then to write one from scratch. In the case of OSG, the library is big. No, its Massive!
I am still not convinced that OSG would be worth using over my own implementation, simply because of the learning curve and the work required to properly incorporate it into my engine. I would literally have to wrap my engine around OSG, rather then have it work symbiotically. That just does not sit well with me. Regardless, I will still poke around inside OSG and learn how their scenegraph implementation works.
Where is my trusty Bearded Axe, its time for some hacking!
Posted in Radiant, Open Source, 3D Stuff, C/C++, Stuff | No Comments »
Et Tu Singletone.
February 12, 2008 by Mark.
Seems that my favorite pattern is also the bane of my current Game Engine development. Turns out that a singleton pattern doesn’t like to play nice with Dynamically Linked Libraries. The whole notion of being dynamic is counter productive to static members inside functions or classes. Looks like the only way to actually fix this is to wrap it all up in a big handler of some sort and have the calling code manage it. Either that or create a section of shared memory in the DLL and allow it to manage the singletons. Seems like a bit of a pain in the butt just to avoid a global variable. Hmm, unless I can wrap it in another creational pattern, possibly Builder or Abstract Factory…
More research is required. And research requires Tea. Therefore more Tea is required.
Posted in Radiant, Open Source, 3D Stuff, C/C++ | No Comments »
At A Crossroads.
February 11, 2008 by Mark.
On my spare time (if there is such a thing), I have been slowly putting together my Game Engine. The foundational stuff is pretty much written and tested and I am just about to start writing the heart of this engine, the renderer. But as I’m thinking about the code structure, I am also debating if I should stick it out on the web as an Open Source project. I read up on a bunch of licenses but none of them were exactly what I needed. The type of license I’m looking for is one that would credit my name whenever it is used or redistributed. Also, it would force people who wants to use it for commercial use to cough up some coin. In other words: free for personal use, not free for commercial use, and my name to be always credited. Anyone know of a license like this?
One of the licenses I found useful was the MAME license. I might ask its author for a copy. On another note, I just set up an SVN server to host my engine. Also, I am slowly putting together a webpage for this project so people can easily find it. I’ll post the link soon.
EDIT: Dave advised me against using some of the lesser known licenses and advocated LGPL. I’m going to give LGPL a thorough read.
Posted in Radiant, Open Source, 3D Stuff, C/C++, win32 | 1 Comment »