Ball Race – Day 11

The first thing I did this day was to implement the Farseer physics engine into my project. What a tremendous step forward. Not only was it easy to do, it also delivered the results I had been hoping for from the moment on I got it working.

Screenshot of a tilted wooden maze with a ball in it

I’m still not sure what to do about the holes in the floor. Farseer is a pure 2D physics engine and it simulated the effect of tilting the maze board simply by applying forces to the ball, but, essentially, the ball is a circle that’s moving around inbetween rectangles for Farseer. Maybe I can get away with a fake simulation where I apply forces that push the ball further towards the center of the hole and let it accelerate downwards on the Y axis without the knowledge of Farseer.

The ball is still looking rather dull and I’m beginning to think about implementing real-time reflection mapping in my little game, so it properly reflects the walls around it. The other solution would be to make the ball non-reflective, however, however, the ball must not be textured since the rotation would never be right as long as the physics are 2D.

Ball Race – Day 10

Beta 2 of XNA Game Studio Express has been released to the public today. Porting my code to Beta 2 took me about one hour since some genius decided to make the all the model framework classes sealed and remove their generic versions. Also, the GameServices collection now lost its generics as well and requires manual downcasting.

While updating the code, I also broke something in the stencil buffer drawing code which now, instead of limiting the shadow to shadowed regions, limits the walls to holes in the floor. Fiddling around with the shader effect files for the stencil and shadow drawing solved the problem.

Next, finding some swept circle vs. aligned rectangle collision detection code on the net has prooven itself to be harder than it seemed. I don’t have the strong math backgound needed to code such stuff myself. I ported the only code that seemed usable, even thought it was originally intended for sphere/polygon collisions. My first attempt at simple ball physics doesn’t go to well and I fear I will have to integrate something like Ode at the end. Maybe the pure .NET Farseer Physics Engine can fill this gap?

Ball Race – Day 4

My wall geometry generator now produces proper normals for all the walls so the lighting should now yield the results I’m hoping for. Because I’ve never done shader programming before, I downloaded ATI’s RenderMonkey in the hope that it could help me create some simple shaders nevertheless. Not only did RenderMonkey give me the exact shader I needed to test my texture coordinate generation code, it also greatly increased my understanding of shaders with its excellent shader code generator.

So now that the walls were working, the floor came up on the task list. Normal floor plates are just boring quads, but making holes in the floor was a bit more difficult. In the end, I simply arranged some vertices in a circle and built triangles from the circle points to the nearest corner of the surrounding floor tile.

So this is what I had at the end of day 4:

Screenshot of a maze board with smeary textures und no lighting

In case you are wondering why the floor texture is so smeary, that’s intentional. Otherwise, as long as I don’t have lighting implemented yet, you wouldn’t be able to see the walls clearly in a static screenshot :)