I’ve updated my Portfolio page with another personal project: a Lone Wolf Combat Calculator for Windows.
What is the Lone Wolf Combat Calculator?
The game-books were popular in the 1980s and 90s and cast the reader in the role of Lone Wolf, the hero of the series. They feature non-linear stories that let reader choice affect the outcome, as well as simple game mechanics to resolve combat scenarios.
The books rate the effectiveness of combatants with a numerical Combat Skill. A Combat Ratio is calculated by subtracting an enemy’s Combat Skill from Lone Wolf’s. A combat’s outcome is determined by cross-referencing a random number with the Combat Ratio on a Combat Results Table.
The Lone Wolf Combat Calculator replicates this mechanic.
I came up with this project as an exercise in programming a GUI application using C++. While I used the language for some of my coursework in school, those assignments requiring user input generally did so with a simple command-line interface. I wanted to try making something that looked more like a Windows program.
But what tools to use for developing the project? At first, I considered Visual Studio because I had some experience with it and knew it came with tools to design a GUI. For help getting started, I looked at a couple tutorials that happened to use the C++/CLI language specification.
After experimenting with C++/CLI, I decided it didn’t suit my needs very well. It also appeared to be a specification that’s no longer supported. At the time, I didn’t realize C++/CX and C++/WinRT existed, which might have been better options. Instead, I looked elsewhere for an IDE and GUI library.
Besides the issue with settling on a set of tools to develop the project, I had some trouble setting up Code::Blocks with wxWidgets. I found a video on YouTube that guided me through the process of downloading the wxWidgets source code, compiling it, and preparing it for use in the IDE. After working through a few wxSmith tutorials, I was good to go.
During development, I had some initial difficulty in handling cases where the user might click the OK button to calculate a combat result without first entering Combat Skill values for both the Hero and Enemy. After first trying to use error messages to warn the user in such cases, I implemented a more elegant solution.
When the application launches, only the panel used for entering Combat Skill values is enabled. Once both a Hero and an Enemy Combat Skill are entered, the rest of the interface becomes active, allowing the user to continue. This solution has the additional benefit of guiding the user in how to interact with the application.
Check Out the Project