About this blog

Entries in this blog

Well the D3DApp framework appears to be totally ported at this point. Font stretch bug is fixed. I just last night fixed a bug that was causing the timer to occasionally hang up temporarily on resizing. This was due to the fact that I was not properly handling window states. A few boolean flags latter and it appears as if the bug is squashed. I also went ahead and implemented IDisposable. This was a suggestion in one of the comments from a previous entry. I feel this is the better way to go and will make deriving from the class safer.

It definitely feels good to be away from C++. I still find my self trying to get out of the ruts the language put me in. When using C++ we all know there are certain things you do a certain way for a good reason. In C# things are done differently and take a whole new mind set. C# for sure seems to push better programming practices on the developer. With C++ it is always finding the right workaround in C# I only encountered one workaround I needed and that was to handle window states. C# does not expose a Restore event for the window. So you need to keep track of whether or not the window was previously minimized or maximized so you can properly Reset your DirectX Views and SwapChain to new sizes.

Even with my positive experience thus far I find my self wanting to fall back to C++. It grew on me almost like a child. I could write C++ code as fast as a lot of people can write C#, Python, or even Java. That comes with experience.

Overall I am very pleased with C# it is like a fresh breeze in the air. Will I go back to C++... Not sure lets give C# some time I am sure it will grow on me.

Before I forget CODE:

using System; using System.Drawing; using System.Windows.Forms; using SlimDX; using D3D10 = SlimDX.Direct3D10; using DXGI = SlimDX.DXGI; using SlimDX.Windows; using System.Text;

