Code examples from Game Programming Patterns