Age of Mythology (also known as AoM), is a mythology-based real-time strategy computer game produced by Ensemble Studios and distributed by Microsoft Game Studios. In general, it involves managing resources and fighting, a structure very similar to the Age of Empires franchise. But then, where does Software Engineering come in?
Software Engineering is an area of engineering and computing focused on the specification, development, maintenance and creation of software, with the application of technologies and project management practices and other disciplines, aiming at organization, productivity and quality. One of the fronts in this area is the software test, which seeks to provide information about its quality in relation to the context in which it must operate, is related to the concept of verification and validation. This includes the process of using the product to find its defects. In this sense, we go to the following narrative:
I was playing while waiting for my civilization to advance from the Heroic Age to the Mythic Age, evolution brought a cost to civilization (1000 food points and 1000 gold points) which was paid beforehand at the beginning of the process.
Almost to evolution, I regretted a decision and ran to interrupt it, but it was too late, its progress was at 100%, even so I clicked to interrupt and then my civilization evolved into the Mythological Age, and I received the reversal of evolution (action that occurs when you interrupt it).
In the confusion of the match I noticed that my food and gold points increased by 1000 each, but it was not possible to reflect on it much (we were literally in the middle of a war).
After the end of the game I went to reflect on what happened, now thinking about how the system was programmed (this is where Software Engineering comes in):
- When you post to evolve, the game code must subtract from your resources the cost of evolution (in this case 1000 food points and 1000 gold points), and keep in a “box” until the evolution is finished;
- If at any time you interrupt the evolution, that cash value goes back to you;
- However, after the evolution is completed, this cash value is discarded;
- Although this should happen along with the evolution, who programmed the code may have created a kind of trigger, which after completing the evolution, sends a message advising to remove the option to cancel the evolution and to eliminate the value in “cash”;
- Thus, the trigger for this message would only occur after the evolution, this means that the evolution happens first, to then prevent it from being interrupted and the value reversed;
- So, if in the interval between the evolution and the sending of the message to cancel the possibility of interrupting the evolution, you activate the interruption of the evolution, then the game will interrupt something that has already occurred and return you the amount that was in the box.
Of course, that until then was my theory based on how I imagined that mistake occurred. Time to test:
I tested it on several evolutions too, and in fact the system seems to work with this trigger, allowing the bug to occur. Although, interrupting the evolution in this interval is very difficult, because even in a controlled environment, I managed to perform the bug more or less once every ten attempts. That is, in terms of the game this bug is unfeasible to use and even harmful to those who try, and may take more time (canceling the evolution before it actually occurs) or not yielding any benefit (canceling the evolution after the value of box be discarded).
In Software Engineering, we see some techniques to “swing” a program in an attempt to have it present some bugs at points considered critical for those who programmed. In the case of Age of Mythology, this bug was found in the communication time between two parts of the source code.