This entry is meant to quickly describe what Crindigan is, and what led to its creation.
As the description on Google Code states, it is basically a web-based role playing game, played through a user’s browser using standard technologies like AJAX to enhance the experience. You create your first character, then spend artificial money to purchase new recruits, items, and equipment. You can organize the characters into multiple squads, then use those squads to explore the game world and fight enemies/other parties.
Crindigan is actually my third attempt at creating a web application like this. My first attempt started in the Fall of 2005, maybe six months after starting to learn PHP. Back then, I really had no knowledge of proper application design, and so it was a sloppy jumble of code based on the “RPG Creator System” program badly ported to an object-oriented architecture. It eventually died off after a few months, as it was a pain to look at.
My second attempt started a year after the first, in Fall 2006. This one lasted for over two years, with the last change happening in December 2008. It only worked with the vBulletin forum software, and in fact had portions of its architecture based on it, such as session and input handling. The RPG started out in PHP4, and went through some small rewrites and design changes, but nothing drastic. In the end, I had a 17,000 line codebase written with PHP5 features, that also included a couple thousand lines of JavaScript for fancy battle, equipment, and skill learning screens. Why did I abandon it? It was still running on the architecture I made in 2006, with a few hacks added on top of it for things like fancy URLs. There was no clear separation between the model and the view, and new features were becoming harder and more clumsy to add. At this point, I had two choices: continue adding hacks to the existing codebase, or rewrite it from scratch. Since I now had almost four years of programming experience, I opted for the rewrite, mainly as a test to see how far I progressed and whether or not I could finally make something maintainable.
And that’s how the Crindigan project came to fruition. Of course, it didn’t really have a name until this summer. Development has been slower than I would like, but at least I’m now feeling proud about the code I’m writing. From the start, I declared that PHP 5.2 would be a requirement, and I would force myself to follow the MVC design pattern, which has really helped to keep my code clean. Most of the work I’ve done has been on the framework rather than the application itself, though things like logging in were written, along with parts of the style. My next task is to rethink how I’m handling updates and inserts through the Model, such as making it a bit smarter but without overdoing it, as I’m not particularly interested in coding a full-blown ORM. After that comes a forms library, then finally I can get to the application itself.
See you next article!