Recently, I posted about how I used AI to find and fix bugs in Star Hammer Tactics. There are other ways to use automation to ensure that a game is robust, and in this post, I’m going to outline something else I did to ensure that the game was as solid and crash-proof as possible. (Warning: This post may contain terms that only make sense to programmers!)
A test that is often performed to find if a game is robust and stable is random button pushing. That means what is says – somebody just presses lots of buttons randomly to see if the game can handle it…or not. I decided to take this a set further and use code to simulate random button pressing.
Star Hammer Tactics uses an “input manager” class. This means that between the instructions that reads the state of the physical buttons and the code that performs the game logic, there is a class that transforms the raw button state data into “commands”. So, for example, instead of the code that manages missiles having to read the ‘square’ button to see if it’s being pressed, it checks with the input manager to see if the “fire missile” command has been issued. By using an input manager, it means that player input code is in one place, instead being being spread all across the game codebase. It also means that if there is a design change, and the assignment of buttons changes, there is one place to make changes.
I decided to use the fact that the input manager deals in commands to test the robustness of the game code. I (temporarily) disabled the code that interfaces with the physical buttons, and replaced it with code that randomly issued commands. When running the game like this, it obviously didn’t play like the game should – the actions that occurred were completely random. At the main menu, for example, the command to toggle music on or off might be issued many times per second, meaning that the music would repeatedly turn on and off. The advantage of getting the game to generate the command, instead of a human, is that the game can keep the virtual button-mashing up for hours at a time.
I was pretty pleased when the first time I ran the game in virtual button mashing mode, it didn’t crash, and after a full hour I eventually turned it off. Test passed.
Nothing fully replaces humans for testing, but with a bit of thought, it is possible to engineer solutions that take of lot of the manual labour out of testing, in turn leading to more stable and solid games.



