Well why dont you just get the code from an open source game and look at that ?