theInsomniacGameMaker

View Original

Occam's Razor

We were working on our midterm project. We here refers to a team of 5 developers. The game we were making was Tanks 2018.  The primary focus of the game was the multiplayer experience. To play the game in multiplayer mode, the game required 4 controllers. Since we were a team of 5 developers we had more than 4 controllers so we could test a feature if we needed to. We decided to use Xbox controllers since they are natively supported by the Windows. A day before a sprint review, when we were patching all the bugs, the controllers suddenly stopped working without any reason. The game could not be played without a controller, so if we didn’t fix this, our professor wouldn’t be able to play the game and that would tank our grades.

It is 1 in the morning, the whole team is very tired, but we cannot leave unless we fix this controller issue. All kinds of debugging ideas were being implemented. Trying to install updates to the game engine, rolling back to an older version of the game engine, checking controller cables, connecting the controllers wirelessly, checking if the controller was actually sending input the laptops, changing the code. Five developers working hard on this problem. Sometimes after changing some code, the controllers would work but the results weren’t consistent. One of my team members shuts down their laptop to give their eyes a break and Windows started installing an update. After the laptop rebooted, the game was tried on the newly updated machine and seemed to work perfectly, without a single hiccup. Everyone looked at each other wondering if the windows update solved the problem. We tried updating our laptops but to no avail. The game somehow started working on one of the laptops. It was 4 in the morning now, tired, everyone decided that we would just showcase the game on the laptop that seemed to work. The review went well, we scored the highest in the class, with a whopping 97.

We still couldn’t figure out the bug. As we progressed in the project we realised the issue and even found the fix. The fix was to restart the laptop. The problem was that when an Xbox controller is plugged into a Windows machine, the Windows machine gives the controller a number which determines if it is player 1, 2, 3 or 4. We would plug so many different controllers that often we wouldn’t play with the “player 1” controller and that was the reason the game wouldn’t work. Restarting the laptop would clear the number assigned to the controller and resolve the problem. When the team thought the windows update had fixed the problem, it was not the update but rather the restart that windows performs right after an update that fixed the problem. We just had to restart the laptop, nothing else, no complicated registry entries, not a game engine problem, not a code problem, all it needed was a restart.

Try the textbook solution first, before trying out of the box approach.

More often than not, the simplest solution is the right one – Occam’s Razor