Prologue: A mail from Luke
Soon after this page was launched, I received a mail from Luke Frankcombe, a wargamer from Australia. Among other things, he wondered about the relation between wargamers and programming. His mail came at a time when I was toying with some scripts written in Python which would simplify and automate content management of this site to some extent. After receiving Luke's mail, I decided that an article on the technology behind the page could make interesting reading and perhaps shed new light on why wargamers like programming.
Enter Python
A word about the site. This is a very small site, 14 pages in all including this. Even at this size, getting an uniform look across pages is a chore. One way to do it would be to cut and paste across pages, but what if specific pages needed small but unique changes? Soon the problem would get out of hand. This led me on a search for tools for doing part of my job. I have an interest in Python, so when Ravi sent me a link to a Python resources page, I eagerly looked it up. What I retrieved from the page was a neat little script which can be used for the very purpose I had in mind. MakeMyWeb was an ideal tool for the job in hand. It is written by Fred Pacquier, an active Python programmer. This tool defines a set of tags which can be interspersed your source document for a page. All commonly appearing stuff can be put into source files, whose contents are included in the places which you choose. Run the tool, and presto! your page is ready. The tool simplified my work, but all was not well yet. The culprit was the table of links which you can find at the top and bottom of every page. Fred's tool would insert these into every page, but I wanted the links to a particular page to be disabled when in that page. That means that when you are in the homepage(say) the table of links should look like this
[ Home | Articles | Battle Reports | Players | Links | SiteMap ]
and not like this
[ Home | Articles | Battle Reports | Players | Links | SiteMap ]
How could I do this? If I were to go to every page and cut the necessary text, it would defeat my purpose. I chose a better way: to write a script which would do the job for me. Naturally, I chose Python. The result of my tinkering is a really small python script called striptags which strips a page of all self pointing links. Striptags is not much to write home about, but it does work. The idea here is not to dwell on the quality of programs, but to illustrate how a wargamer like me found programming useful. The relevance is there not just because I maintain a site, programming would have helped me even otherwise. How? Every wargame rule involves some calculations or the other. If I remember correctly, Command Decision is one such which requires a good number of calculations per move. On the average, playing such a game would cost you in time and energy owing to the calculations which can be avoided if you have a PC handy and can write a custom made program to suit you. I am not claiming that an entire game system can be automated and made into a production quality system by amateurs. What I do mean is that the easier but manually tedious and repetitive calculations can be automated. Knowing programming would evidently be of help here.
An interesting side note here would be the theory of Open Source software. I am not qualified to lecture you on the theory of this global effort so I'll tell you how it concerns me as a wargamer. Fred Paquier wrote a script whose source code he put up on the web, free for all to copy, use and modify subject to the condition that they inform him of changes they make to the original. This is one of the most visible traits of open source programmers. By sharing their work, they ensure rapid development and bug fixing, be it a small Python script or some thing as complex as the Linux Operating system. Wargamers are a very interactive community, and have reasons to follow the open source policy. For one, it could do for programs what play testing by others does for rules. Also, those more skilled in programming could get to solve unique problems related to wargames.
This site does not use any GIFs
If you have noticed, this site is devoid of any GIFs. One of the reasons is that the GIF format uses a patented compression algorithm, and hence GIF users are liable to be sued. The reason is well explained elsewhere in the Burn all GIFs page, which you might read to enlighten yourself. When this site was designed, I had to use some GIFs as part of an article as the author of those pictures had sent them to me in that format. I needed to convert these to another format before hosting. Here also, I took the help of an open source tool called gif2png, which would convert all my GIFs to the free PNG format. I procured gif2png from Eric S. Raymond's gif2png page (BTW, Eric's pages are eminently worth many visits for reasons other than gif2png alone) and ran it in my PC to morph all my GIFs to PNGs. The rest of the figures are in the jpg/jpeg format.
There is a lot more to be said about Python, GIFs and PNG and open source software. But neither am I the person nor is this the true site to speak about these. Those interested can browse the following sites to learn more.
- Eric S. Raymond's home page
- The GNU home page
- If you are in India, the GNU-India page
- The official Python page
- The Linux home page
Update on 31 Jan 2002:
We have graduated from MakeMyWeb (great tool as it is) to using custom written Python XML converters to create the site pages. The content is now stored as XML documents. The converters make them into HTML which you see here, and relate them to a style sheet.
A sample XML fragment would look like this:
<?xml version="1.0" ?> <article title="Of Python, GIFs and Wargamers" description="..." keywords="..."> <section title="Prologue: A mail from Luke"> Soon after this page was launched, I received a mail from Luke Frankcombe, a wargamer from... </section> <section title="Enter Python"> <para> A word about the site. This is a very small site, 14 pages in all including this. Even at this size, getting an uniform look across pages is a chore. One way to do it would be to cut and paste across pages, but what if specific pages needed ... </para> <special> [<em> Home <em>|</em> <url link="articles/index.html" comments=""> Articles</url> <em>|</em> <url ... </special> </section> </article>
This fragment, when run through the parser would produce the output you see above.