Tuesday 18 May 2010

Input management in XNA

Managing input in even the simplest game can result in a mess of confused lines of code scattered across the entire project. I have started to write an InputManager class that can be used to easily set up and use during the game.

There will be two main parts to the class. The first part is how to set it up during game loading, and the second is how to use it during the game to check what the player is doing. I use the concept of "Actions", which can describe a particular action the user wants to do, for example selecting a menu item, asking a character to jump, or steering a car to the left.

Tuesday 4 May 2010

Simplifying complex resistor networks

After seeing this circuit diagram there were several differing answers in the associated forum regarding the resistance of the tangle of one Ohm resistors on the right side. The most common method seemed to be repeatedly applying the star-delta conversion on various parts and using other various simplifying tricks. The problem with these methods is obvious if you read the posts to the xkcd forum, everyone makes mistakes!

What is needed is a more robust, systematic method to solve problems like this, then a computer can solve it, and computers don't make mistakes. The method I will derive results in two relatively simple steps to solve any resistor network, no matter how complex. The first step is to set up a matrix that describes which nodes are connected together, the second step is to invert the matrix and solve.