public virtual void OnResize() { // Release our resources as long as we are not null. This will prevent // Internal reference counts from accumulating. Put here to be on the safe side. // Not 100% sure if neccessary. if (m_RenderTargetView != null) { m_RenderTargetView.Dispose(); }

Ok so I got the entire framework implemented at this point. Timing is done, creating the window is done, and displaying performance information is done.

Got some more code this time around too. I am not exactly sure if I am handling my resizing events properly here but all seems to work properly. The only issue I notice is the fact that the font seems to stretch with the screen resizing. Not to mention the font is not nearly as crisp as it seemed in DX9. If anyone knows why it is doing this feel free to chime in. Also yell at me if I am handling my resize events wrong or something. I come from a heavy C++ use background and my C# event handling is very rusty.

First the GameTimer class. This uses System.Diagnostics.Stopwatch in a way that mimics the C++ QueryPerformanceCounter.

As I said in my last entry it has been a long time since I touched C#. So as I was doing the port of the D3DApp framework for the DirectX 10 Luna Book, I realized quite quickly that I was trying to write C++ in C#. Not going to work. So I took a dive into the SlimDX sample MiniTri to get a general quick refresher on how a C# programmer does things. This sample + the MSDN helped a lot on giving me a nice refresher.

The code is not fully finished yet. I still need to get the font display coded and the GameTimer coded, but none the less I got a fully functional Direct3D 10 window running. The window is cleared to blue and I tacked in the functionality to turn on and off VSync. I hate when the video card transistors scream at high frame rates.

There are two things I learned from sitting down to do this. One it is really a excellent way to reinforce the learning curve of the massive DirectX API. You can't just sit there and copy the code or look at the code and port it. The best way I found to go about things is the read the chapter then implement it on my own in a C# way. The advantage is you actually learn the API not how to copy code and you can get a nice clean framework to use compared to what the author provides. The second thing I learned is probably the biggest one. Why was a torturing my self with C++ all these years. C# is a very clean and powerful language and just looking at the code you can tell what it does. I will say the code I put together is not perfect yet or finalized in anyway but it is indeed a lot cleaner then the authors C++ code. The main reason I can see that this is so would be the removal of Macros and Preprocessor directives. Not to mention the exclusion of header files.

Now again keep in mind this is not finalized yet still needs some tweaking. Plus some more implementation but here is what I got so far.

using System; using System.Drawing; using System.Windows.Forms; using SlimDX; using D3D10 = SlimDX.Direct3D10; using DXGI = SlimDX.DXGI; using SlimDX.Windows;

I recently just picked up the newest luna book on DirectX 10. Just when I thought DX9 was very clean DX10 takes it to a much higher level. The logical flow of the API is much better.

It is going to take me some time to get into this however. I have made the choice to step back from C++ somewhat. I love C++ don't get me wrong but I can't help but be intrigued by SlimDX. If I did not at least check it out I would not be content with myself. I am always enthusiastic about new ways to do things. For this I must shift to C#.

I have not used C# in quite a few years so it is going to be a decent shift in mindset. Going from a native way of thinking to a managed way of thinking so far has been awkward. I am going to be porting the code to C# as I go so I will make sure to post up lots of code as I move along.

This will not be a port purse because I don't think a direct port is going to be pretty. After all the code should look and feel like C#. So it will be more of a redesign. Sharp Develop is up and running SlimDX installed. Luna book is in hand lets see what I can do.

Well I have been tinkering around with OpenGL as of late. Just basic fixed function pipeline stuff via the 4th edition of the OpenGL SuperBible. I will say OpenGL initially seems as if it is easier to remember functions due to the naming conventions compaired to D3D. But the OpenGL SuperBible is rather lack luster IMHO. The author seems to skim over a lot of things that the Luna Book covers in depth for D3D. Thankfully the Luna book covered the topics so I really don't have any issues. The other issue with the book I find is the code samples. First the book uses FreeGlut. I had to go and compile the library. Would have been better if the author used SDL I think. Next some of the pre-compiled Code samples don't even work. I am running a HD 4850 that supports every feature of OGL up to current standards. There are 2 or 3 FBO code samples that don't work at all but the rest do. I have a feeling it is a error on the authors part and there is no Errata for the book stating so.

So the low down:

OpenGL seems easier to remember but the books teaching the api out there are lack luster. I might be better off with copies of the Red/Orange book. The structure of OpenGL code can be a little harder to follow due to its C Nature. This leads to things being broken up into a lot of small function calls to achieve what you want.

D3D seems like it is put together a little better but harder to remember because of unintuitive naming conventions. Things in the D3D api seem to logically flow together. Mostly because it is more object oriented. Resources for learning it are a lot more structured and detailed.

Each has the pros and each has the cons. Not sure which path I will take yet going to continue to tinker around with this OpenGL book a little longer so I can at least compare code that does things the same way. Hopefully I will get to VBO's soon and away from this glVertex crap. Might just have to skip ahead.

Well I have been learning DirectX as my last entry stated. After 8 chapters of the Luna shader approach book and a few days of self experimentation I can say I am comfortable with what I learned.

Now I want to take a look back at OpenGL. Quite a few years back I started messing about with OpenGL. I think at this point it is time to revisit for a few reasons. First a foremost I am a much better developer then I was back when I first started experimenting with it. Secondly I have a much better math background. When I first started dabbling with graphics programming in 2D/3D I found a passion for math. I use to hate it. But now I have a practical reason for using it making me find it much more interesting.

So I will start to screw around with OpenGL. I don't have a OpenGL book the quality of the luna book but I understand how to set up Win32 and OpenGL Devices already. It will just more or less be lets convert one of the luna book examples to OpenGL and see which API I like better.

For the last 2 weeks or so I have been working through the Luna DX9 Shader approach book. I have currently traversed 8 chapters in this book. The Luna book is phenomenal for one. All the source code is very well documented and everything is explained really well. The only thing slowing me down is the vastness of the DirectX API. It is huge. I dabbled with OpenGL in the past but by far I would say DirectX has the steeper learning curve by far. But at the same time it seems a lot more rewarding near the end. The API is very clean and well thought out.

But as I said the API is large making it hard to remember a lot of the concepts. Almost like a giant overload. So I think the best thing for me to do at this point is to take a break from progress in the book. This will allow me to drill all the concepts that I have went over thus far home. I will take what I learned and apply it to my own little demos, hopefully this will make it easier to remember.

This entry was sparked by me remembering about this discussion while replying to one of those I am a beginner and want to learn C++ threads.

As of late I have been having some debates with friends of mine about games/game development in general. One things that always comes up in these kinds of debates with my friends is how I am a masochist. They say I am a masochist for using C++ and enjoying looking at things from the system level.

I always tell them ever since I was little I have had a hunger for knowing how things work internally at that level.

That above statement has really got me doing some self reflection. I don't really post on here much about progress on games and what not for one reason. I never really make much progress. It is not because I don't do anything or don't understand how to make a game. Instead I always get tied up in my main interest. The underlying subsystems. I will say ok here is my game idea. Net you know it the game idea is thrown out the window and I am using it as a test bed for new rendering theories and component structures, physics tests and the like. Overall I would have to state I really don't care about making the next greatest game. I enjoy tinkering down at the low level game subsystem level.

You know all those little components that game programmers use to make their games. Render systems, physics systems, ai systems. These low level details are really what I enjoy about game programming.

I would consider myself one of the few people who would enjoy myself more if I was writing graphics engines, and physics engines. Maybe even scripting systems. The stuff that people are always looking into some game engine to do for them because they want to get their game done and could care less about how things work internally.

So I have come to a conclusion maybe I should focus my time on these things I enjoy rather then forcing myself into writing a game. Instead maybe my purpose is to make it easier for others to write games.

No updates on the game today however, I have been working with 2010 Beta 2. My first test revolved around the ease of setting up Boost and Boost Test. In the past Boost was notorious for breaking intellisense. It was to the point where it was almost guaranteed to break it. This is the first change microsoft made. .ncb file are gone completely and intellisense is now driven by a database of sorts using a .sbf file.

The one thing I noticed about this is that Visual Studio now must parse the project and all its includes etc... and do so on the fly quickly as you make changes. This works phenomenally. There are a few bugs and quirks I noticed where there may be a slightly lengthy pause occasionally after typing a . but that could be related to a issue I was having that I will get into. The best thing is though it works with boost flawlessly. When you frist create your project it takes a few secs to parse the entire boost lib. Does not break intellisense and even gives you a tooltip showing the arguments functions take. Also it is guaranteed to resolve after use press a . which is even better yet.

This issue I talk about was originally in prior VS versions to do boost unit testing you needed to link to the lib of the project you are testing. This was done with a right click option called Project Dependencies. This option still exists but I was having a lot of issues with it. This is because microsoft changed the build engine for C++ from vcbuild to msbuild.

With a simple question MS came to the rescue and told me about a new feature called project to project references. I was told all old vs solutions that are coverted are auto converted to use project to project references where they were using project dependencies to ensure proper linking. They told me to switch to using project to project references. So I did and it is very easy. Right click on the project that needs the reference. Go to properties then common config. From there you go to references and add. Your projects auto pop up to select from then you select and hit ok and bamb good to go. Yes you still need to tell the referencing project where to find the header files.

Once I did all that surprisingly it seems intellisense is even faster did not notice any slowdowns at all. Most of all I did not have to do my workaround to get the lib to link.

I must say I am very impressed with this release. I think it will make life better for all.

I just installed Express 2010 beta 2. One thing I can say it is very fast. In the coming days we will see how it works out. So far I was able to build SFML and Boost with it. I did stumble into some issues with SFML but resolved them. Turns out the /INCREMENTAL option was turned off in one of the Build Configs. Once I flipped the switch it seems to build alright. We will see if it actually works at a later date.

Well I am currently working on putting together a cross platform C++ development tool chain. I want to use Boost Build and Boost Test for sure. Both are very amazing. Currently I feel the best route would be to use the compilers meant for each OS and Boost Build will greatly aid in this. It will allow for the MSVC compiler on windows and GCC for linux. The only stumbling blocks right now are editors / Debuggers. It would be nice to not have to learn cmd line for 2 different debuggers but that might be the only case. Editor wise I can go with anything really even Non IDE. Or I might just be able to use VC++ Express and use boost build on linux only. Suggestions are welcome I am very open minded. Sometimes I wish there was a compiler that was shared between all Operating Systems.

EDIT: After many gripes with this today I have decided to screw it. The headaches of worrying about cross platform are not worth it time to get visual studio set up and work on my damn game.

I am not going to bother with posting the code I used. I am going to try to keep this as short and sweet as possible because we all know benchmarks are to be taken with a grain of salt. The main conclusion I came up with is beware of for loops they can really bog down code so use them sparingly. So here are the results which are not surprising that java is faster. So here are the results.

First results are with a for loop that reruns the code 1000 times. By resetting positional values. This shows that Java with a for loop is about 2.3x as fast as Python mathematically.

These second results are without the for loop and just running the math through one iteration showing that Java is 5.1x as fast as python without a for loop.

Python average without for loop after 5 runs 0.041 Java average without for loop after 5 runs 0.008

Now these numbers seem insignificant, however, from my experience once you add in collision detection, with the physics and the rendering these numbers can become exponential and cause some bottle necks in your game.

Based off experience and the fact I have many languages under my belt and knowledge of core programming and game programming data structures and practices I am going to be looking into either going back to C++ or Java for my game coding. Because I know somewhere in my newest game with python I will have to optimize a lot of code by moving it to C++ anyway.

Not too much of a update here. I settled on Subversion for source control once I got it set up on my External HD it is very easy to utilize once that was all done. On another note I may be switching langs. I started to notice a few issues through some prototypes that are a sign of python's horrible mathematical performance. So I am in the process of doing some profiling. I don't like having to drop down to C++ from python if that is the case I might as well use C++ and embed python on top of it for basic logic. This can even get ugly. So what I am going to do is run some bare bones profiling. Basically I am going to ignore graphics and collision detection and write some test physics code to profile. I am going to do my best to keep it objective. Going to test both Python and Java for now and see what I get.

|Warning Wall of Text Incoming if you want to skip the rant read below the divider.|

First and foremost lets address some comments and clarify a few things. My last entry drew a comment that brought out a particular opinion I have that I have not really stated in quite a long time to anyone. The comment basically went about how if I don't have any games under my belt I am going about things the wrong way. I have to outright disagree. I am a very open person and listen to lots of suggestions but this is one I just can't.

For one I do have a few games under my belt. Granted they are not original games but they are clones of some old time favorites ranging from pong to space invaders. I don't have a degree but am very close to one I have 3 years of a BAS completed that I did not get to finish as of yet due to personal reasons but I will get back there, however I do have a solid background in data structures, algorithms, mathematics, and fluent in about 5 programming languages. After all once you understand the core concepts of programming it is just syntax.

The fact that I want to start up my own small time indie game company seems like a common mistake that a lot of people out there make. From my life experience this is not actually a mistake and highly miss suggested as one. People have to realize that big companies like ID did not come from sitting around and doing nothing. They started as small time indie studios who had the "balls" to take the risk. They had a passion and they went for it.

One quote I will always remember is from my late grandfather. He told me if I have a passion to go out and get it no matter what the risk. He said if you don't take the risk you will never be successful. If you fail so be it but don't let that stop you get up and try again. Do whatever it takes to achieve that passion.

If you don't go out there and try you will never make mistakes to learn from and you will certainly never achieve a goal.

I have been through quite a few web designs as of late. For me web design is more trial and error and I don't care how long it takes as it is only a side project and my game comes first. The more I delve into it more more I simplify it so it can run easily across all mediums. I say within the next few days I should have it in a solid state of simple and effective but nice looking.

Now on to the real project my game. Currently the project is named but I am not going to release that just yes lets just say it is a 2D Platform game. Lots of feature brainstorming sessions going on for now. But while that is going on I am in the process of putting together a package structure for it so i can start developing the core systems needed so I can lay out some feature prototypes and start forming it into the actual game.

For python the package structure is very important as it dictates where the interpreter finds you imports and such. The main goal is to develop the game in such a way that I put together a reusable library of systems that are well tested and reliable. For the testing and reliability unit testing will play a big factor. When putting together a package for python you use a file name __init.py__. This allows python to dynamically put together the import lookup table for your code. I have been going through many different layouts and I think I might have narrowed it down to 2 possibilities. The main difference of the two is that the latter does not subdirectory the Libs folder.

This is where other python user suggestions will be really helpful. Swiftcoder I need your input :D

So I am in the process of starting up a small indy game company. It will start as a one man operation pritty much and the plan is to release the games for free. Just a little something to occupy some time really. Who knows maybe it will take off and get bigger. But not worried about that. So through some research I realized that now a days a lot more goes into a website then XHTML/CSS and PHP. So I broke out the rusty Gimp skills and put together a entire web site mock up. This is the result of many hours of work I would estimate about 7 hours of work with research time included. I wanted to get this layout just right so I was tweaking stuff constantly. The next step will be to splice up the site into small images and then use those with XHTML/CSS via image replacement to build the functional site. I will also be using PHP to deliver database driven news.

I would like to know your opinions on the mock up. I am a big fan of constructive criticism. Click the thumbnail to make the mock up bigger.

Currently I decided to go with Mercurial seems SVN is not content with putting a repo on my external HD. That was the biggest decision factor right there. If somone knows how to get svn to work on a external HD let me know. I really don't want to have to go through the trouble and get a source control host when it is not really needed.

As for editors I decided to go with Programmer's Notepad 2.0.10. The reason for this is that it is a non bloated very configurable editor. Currently I can run my python scripts, execute pylint, and run unitests all right from the editor after some configuration. Was not the easiest config but I got it to work non the less.

The hardest thing I had to setup today was Pylint. I started by getting it with easy_install. Then I ran into the issue where it kept closing my command prompt so I could not see the output. So with some diving I traced it back to the batch file that executes it on windows.

The next issue was to config Pylint to abide fully by pep8 and that meant changing a regular expression for global variables from all caps to all lowercase. So I used pylint to create a pylintrc.conf file and I tweaked it and added that conf file to my PYLINTRC env variable.

Tada it works. Then I had to get it to work in pn2. Issues issues issues. Turns out pn2 does not execute these things through the regular command prompt. So after a few min I realized I had to give it a path to the bat file and not just the command you use in the prompt. Then I had the issue of it not using my env vars so it was not finding the config file. So I had to force specify the config file location before the file name param. Now all that is done I can happily code with only a mercurial prompt open and ipython open.

Hello everyone I am back after quite a long leave. Personally the only thing I can blame is WoW Raiding and Dragon Age Origins. Both have me all booked up most of the time.

So on to better things. First off I have a new project underway that is going though some brainstorming right now while I work on setting up a decent development environment for Python. Editors aside the biggest decisions I need to make is what source control I want to use and if I want to use unit testing or not.

I have never used unit testing before and this might be a good time to try and use it who knows maybe it can make me a better programmer or maybe it will just be a pain in my ass not exactly sure.

As far as source control goes the big debate goes between SVN and Mercurial. I am trying to decide based off of the way I like to work. Not easy because either can do what I want. This is where you guys come in maybe you can give some suggestions. First off I am very heavy in iterative development. When working on a game if I have a idea that I think will work I will iterate on it in the game see if it turns out and works well if not I tear it out and go back. This process is never ending and in the end I have a game. The more I think about it the more I can lean towards mercurial here is what the work flow for each would look like.

Checkout From Repo Branch for Feature 1 Branch for Feature 2 Work in trunk for non game breaking stuff Merge complete branches with trunk

To me it seems mercurial makes it easier for branchy development. From a iterative standpoint each "trial feature" is easier to just toss out if it does not work. You simply delete that clone and all is well. It allows you to always clone of a pristine copy as well.

If any of you guys have experience with any of these give me some tips especially if you can point me to python exercises for unit testing.

Just picked up a Zune 8G yesterday. This is a very nice piece of hardware and I love it. Very nice music/video organization coupled with great battery life. Next step I think will be to write a small game for it with XNAGS. Looks like orbis is comming back in a rewritten state to make it battery friendly.

So I am on the hunt for some music and sound effects files. It is kind of tough to find the right stuff that is free. I could probably use some stuff from my CD collection but if I decide to let some people play Orbis that is a bad idea. The worst part is XACTS limitations for needing to use wav files only. Damn you XNAGS.

Well no updates on orbis today. I have been thinking a lot about game development tho. One thing I have been looking into is using SVN to make a repository on my external SimpleTech 1TB USB2.0 Hard Drive. I would use TortoiseSNV for this obviously. Another thing I have been thinking about as of recently is Unit Testing in games using NUnit or XUnit. I have never done unit testing before but it seems like it can be a lifesaver is some major code refactors and such.

On another note I have 2 more ideas for games however, they are both 3D. I really don't want to say much about them because I am hoping I can get atleast one of them done for XBLCG which is going into effect Q4 of this year. I really hope I can get orbis out of the way to work on one of my real projects I have been putting alot of effor into mentally. For me 2D is just a steping stone to learn game concepts. My ultimate goal is 3D. It kinda sucks because I am not putting much thought into orbis because of this. Instead I have been reading up alot on 3D development to get the concepts in my brain.

On another note I have been playing a lot of diablo 2 lately. It is quite interesting how a game 8 years old tickles my fancy more then crysis does or even oblivion. I have been playing D2 since launch and the element of suprize is totally gone. It is sad when you know what the item is before you UNID it. But on another note the game still has a lot of fun factor to it.

I know I know I can't give up on orbis. I won't give up on orbis. Next journal entry should have quite a bit done.

Remember life is like a box of chocolates. You never know what u'r gunna get.

Well I did some work on orbis today. Not much a bit short on time. I got the initial backdrop of the title screen done. To do this I used the dreaded GameComponent feature of XNA. GameComponent derived objects can be quite handy and abstract the code nicely for reuse if they are coded properly. I however can see these GameComponent objects being quite a sloppy mess and hard to follow in larger projects. In my book I am learning XNA from they overuse game components I think. They litterally make everything a GameComponent. Not bad in principle but as I said as the projects get large I think they can be a burden. But anyway onto the code..... (note main game code missing just the components are shown.)

Scene.cs (this is the main scene component all scenes are derived from this)

using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.Content;

/// /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// public override void Initialize() { // TODO: Add your initialization code here

base.Initialize(); }

