amolgamisation of game library to reduce globals and better error reporting