development     reviews     feed

Progress, or Lack Thereof?

After using the Farseer Physics Engine some more, it became clear that I needed to move on to drawing some sprites, that being one of the most basic things you can do with XNA - when I originally was testing Farseer, I was only drawing its own debug output. So, when I tried to integrate Farseer’s output with some test sprites, I ended up with the following…

A view of the debug mode of Farseer.

My physics simulation is of the red box falling on the rectangle under it, and the Farseer debug output is inverted and strangely corrupt in the middle of the image. This could be as simple as an incorrect rendering call, which may need me to supply it with the proper matrix transformation. However, it could be my conversions between pixels and Farseer meters as well - it could really be a number of things, and I’m just not sure where to start debugging. I have scoured the Farseer forums and found a couple of posts mentioning similar happenings to the above, so hopefully with a little more research I’ll be able to find a solution to the problem.

I spent a lot of yesterday and today working on this problem, but I also got quite a lot accomplished - however, the things I accomplished were not my immediate goals. To test the physics, I needed to take care of input, and instead of just hard-coding everything I laid out a simple design for an XNA input handler that can be polled regardless of control method for game actions and if they are pressed or not. It also has a history that can be used to look back at previous controller states.

On top of this, I found a great little XNA Camera class, but it came with its own input handler. I got this running, and tried to attach the camera to one of my Farseer Bodies - the falling box - but the camera ended up pointing at blank space, further indicating that something is wrong with my drawing or scaling. But it brings a lot of ideas and functionality to the table, so I will work on fixing whatever is wrong with my codebase so far. After I saw that it mostly worked I decided that I needed to get rid of the duplicate input handler and change the Camera class to use my own input class, so I did that - after I was done, I tried running the game and performance had dropped to 1-5 frames per second… I commented out all the camera code and everything was back to normal, so clearly I need to keep working on these things.

Unfortunately, all these problems are going to prevent me from meeting my 10/19/10 goal of having a light component up and running, although I think that the work I got done in the past few days will serve me well after I get the problems ironed out. Still, it is just not the progress I was expecting, but I am not too worried as it is still early on in the project.