Coder Diary #28 -- Is It Soup Yet?, Part 1
Long time, no write. Time for a new Coder Diary! [a very long one]
Like the wise man, we want to re-build the Campaign Series on strong foundations. So much of the legacy code and data was built on shifting sand!Everyone therefore who hears these words of mine, and does them, I will liken him to a wise man, who built his house on a rock. The rain came down, the floods came, and the winds blew, and beat on that house; and it didn't fall, for it was founded on the rock. Everyone who hears these words of mine, and doesn't do them will be like a foolish man, who built his house on the sand. The rain came down, the floods came, and the winds blew, and beat on that house; and it fell—and great was its fall.
— Matthew 7:24–27, World English Bible
The game's -- note I wrote "game's" (singular), not "games'" (plural), referring to the original game in the series, East Front -- original code was designed and organized around a single conflict, the East Front. When the Campaign Series was expanded to include West Front, then Rising Sun, code and data were extended in a rather ad hoc fashion. A while later, there was Divided Ground, and still more code and data jerry-rigging. Take-Two acquired Talonsoft, which then died, then ... eventually Matrix acquired rights to the Campaign Series, and work was begun on the Modern War Series, including Middle East and Vietnam.
All of this Series expansion and passing of code and data from one company to another, from one dev team to the next. And every step of the way, new games and new data and new features and new graphics and ... all built atop the original foundations which were never designed to support so many different games and so many cool new features and special situations. Nobody ever stopped to assess: Where is this all heading?
By the time I inherited the code as Campaign Series Lead Coder, what a mess it all was! For the sake of our sanity, for the sake of bug-free code and Quality Assurance (QA), we have had to rethink everything, redesign and redo not a little.
So much of my time over the past two years and more has been devoted to tearing down and building back up the original games (EF, WF & RS) and the newer games (ME, VN & ...) on sturdier and more rational and more extensible foundations. Without toppling the older games in the process. Quite a challenge!
File/Folder Reorganization
Here's something that really needed to be fixed: the games' file/folder organization. Basically, there really wasn't any. Everything was simply dumped into a single file folder. So many files, so hard to wade through it all!
For example, in East Front 2.02, in the East Front folder, there are
Robert@roberto /cygdrive/f/Games/Matrix Games/John Tiller's Campaign Series 2.02 SUPPORT/East Front
$ ls -1 | wc -l
7449
nearly 7,500 files! All lumped together in just one folder!
Here are the first few files in a very long list of Rising Sun's 3,853 files:

Note how save game BTL files are mixed among the game's Application files, and SCN files, and DAT, ORG, OBX, OOB, BMP, and ... What a mess!
In Middle East, all future games, and eventually soon also the original JTCS games, we have reorganized the files into categorical folders thusly:

Here are the save files, in one tidy package (folder):

As developers, and eventually you too as modders and players, we find it so much easier to find our way around the many, many game files. File folders are there for a purpose -- to create sense and order. Let's make use of them!
The File/Folder Reorganization Project -- a very big step forward. But it came at a price. The legacy code expected to find everything in the same place, the one top-level game folder. Moving files into subfolders broke just about everything. It was a long and tedious process hunting many dozens of file references in the code and revising them just right. LCGs, for instance, were broken for several months, because in dozens of places the code was looking for this or that file and, not finding it, would typically crash the game. I devoted an arduous two weeks to identifying and fixing the broken file references to fix LCGs alone.
A long and hard process. But was it worth it? You bet!
[to be continued]






