Right now I am trying to close the most visible of bugs and unwanted issues to move on to more interesting aspects of the game, namely environmental hazards, but certain things are harder to catch and solve than others.
Procedural generation of contents introduces a specific kind of problem that is not easy to understand and solve, what may be called edge cases. Edge cases are an engineering concept for something that happens at the “boundary”, but not quite over, the set of possibilities of a system or, in this case, algorithms.
The screenshot depicts an empty level, which is a quite egregious display of edge case.
As you can guess, the problem with these is that they are not easily reproducible. It is not even a bug in the strict sense: the algorithm has done its work and it just so happened that with certain starting conditions the only acceptable solution was an empty level.
Another edge case that Daniele and I found is that certain levels do not generate enemies in them. I suspect that this one may be a concrete bug, although it seems strange nonetheless.
As a system or algorithm grows in complexity, designing against edge cases can be very difficult. A good mixture of experience and strong design can help in minimizing the risks but sometimes it just pushes the “edge” further until catching them early on becomes nigh impossible.
For now what I can do for Wizards’ Duel is try to be catch the most evident of these edge cases and place safety nets to ensure that certain conditions never happen. Later on, when the engine is more consolidated, I will try refactoring and simplifying the most complex part of the algorithms, since simplicity usually gets along well with correctness. Finally a good round of beta testing will hopefully iron out the last of these issues.
It is my first time with a project of this size so I am still struggling to find a good way to catch these in advance or design around them as much as possible. If you want to share how you manage edge cases or some funny/interesting one feel free to leave a comment or share them with us on twitter.
Thanks for reading.