/// /// Allows the game component to update itself. /// /// Provides a snapshot of timing values. public override void Update(GameTime gameTime) { // makes sure the child components of this scene are updated when they are enabled(active) for(int i = 0; i { if(components.Enabled) { components.Update(gameTime); } }

/// /// Set the state of the scene to display it /// public virtual void Show() { // set state of the scene Visible = true; Enabled = false; }

/// /// Set the state of the scene to not display it /// public virtual void Hide() { // set state of the scene Visible = false; Enabled = false; } } }

StartupScene.cs (this is the main title scene of the game not fully complete)

using System; using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.Content;

/// /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// public override void Initialize() { // TODO: Add your initialization code here

I settled for very simple here. This is the sprite sheet that contains the target orbs. Each orb here will have a point value. Tomarrow I will start working on the power up orbs they will be on this spritesheet as well. The players ship I decided to put the player ship in its own image file that will come soon as well. Here you go enjoy the simpleness of these orbs.

Ok ok. That last post was a bad tangent. I am a programmer lol no way in hell will I get amazing at art. My art is my code. Back to XNA and Orbis and tossing together some sprites who cares what they look like if the game is fun.

Over the last few days I learned something about myself. I always knew I was not bad at art in general. I can draw rather well, however, over my last few days of experimenting for hours using gimp and other such programs I found I really am not that bad at the computer art side of things. With some practice I noticed I keep getting better and better at making visuals in my head become a reality and I have alot of fun doing it. So I am taking a new direction to my learning and applying it to art. I see all the time how people on this site have a hard time with the art side of things with their games and finding artists for their projects. Maybe I can help fill that gap. So this is my new direction computer art and animation. Wish me some luck after all I am enjoying it more then I ever did programing.