Continued Backness
I’ve managed to put in a few hours, although they were rather distracted. The general methodology for driving the web app is becoming a bit clearer to me now and this was helped by pushing through with the exercise of cramming the existing free-form mod_python code into the Django templating system. It’s hardly integrated, and indeed the whole thing is still structured and named as per the Django tutorial, but it’s in and doing so clarified the way forward to me.
Previously (and still what you’ll see in the WIP link on the right), I was using query strings to pass info around. So, the map was rendered using the values passed in as part of the URL, e.g. x=10&y=150&hexsize=8, giving the origin of the map view and the desired rendering scale. This works fine, but it does mean that you’re exposing your workings to the user and leaving yourself open to some unwanted tinkering as well as being a bit ugly and producing some less than pretty code to generate dynamic links.
Django style shows a preference for very clean URLs and suggests embedding parameters in the URL in the form of “folders”, an example might be /mysite/journal/2004/june/23/. The Django framework then provides for parsing this and passing each value as a separate parameter, so that URL might result in a call to journal(’2004′,’june’,’23′). This is very nice indeed, and makes for neat and readable URLs as long as the parameters are logically heirarchical. What I mean by that is that for a human to think the URL is sensible then it must make some sort of sense as a folder structure. If the parameters are not clearly related then the human readability is lost and so the advantage is limited.
In my case, I tried the folder format and realised that it was just another string of numbers. However, doing it, and thinking about the philosophy being put forward in the Django framework made me realise that I actually don’t care to have human-readable URLs for the most part. I don’t want users to be cutting and pasting URLs for game pages as the game will be dynamic. If there’s a page that should be bookmarkable, then I should make a point of using a good URL structure for it but most of the game pages should neither be bookmarked or indexed by search engines. This leads me to the conclusion that I want to use session objects to store all the info about the user’s state in the game pages, resulting in no parameters or query strings in my URLs at all.
So, session things are in progress, and with the new page templating I can also possibly look at redoing the map navigation to allow centering on the point of the mouse-click rather than the current clunky fixed sector selection.

